From db7c42cc913b87dd417a2f2edfc6b947dee1318b Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 7 Nov 2014 00:55:38 +0000 Subject: [PATCH] Fixed broken tests --- tests/unit/Grant/AuthCodeGrantTest.php | 6 ++++++ tests/unit/Grant/ClientCredentialsGrantTest.php | 10 ++++++++++ tests/unit/Grant/PasswordGrantTest.php | 7 +++++++ 3 files changed, 23 insertions(+) diff --git a/tests/unit/Grant/AuthCodeGrantTest.php b/tests/unit/Grant/AuthCodeGrantTest.php index 4cb8f353..1f281240 100644 --- a/tests/unit/Grant/AuthCodeGrantTest.php +++ b/tests/unit/Grant/AuthCodeGrantTest.php @@ -526,6 +526,9 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase $sessionStorage->shouldReceive('getByAuthCode')->andReturn( (new SessionEntity($server))->setId('foobar') ); + $sessionStorage->shouldReceive('getByAccessToken')->andReturn( + (new SessionEntity($server))->setId('foobar') + ); $sessionStorage->shouldReceive('getScopes')->andReturn([ (new ScopeEntity($server))->hydrate(['id' => 'foo']) ]); @@ -594,6 +597,9 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase $sessionStorage->shouldReceive('getByAuthCode')->andReturn( (new SessionEntity($server))->setId('foobar') ); + $sessionStorage->shouldReceive('getByAccessToken')->andReturn( + (new SessionEntity($server))->setId('foobar') + ); $sessionStorage->shouldReceive('getScopes')->andReturn([ (new ScopeEntity($server))->hydrate(['id' => 'foo']) ]); diff --git a/tests/unit/Grant/ClientCredentialsGrantTest.php b/tests/unit/Grant/ClientCredentialsGrantTest.php index 1741cd83..733c225b 100644 --- a/tests/unit/Grant/ClientCredentialsGrantTest.php +++ b/tests/unit/Grant/ClientCredentialsGrantTest.php @@ -4,6 +4,7 @@ namespace LeagueTests\Grant; use League\OAuth2\Server\Grant\ClientCredentialsGrant; use League\OAuth2\Server\Entity\ScopeEntity; +use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\AuthorizationServer; use Mockery as M; @@ -127,6 +128,9 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase $sessionStorage->shouldReceive('setServer'); $sessionStorage->shouldReceive('create')->andreturn(123); $sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([]); + $sessionStorage->shouldReceive('getByAccessToken')->andReturn( + (new SessionEntity($server))->setId('foobar') + ); $sessionStorage->shouldReceive('associateScope'); $accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface'); @@ -174,6 +178,9 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase $sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([ (new ScopeEntity($server))->hydrate(['id' => 'foo']) ]); + $sessionStorage->shouldReceive('getByAccessToken')->andReturn( + (new SessionEntity($server))->setId('foobar') + ); $sessionStorage->shouldReceive('associateScope'); $accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface'); @@ -221,6 +228,9 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase $sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface'); $sessionStorage->shouldReceive('setServer'); + $sessionStorage->shouldReceive('getByAccessToken')->andReturn( + (new SessionEntity($server))->setId('foobar') + ); $accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface'); $accessTokenStorage->shouldReceive('setServer'); diff --git a/tests/unit/Grant/PasswordGrantTest.php b/tests/unit/Grant/PasswordGrantTest.php index c3648d10..959ee004 100644 --- a/tests/unit/Grant/PasswordGrantTest.php +++ b/tests/unit/Grant/PasswordGrantTest.php @@ -6,6 +6,7 @@ use League\OAuth2\Server\Grant\PasswordGrant; use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\ClientEntity; +use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\AuthorizationServer; use Mockery as M; @@ -372,6 +373,9 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase $sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([ (new ScopeEntity($server))->hydrate(['id' => 'foo']) ]); + $sessionStorage->shouldReceive('getByAccessToken')->andReturn( + (new SessionEntity($server))->setId('foobar') + ); $sessionStorage->shouldReceive('associateScope'); $accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface'); @@ -430,6 +434,9 @@ class PasswordGrantTest extends \PHPUnit_Framework_TestCase $sessionStorage->shouldReceive('getScopes')->shouldReceive('getScopes')->andReturn([ (new ScopeEntity($server))->hydrate(['id' => 'foo']) ]); + $sessionStorage->shouldReceive('getByAccessToken')->andReturn( + (new SessionEntity($server))->setId('foobar') + ); $sessionStorage->shouldReceive('associateScope'); $accessTokenStorage = M::mock('League\OAuth2\Server\Storage\AccessTokenInterface');