diff --git a/src/Provider/LinkedIn.php b/src/Provider/LinkedIn.php index cf6dbcb..5c4545c 100644 --- a/src/Provider/LinkedIn.php +++ b/src/Provider/LinkedIn.php @@ -28,6 +28,7 @@ class LinkedIn extends AbstractProvider protected $fields = [ 'id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-url', 'public-profile-url', + 'summary', ]; /** diff --git a/src/Provider/LinkedInResourceOwner.php b/src/Provider/LinkedInResourceOwner.php index b927489..010e2a2 100644 --- a/src/Provider/LinkedInResourceOwner.php +++ b/src/Provider/LinkedInResourceOwner.php @@ -118,6 +118,16 @@ public function getUrl() return $this->getAttribute('publicProfileUrl'); } + /** + * Get user summary + * + * @return string|null + */ + public function getSummary() + { + return $this->getAttribute('summary'); + } + /** * Return all of the owner details available as an array. * diff --git a/test/src/Provider/LinkedInTest.php b/test/src/Provider/LinkedInTest.php index 3cc086f..6e80f2a 100644 --- a/test/src/Provider/LinkedInTest.php +++ b/test/src/Provider/LinkedInTest.php @@ -125,6 +125,7 @@ public function testUserData() $location = uniqid(); $url = uniqid(); $description = uniqid(); + $summary = uniqid(); $somethingExtra = ['more' => uniqid()]; $postResponse = m::mock('Psr\Http\Message\ResponseInterface'); @@ -132,7 +133,7 @@ public function testUserData() $postResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'json']); $userResponse = m::mock('Psr\Http\Message\ResponseInterface'); - $userResponse->shouldReceive('getBody')->andReturn('{"id": '.$userId.', "firstName": "'.$firstName.'", "lastName": "'.$lastName.'", "emailAddress": "'.$email.'", "location": { "name": "'.$location.'" }, "headline": "'.$description.'", "pictureUrl": "'.$picture.'", "publicProfileUrl": "'.$url.'", "somethingExtra": '.json_encode($somethingExtra).'}'); + $userResponse->shouldReceive('getBody')->andReturn('{"id": '.$userId.', "firstName": "'.$firstName.'", "lastName": "'.$lastName.'", "emailAddress": "'.$email.'", "location": { "name": "'.$location.'" }, "headline": "'.$description.'", "summary": "'.$summary.'", "pictureUrl": "'.$picture.'", "publicProfileUrl": "'.$url.'", "somethingExtra": '.json_encode($somethingExtra).'}'); $userResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'json']); $client = m::mock('GuzzleHttp\ClientInterface'); @@ -160,6 +161,8 @@ public function testUserData() $this->assertEquals($url, $user->toArray()['publicProfileUrl']); $this->assertEquals($description, $user->getDescription()); $this->assertEquals($description, $user->toArray()['headline']); + $this->assertEquals($summary, $user->getSummary()); + $this->assertEquals($summary, $user->toArray()['summary']); $this->assertEquals($somethingExtra, $user->getAttribute('somethingExtra')); $this->assertEquals($somethingExtra, $user->toArray()['somethingExtra']); $this->assertEquals($somethingExtra['more'], $user->getAttribute('somethingExtra.more')); @@ -174,13 +177,14 @@ public function testMissingUserData() $location = uniqid(); $url = uniqid(); $description = uniqid(); + $summary = uniqid(); $postResponse = m::mock('Psr\Http\Message\ResponseInterface'); $postResponse->shouldReceive('getBody')->andReturn('{"access_token": "mock_access_token", "expires_in": 3600}'); $postResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'json']); $userResponse = m::mock('Psr\Http\Message\ResponseInterface'); - $userResponse->shouldReceive('getBody')->andReturn('{"id": '.$userId.', "firstName": "'.$firstName.'", "lastName": "'.$lastName.'", "emailAddress": "'.$email.'", "location": { "name": "'.$location.'" }, "headline": "'.$description.'", "publicProfileUrl": "'.$url.'"}'); + $userResponse->shouldReceive('getBody')->andReturn('{"id": '.$userId.', "firstName": "'.$firstName.'", "lastName": "'.$lastName.'", "emailAddress": "'.$email.'", "location": { "name": "'.$location.'" }, "headline": "'.$description.'", "summary": "'.$summary.'", "publicProfileUrl": "'.$url.'"}'); $userResponse->shouldReceive('getHeader')->andReturn(['content-type' => 'json']); $client = m::mock('GuzzleHttp\ClientInterface'); @@ -207,6 +211,8 @@ public function testMissingUserData() $this->assertEquals($url, $user->toArray()['publicProfileUrl']); $this->assertEquals($description, $user->getDescription()); $this->assertEquals($description, $user->toArray()['headline']); + $this->assertEquals($summary, $user->getSummary()); + $this->assertEquals($summary, $user->toArray()['summary']); } /**