responseMock = m::mock('\\Facebook\\FacebookResponse'); } public function testDatesGetCastToDateTime() { $dataFromGraph = [ 'expires_at' => 123, 'issued_at' => 1337, ]; $this->responseMock ->shouldReceive('getDecodedBody') ->once() ->andReturn($dataFromGraph); $factory = new GraphNodeFactory($this->responseMock); $graphNode = $factory->makeGraphSessionInfo(); $expires = $graphNode->getExpiresAt(); $issuedAt = $graphNode->getIssuedAt(); $this->assertInstanceOf('DateTime', $expires); $this->assertInstanceOf('DateTime', $issuedAt); } }