mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Updated tests
This commit is contained in:
@@ -36,8 +36,8 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$method->setAccessible(true);
|
||||
|
||||
$scopes = [
|
||||
(new ScopeEntity($server))->setId('scope1')->setDescription('foo'),
|
||||
(new ScopeEntity($server))->setId('scope2')->setDescription('bar')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'scope1', 'description' => 'foo']),
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'scope2', 'description' => 'bar'])
|
||||
];
|
||||
|
||||
$result = $method->invokeArgs($grant, [$scopes]);
|
||||
@@ -55,7 +55,7 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setScopeStorage($scopeStorage);
|
||||
@@ -65,9 +65,8 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
[
|
||||
'foo' => (new ScopeEntity($server))->setId('foo')
|
||||
'foo' => (new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
],
|
||||
|
||||
$grant->validateScopes('foo')
|
||||
);
|
||||
}
|
||||
@@ -113,7 +112,7 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
$server->setScopeStorage($scopeStorage);
|
||||
|
||||
@@ -134,7 +133,7 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
$server->setScopeStorage($scopeStorage);
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -185,14 +185,14 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
$sessionStorage->shouldReceive('setServer');
|
||||
$sessionStorage->shouldReceive('create')->andreturn(123);
|
||||
$sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$sessionStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -200,14 +200,14 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('setServer');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -229,9 +229,8 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
public function testNewAuthoriseRequest()
|
||||
{
|
||||
$server = new AuthorizationServer;
|
||||
|
||||
$client = (new ClientEntity($server))->setId('testapp');
|
||||
$scope = (new ScopeEntity($server))->setId('foo');
|
||||
$client = (new ClientEntity($server))->hydrate(['id' => 'testapp']);
|
||||
$scope = (new ScopeEntity($server))->hydrate(['id' => 'foo']);
|
||||
|
||||
$grant = new AuthCodeGrant;
|
||||
$server->addGrantType($grant);
|
||||
@@ -346,7 +345,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -395,7 +394,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -444,7 +443,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -464,7 +463,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$authCodeStorage = M::mock('League\OAuth2\Server\Storage\AuthCodeInterface');
|
||||
$authCodeStorage->shouldReceive('setServer');
|
||||
$authCodeStorage->shouldReceive('get')->andReturn(
|
||||
(new AuthCodeEntity($server))->setToken('foobar')->setRedirectUri('http://fail/face')
|
||||
(new AuthCodeEntity($server))->setId('foobar')->setRedirectUri('http://fail/face')
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -493,10 +492,10 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('getBySession')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -506,29 +505,32 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$sessionStorage->shouldReceive('getByAuthCode')->andReturn(
|
||||
(new SessionEntity($server))->setId('foobar')
|
||||
);
|
||||
$sessionStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
|
||||
$accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface');
|
||||
$accessTokenStorage->shouldReceive('setServer');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$authCodeStorage = M::mock('League\OAuth2\Server\Storage\AuthCodeInterface');
|
||||
$authCodeStorage->shouldReceive('setServer');
|
||||
$authCodeStorage->shouldReceive('delete');
|
||||
$authCodeStorage->shouldReceive('get')->andReturn(
|
||||
(new AuthCodeEntity($server))->setToken('foobar')->setRedirectUri('http://foo/bar')
|
||||
(new AuthCodeEntity($server))->setId('foobar')->setRedirectUri('http://foo/bar')
|
||||
);
|
||||
$authCodeStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -558,10 +560,10 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('getBySession')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -571,29 +573,32 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$sessionStorage->shouldReceive('getByAuthCode')->andReturn(
|
||||
(new SessionEntity($server))->setId('foobar')
|
||||
);
|
||||
$sessionStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
|
||||
$accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface');
|
||||
$accessTokenStorage->shouldReceive('setServer');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$authCodeStorage = M::mock('League\OAuth2\Server\Storage\AuthCodeInterface');
|
||||
$authCodeStorage->shouldReceive('setServer');
|
||||
$authCodeStorage->shouldReceive('delete');
|
||||
$authCodeStorage->shouldReceive('get')->andReturn(
|
||||
(new AuthCodeEntity($server))->setToken('foobar')->setRedirectUri('http://foo/bar')
|
||||
(new AuthCodeEntity($server))->setId('foobar')->setRedirectUri('http://foo/bar')
|
||||
);
|
||||
$authCodeStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
|
||||
$refreshTokenStorage = M::mock('League\OAuth2\Server\Storage\RefreshTokenInterface');
|
||||
|
||||
@@ -80,7 +80,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -120,7 +120,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -138,7 +138,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
// $scopeStorage->shouldReceive('get')->andReturn(
|
||||
// // (new ScopeEntity($server))->setId('foo')
|
||||
// // (new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
// );
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -165,14 +165,14 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
$sessionStorage->shouldReceive('setServer');
|
||||
$sessionStorage->shouldReceive('create')->andreturn(123);
|
||||
$sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$sessionStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -180,14 +180,14 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('setServer');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -228,7 +228,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
|
||||
@@ -80,7 +80,7 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -123,7 +123,7 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -167,7 +167,7 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -212,7 +212,7 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -259,7 +259,7 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -309,14 +309,14 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
$sessionStorage->shouldReceive('setServer');
|
||||
$sessionStorage->shouldReceive('create')->andreturn(123);
|
||||
$sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$sessionStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -324,14 +324,14 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('setServer');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -363,14 +363,14 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
$sessionStorage->shouldReceive('setServer');
|
||||
$sessionStorage->shouldReceive('create')->andreturn(123);
|
||||
$sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$sessionStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -378,14 +378,14 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('setServer');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -422,14 +422,14 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
$sessionStorage->shouldReceive('setServer');
|
||||
$sessionStorage->shouldReceive('create')->andreturn(123);
|
||||
$sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$sessionStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -437,14 +437,14 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('setServer');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$refreshTokenStorage = M::mock('League\OAuth2\Server\Storage\RefreshTokenInterface');
|
||||
|
||||
@@ -92,7 +92,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -127,7 +127,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$refreshTokenStorage = M::mock('League\OAuth2\Server\Storage\RefreshTokenInterface');
|
||||
@@ -161,7 +161,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -180,7 +180,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('delete');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -196,7 +196,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -228,12 +228,12 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$server = new AuthorizationServer;
|
||||
$grant = new RefreshTokenGrant;
|
||||
|
||||
$oldSession = (new SessionEntity($server))->associateScope((new ScopeEntity($server))->setId('foo'));
|
||||
$oldSession = (new SessionEntity($server))->associateScope((new ScopeEntity($server))->hydrate(['id' => 'foo']));
|
||||
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -252,7 +252,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('delete');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -268,7 +268,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
@@ -300,12 +300,12 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$server = new AuthorizationServer;
|
||||
$grant = new RefreshTokenGrant;
|
||||
|
||||
$oldSession = (new SessionEntity($server))->associateScope((new ScopeEntity($server))->setId('foo'));
|
||||
$oldSession = (new SessionEntity($server))->associateScope((new ScopeEntity($server))->hydrate(['id' => 'foo']));
|
||||
|
||||
$clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface');
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(
|
||||
(new ClientEntity($server))->setId('testapp')
|
||||
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
|
||||
);
|
||||
|
||||
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
|
||||
@@ -324,7 +324,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$accessTokenStorage->shouldReceive('delete');
|
||||
$accessTokenStorage->shouldReceive('create');
|
||||
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
|
||||
(new ScopeEntity($server))->setId('foo')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'foo'])
|
||||
]);
|
||||
$accessTokenStorage->shouldReceive('associateScope');
|
||||
|
||||
@@ -340,7 +340,7 @@ class RefreshTokenGreantTest extends \PHPUnit_Framework_TestCase
|
||||
$scopeStorage = M::mock('League\OAuth2\Server\Storage\ScopeInterface');
|
||||
$scopeStorage->shouldReceive('setServer');
|
||||
$scopeStorage->shouldReceive('get')->andReturn(
|
||||
(new ScopeEntity($server))->setId('blah')
|
||||
(new ScopeEntity($server))->hydrate(['id' => 'blah'])
|
||||
);
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
|
||||
Reference in New Issue
Block a user