diff --git a/src/FacebookDriver.php b/src/FacebookDriver.php index 68bc3e1..3c9f5a1 100755 --- a/src/FacebookDriver.php +++ b/src/FacebookDriver.php @@ -460,7 +460,7 @@ public function getUser(IncomingMessage $matchingMessage) $messagingDetails = $this->event->get('messaging')[0]; // field string available at Facebook - $fields = 'name,first_name,last_name,profile_pic'; + $fields = 'name,first_name,last_name'; // WORKPLACE (Facebook for companies) // if community isset in sender Object, it is a request done by workplace diff --git a/tests/FacebookDriverTest.php b/tests/FacebookDriverTest.php index 7ae0f8a..403e742 100644 --- a/tests/FacebookDriverTest.php +++ b/tests/FacebookDriverTest.php @@ -200,10 +200,10 @@ public function it_returns_the_user_object() { $request = '{"object":"page","entry":[{"id":"111899832631525","time":1480279487271,"messaging":[{"sender":{"id":"1433960459967306"},"recipient":{"id":"111899832631525"},"timestamp":1480279487147,"message":{"mid":"mid.1480279487147:4388d3b344","seq":36,"text":"Hi Julia"}}]}]}'; - $facebookResponse = '{"first_name":"John","last_name":"Doe","profile_pic":"https://facebook.com/profilepic","locale":"en_US","timezone":2,"gender":"male","is_payment_enabled":true}'; + $facebookResponse = '{"first_name":"John","last_name":"Doe","locale":"en_US","timezone":2,"gender":"male","is_payment_enabled":true}'; $htmlInterface = m::mock(Curl::class); - $htmlInterface->shouldReceive('get')->once()->with('https://graph.facebook.com/v3.0/1433960459967306?fields=name,first_name,last_name,profile_pic&access_token=Foo')->andReturn(new Response($facebookResponse)); + $htmlInterface->shouldReceive('get')->once()->with('https://graph.facebook.com/v3.0/1433960459967306?fields=name,first_name,last_name&access_token=Foo')->andReturn(new Response($facebookResponse)); $driver = $this->getDriver($request, null, '', $htmlInterface); $message = $driver->getMessages()[0]; @@ -213,7 +213,6 @@ public function it_returns_the_user_object() $this->assertEquals('John', $user->getFirstName()); $this->assertEquals('Doe', $user->getLastName()); $this->assertNull($user->getUsername()); - $this->assertEquals('https://facebook.com/profilepic', $user->getProfilePic()); $this->assertEquals('en_US', $user->getLocale()); $this->assertEquals('2', $user->getTimezone()); $this->assertEquals('male', $user->getGender()); @@ -243,7 +242,7 @@ public function it_throws_exception_in_get_user() $request = '{"object":"page","entry":[{"id":"111899832631525","time":1480279487271,"messaging":[{"sender":{"id":"1433960459967306"},"recipient":{"id":"111899832631525"},"timestamp":1480279487147,"message":{"mid":"mid.1480279487147:4388d3b344","seq":36,"text":"Hi Julia"}}]}]}'; $htmlInterface = m::mock(Curl::class); - $htmlInterface->shouldReceive('get')->once()->with('https://graph.facebook.com/v3.0/1433960459967306?fields=name,first_name,last_name,profile_pic&access_token=Foo')->andReturn(new Response('{}')); + $htmlInterface->shouldReceive('get')->once()->with('https://graph.facebook.com/v3.0/1433960459967306?fields=name,first_name,last_name&access_token=Foo')->andReturn(new Response('{}')); $driver = $this->getDriver($request, null, '', $htmlInterface); $driver->getMessages()[0];