From 107991b0a71e74b80e112a8740defb1cc2d27e03 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Fri, 2 May 2014 17:25:04 +0100 Subject: [PATCH] Updated grant tests with new grant name --- tests/Grant/AuthCodeTest.php | 44 +++++++++++++-------------- tests/Grant/ClientCredentialsTest.php | 16 +++++----- tests/Grant/PasswordTest.php | 28 ++++++++--------- tests/Grant/RefreshTokenTest.php | 20 ++++++------ 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/tests/Grant/AuthCodeTest.php b/tests/Grant/AuthCodeTest.php index ff14fa0a..d54fe66a 100644 --- a/tests/Grant/AuthCodeTest.php +++ b/tests/Grant/AuthCodeTest.php @@ -2,8 +2,8 @@ namespace LeagueTests\Grant; -use League\OAuth2\Server\Grant\AuthCode; -use League\OAuth2\Server\Grant\RefreshToken; +use League\OAuth2\Server\Grant\AuthCodeGrant; +use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\Entity\SessionEntity; @@ -16,7 +16,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase { public function testSetAuthTokenTTL() { - $grant = new AuthCode; + $grant = new AuthCodeGrant; $grant->setAuthTokenTTL(100); $class = new \ReflectionClass($grant); @@ -32,7 +32,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase $_POST = []; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $grant->checkAuthoriseParams(); @@ -48,7 +48,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase 'client_id' => 'testapp' ]; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $grant->checkAuthoriseParams(); @@ -64,7 +64,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->requireStateParam(true); $server->addGrantType($grant); @@ -81,7 +81,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $grant->checkAuthoriseParams(); @@ -98,7 +98,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $grant->checkAuthoriseParams(); @@ -115,7 +115,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -140,7 +140,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -181,7 +181,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -234,7 +234,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase $client = (new ClientEntity($server))->setId('testapp'); $scope = (new ScopeEntity($server))->setId('foo'); - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface'); @@ -266,7 +266,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase $_POST['grant_type'] = 'authorization_code'; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -283,7 +283,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -300,7 +300,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -318,7 +318,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -342,7 +342,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -391,7 +391,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -440,7 +440,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -489,7 +489,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; + $grant = new AuthCodeGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -553,8 +553,8 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new AuthCode; - $rtgrant = new RefreshToken; + $grant = new AuthCodeGrant; + $rtgrant = new RefreshTokenGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); diff --git a/tests/Grant/ClientCredentialsTest.php b/tests/Grant/ClientCredentialsTest.php index e3c66bc9..1cbbb38c 100644 --- a/tests/Grant/ClientCredentialsTest.php +++ b/tests/Grant/ClientCredentialsTest.php @@ -2,14 +2,14 @@ namespace LeagueTests\Grant; -use League\OAuth2\Server\Grant\ClientCredentials; +use League\OAuth2\Server\Grant\ClientCredentialsGrant; use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\Grant\ClientException; use Mockery as M; -class ClientCredentialsTest extends \PHPUnit_Framework_TestCase +class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase { function testCompleteFlowMissingClientId() { @@ -18,7 +18,7 @@ class ClientCredentialsTest extends \PHPUnit_Framework_TestCase $_POST['grant_type'] = 'client_credentials'; $server = new AuthorizationServer; - $grant = new ClientCredentials; + $grant = new ClientCredentialsGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -35,7 +35,7 @@ class ClientCredentialsTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new ClientCredentials; + $grant = new ClientCredentialsGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -52,7 +52,7 @@ class ClientCredentialsTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new ClientCredentials; + $grant = new ClientCredentialsGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -76,7 +76,7 @@ class ClientCredentialsTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new ClientCredentials; + $grant = new ClientCredentialsGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -116,7 +116,7 @@ class ClientCredentialsTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new ClientCredentials; + $grant = new ClientCredentialsGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -161,7 +161,7 @@ class ClientCredentialsTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new ClientCredentials; + $grant = new ClientCredentialsGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); diff --git a/tests/Grant/PasswordTest.php b/tests/Grant/PasswordTest.php index 3732c51c..f7a88bb4 100644 --- a/tests/Grant/PasswordTest.php +++ b/tests/Grant/PasswordTest.php @@ -2,8 +2,8 @@ namespace LeagueTests\Grant; -use League\OAuth2\Server\Grant\Password; -use League\OAuth2\Server\Grant\RefreshToken; +use League\OAuth2\Server\Grant\PasswordGrant; +use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\AccessTokenEntity; use League\OAuth2\Server\Entity\RefreshTokenEntity; @@ -20,7 +20,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase $_POST['grant_type'] = 'password'; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -37,7 +37,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -54,7 +54,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -77,7 +77,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -120,7 +120,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -164,7 +164,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -209,7 +209,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -256,7 +256,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -306,7 +306,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -360,7 +360,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -419,7 +419,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new Password; + $grant = new PasswordGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -465,7 +465,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase }); $server->addGrantType($grant); - $server->addGrantType(new RefreshToken); + $server->addGrantType(new RefreshTokenGrant); $response = $server->issueAccessToken(); $this->assertTrue(isset($response['access_token'])); diff --git a/tests/Grant/RefreshTokenTest.php b/tests/Grant/RefreshTokenTest.php index 26701261..78977d30 100644 --- a/tests/Grant/RefreshTokenTest.php +++ b/tests/Grant/RefreshTokenTest.php @@ -2,7 +2,7 @@ namespace LeagueTests\Grant; -use League\OAuth2\Server\Grant\RefreshToken; +use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\Entity\AccessTokenEntity; @@ -15,7 +15,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase { function testSetRefreshTokenTTL() { - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $grant->setRefreshTokenTTL(86400); $property = new \ReflectionProperty($grant, 'refreshTokenTTL'); @@ -31,7 +31,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase $_POST['grant_type'] = 'refresh_token'; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -47,7 +47,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $server->addGrantType($grant); $server->issueAccessToken(); @@ -64,7 +64,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -87,7 +87,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -122,7 +122,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -156,7 +156,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $clientStorage = M::mock('League\OAuth2\Server\Storage\ClientInterface'); $clientStorage->shouldReceive('setServer'); @@ -226,7 +226,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $oldSession = (new SessionEntity($server))->associateScope((new ScopeEntity($server))->setId('foo')); @@ -298,7 +298,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase ]; $server = new AuthorizationServer; - $grant = new RefreshToken; + $grant = new RefreshTokenGrant; $oldSession = (new SessionEntity($server))->associateScope((new ScopeEntity($server))->setId('foo'));