responseMock = m::mock('\Facebook\FacebookResponse'); } public function testCoverGetsCastAsGraphCoverPhoto() { $dataFromGraph = [ 'cover' => ['id' => '1337'] ]; $this->responseMock ->shouldReceive('getDecodedBody') ->once() ->andReturn($dataFromGraph); $factory = new GraphNodeFactory($this->responseMock); $graphObject = $factory->makeGraphEvent(); $cover = $graphObject->getCover(); $this->assertInstanceOf('\Facebook\GraphNodes\GraphCoverPhoto', $cover); } public function testPlaceGetsCastAsGraphPage() { $dataFromGraph = [ 'place' => ['id' => '1337'] ]; $this->responseMock ->shouldReceive('getDecodedBody') ->once() ->andReturn($dataFromGraph); $factory = new GraphNodeFactory($this->responseMock); $graphObject = $factory->makeGraphEvent(); $place = $graphObject->getPlace(); $this->assertInstanceOf('\Facebook\GraphNodes\GraphPage', $place); } public function testPictureGetsCastAsGraphPicture() { $dataFromGraph = [ 'picture' => ['id' => '1337'] ]; $this->responseMock ->shouldReceive('getDecodedBody') ->once() ->andReturn($dataFromGraph); $factory = new GraphNodeFactory($this->responseMock); $graphObject = $factory->makeGraphEvent(); $picture = $graphObject->getPicture(); $this->assertInstanceOf('\Facebook\GraphNodes\GraphPicture', $picture); } public function testParentGroupGetsCastAsGraphGroup() { $dataFromGraph = [ 'parent_group' => ['id' => '1337'] ]; $this->responseMock ->shouldReceive('getDecodedBody') ->once() ->andReturn($dataFromGraph); $factory = new GraphNodeFactory($this->responseMock); $graphObject = $factory->makeGraphEvent(); $parentGroup = $graphObject->getParentGroup(); $this->assertInstanceOf('\Facebook\GraphNodes\GraphGroup', $parentGroup); } }