Updated tests

This commit is contained in:
Alex Bilbie
2014-07-11 18:19:10 +01:00
parent 48dea185d8
commit c6bc1b0cfc
13 changed files with 115 additions and 101 deletions

View File

@@ -135,23 +135,23 @@ class ResourceServerTest extends \PHPUnit_Framework_TestCase
$scopeStorage
);
$server->setTokenKey('at');
$server->setIdKey('at');
$accessTokenStorage->shouldReceive('get')->andReturn(
(new AccessTokenEntity($server))->setToken('abcdef')
(new AccessTokenEntity($server))->setId('abcdef')
);
$accessTokenStorage->shouldReceive('getScopes')->andReturn([
(new ScopeEntity($server))->setId('foo'),
(new ScopeEntity($server))->setId('bar')
]);
// $accessTokenStorage->shouldReceive('getScopes')->andReturn([
// (new ScopeEntity($server))->hydrate(['id' => 'foo']),
// (new ScopeEntity($server))->hydrate(['id' => 'bar'])
// ]);
$sessionStorage->shouldReceive('getByAccessToken')->andReturn(
(new SessionEntity($server))->setId('foobar')->setOwner('user', 123)
);
$clientStorage->shouldReceive('getBySession')->andReturn(
(new ClientEntity($server))->setId('testapp')
(new ClientEntity($server))->hydrate(['id' => 'testapp'])
);
$request = new \Symfony\Component\HttpFoundation\Request();
@@ -161,7 +161,7 @@ class ResourceServerTest extends \PHPUnit_Framework_TestCase
$server->setRequest($request);
$this->assertTrue($server->isValidRequest());
$this->assertEquals('at', $server->getTokenKey());
$this->assertEquals('at', $server->getIdKey());
$this->assertEquals(123, $server->getOwnerId());
$this->assertEquals('user', $server->getOwnerType());
$this->assertEquals('abcdef', $server->getAccessToken());