Skip to content

Commit da6651a

Browse files
author
Южаков Георгий
committed
Fix tests
1 parent 7f4fd46 commit da6651a

2 files changed

Lines changed: 24 additions & 24 deletions

File tree

src/OAuth/OAuth2/Service/Linkedin.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,48 @@
22

33
namespace OAuth\OAuth2\Service;
44

5-
use OAuth\OAuth2\Token\StdOAuth2Token;
6-
use OAuth\Common\Http\Exception\TokenResponseException;
7-
use OAuth\Common\Http\Uri\Uri;
85
use OAuth\Common\Consumer\CredentialsInterface;
96
use OAuth\Common\Http\Client\ClientInterface;
10-
use OAuth\Common\Storage\TokenStorageInterface;
7+
use OAuth\Common\Http\Exception\TokenResponseException;
8+
use OAuth\Common\Http\Uri\Uri;
119
use OAuth\Common\Http\Uri\UriInterface;
10+
use OAuth\Common\Storage\TokenStorageInterface;
11+
use OAuth\OAuth2\Token\StdOAuth2Token;
1212

1313
/**
1414
* Linkedin service.
1515
*
1616
* @author Antoine Corcy <contact@sbin.dk>
17-
* @link http://developer.linkedin.com/documents/authentication
17+
*
18+
* @see http://developer.linkedin.com/documents/authentication
1819
*/
1920
class Linkedin extends AbstractService
2021
{
2122
/**
22-
* Defined scopes
23+
* Defined scopes.
2324
*
24-
* @link https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context
25+
* @see https://docs.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context
2526
*/
26-
const SCOPE_R_LITEPROFILE = 'r_liteprofile';
27-
const SCOPE_R_FULLPROFILE = 'r_fullprofile';
28-
const SCOPE_R_EMAILADDRESS = 'r_emailaddress';
29-
const SCOPE_R_NETWORK = 'r_network';
30-
const SCOPE_R_CONTACTINFO = 'r_contactinfo';
31-
const SCOPE_RW_NUS = 'rw_nus';
32-
const SCOPE_RW_COMPANY_ADMIN = 'rw_company_admin';
33-
const SCOPE_RW_GROUPS = 'rw_groups';
34-
const SCOPE_W_MESSAGES = 'w_messages';
35-
const SCOPE_W_MEMBER_SOCIAL = 'w_member_social';
27+
const SCOPE_R_LITEPROFILE = 'r_liteprofile';
28+
const SCOPE_R_FULLPROFILE = 'r_fullprofile';
29+
const SCOPE_R_EMAILADDRESS = 'r_emailaddress';
30+
const SCOPE_R_NETWORK = 'r_network';
31+
const SCOPE_R_CONTACTINFO = 'r_contactinfo';
32+
const SCOPE_RW_NUS = 'rw_nus';
33+
const SCOPE_RW_COMPANY_ADMIN = 'rw_company_admin';
34+
const SCOPE_RW_GROUPS = 'rw_groups';
35+
const SCOPE_W_MESSAGES = 'w_messages';
36+
const SCOPE_W_MEMBER_SOCIAL = 'w_member_social';
3637

3738
public function __construct(
3839
CredentialsInterface $credentials,
3940
ClientInterface $httpClient,
4041
TokenStorageInterface $storage,
41-
$scopes = array(),
42-
UriInterface $baseApiUri = null
42+
$scopes = [],
43+
?UriInterface $baseApiUri = null
4344
) {
4445
if (count($scopes) === 0) {
45-
$scopes = array(self::SCOPE_R_LITEPROFILE, self::SCOPE_R_EMAILADDRESS);
46+
$scopes = [self::SCOPE_R_LITEPROFILE, self::SCOPE_R_EMAILADDRESS];
4647
}
4748

4849
parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri, true);
@@ -98,8 +99,7 @@ protected function parseAccessTokenResponse($responseBody)
9899
unset($data['refresh_token']);
99100
}
100101

101-
unset($data['access_token']);
102-
unset($data['expires_in']);
102+
unset($data['access_token'], $data['expires_in']);
103103

104104
$token->setExtraParams($data);
105105

tests/Unit/OAuth2/Service/LinkedinTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testGetAuthorizationEndpoint(): void
6565
);
6666

6767
self::assertSame(
68-
'https://www.linkedin.com/uas/oauth2/authorization',
68+
'https://www.linkedin.com/oauth/v2/authorization',
6969
$service->getAuthorizationEndpoint()->getAbsoluteUri()
7070
);
7171
}
@@ -83,7 +83,7 @@ public function testGetAccessTokenEndpoint(): void
8383
);
8484

8585
self::assertSame(
86-
'https://www.linkedin.com/uas/oauth2/accessToken',
86+
'https://www.linkedin.com/oauth/v2/accessToken',
8787
$service->getAccessTokenEndpoint()->getAbsoluteUri()
8888
);
8989
}

0 commit comments

Comments
 (0)