mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-30 10:42:02 +05:30
Fix the refresh token grant test
This commit is contained in:
parent
24f29b6382
commit
f9143b5163
@ -49,6 +49,7 @@ class RefreshTokenGrantTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$scopeRepositoryMock = $this->getMockBuilder(ScopeRepositoryInterface::class)->getMock();
|
$scopeRepositoryMock = $this->getMockBuilder(ScopeRepositoryInterface::class)->getMock();
|
||||||
$scopeEntity = new ScopeEntity();
|
$scopeEntity = new ScopeEntity();
|
||||||
|
$scopeEntity->setIdentifier(self::DEFAULT_SCOPE);
|
||||||
$scopeRepositoryMock->method('getScopeEntityByIdentifier')->willReturn($scopeEntity);
|
$scopeRepositoryMock->method('getScopeEntityByIdentifier')->willReturn($scopeEntity);
|
||||||
|
|
||||||
$accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
|
$accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
|
||||||
@ -63,10 +64,6 @@ class RefreshTokenGrantTest extends \PHPUnit_Framework_TestCase
|
|||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('persistNewRefreshToken')->willReturnSelf();
|
->method('persistNewRefreshToken')->willReturnSelf();
|
||||||
|
|
||||||
$oldRefreshTokenCheckResult = ['scopes' => $scopeEntity->getIdentifier()];
|
|
||||||
|
|
||||||
$refreshTokenRepositoryMock->method('validateOldRefreshToken')->willReturn($oldRefreshTokenCheckResult);
|
|
||||||
|
|
||||||
$grant = new RefreshTokenGrant($refreshTokenRepositoryMock);
|
$grant = new RefreshTokenGrant($refreshTokenRepositoryMock);
|
||||||
$grant->setClientRepository($clientRepositoryMock);
|
$grant->setClientRepository($clientRepositoryMock);
|
||||||
$grant->setScopeRepository($scopeRepositoryMock);
|
$grant->setScopeRepository($scopeRepositoryMock);
|
||||||
@ -81,7 +78,7 @@ class RefreshTokenGrantTest extends \PHPUnit_Framework_TestCase
|
|||||||
'client_id' => 'foo',
|
'client_id' => 'foo',
|
||||||
'refresh_token_id' => 'zyxwvu',
|
'refresh_token_id' => 'zyxwvu',
|
||||||
'access_token_id' => 'abcdef',
|
'access_token_id' => 'abcdef',
|
||||||
'scopes' => ['foo'],
|
'scopes' => [self::DEFAULT_SCOPE],
|
||||||
'user_id' => 123,
|
'user_id' => 123,
|
||||||
'expire_time' => time() + 3600,
|
'expire_time' => time() + 3600,
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user