responseMock = m::mock('\Facebook\FacebookResponse'); } public function testCoverGetsCastAsGraphCoverPhoto() { $dataFromGraph = [ 'cover' => ['id' => '1337'] ]; $this->responseMock ->shouldReceive('getDecodedBody') ->once() ->andReturn($dataFromGraph); $factory = new GraphNodeFactory($this->responseMock); $graphNode = $factory->makeGraphGroup(); $cover = $graphNode->getCover(); $this->assertInstanceOf('\Facebook\GraphNodes\GraphCoverPhoto', $cover); } public function testVenueGetsCastAsGraphLocation() { $dataFromGraph = [ 'venue' => ['id' => '1337'] ]; $this->responseMock ->shouldReceive('getDecodedBody') ->once() ->andReturn($dataFromGraph); $factory = new GraphNodeFactory($this->responseMock); $graphNode = $factory->makeGraphGroup(); $venue = $graphNode->getVenue(); $this->assertInstanceOf('\Facebook\GraphNodes\GraphLocation', $venue); } }