mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Cleaned up tests
This commit is contained in:
@@ -11,7 +11,7 @@ use Mockery as M;
|
||||
|
||||
class AbstractGrantTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testSetGet()
|
||||
public function testSetGet()
|
||||
{
|
||||
$server = new AuthorizationServer;
|
||||
|
||||
|
||||
@@ -121,7 +121,6 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase
|
||||
$clientStorage->shouldReceive('setServer');
|
||||
$clientStorage->shouldReceive('get')->andReturn(null);
|
||||
|
||||
|
||||
$server->setClientStorage($clientStorage);
|
||||
|
||||
$server->addGrantType($grant);
|
||||
|
||||
@@ -6,12 +6,11 @@ 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 ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
class ClientCredentialsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testCompleteFlowMissingClientId()
|
||||
public function testCompleteFlowMissingClientId()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -25,7 +24,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
function testCompleteFlowMissingClientSecret()
|
||||
public function testCompleteFlowMissingClientSecret()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -41,7 +40,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowInvalidClient()
|
||||
public function testCompleteFlowInvalidClient()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException');
|
||||
|
||||
@@ -64,7 +63,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowInvalidScope()
|
||||
public function testCompleteFlowInvalidScope()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidScopeException');
|
||||
|
||||
@@ -107,7 +106,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowNoScopes()
|
||||
public function testCompleteFlowNoScopes()
|
||||
{
|
||||
$_POST = [
|
||||
'grant_type' => 'client_credentials',
|
||||
@@ -151,7 +150,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlow()
|
||||
public function testCompleteFlow()
|
||||
{
|
||||
$_POST = [
|
||||
'grant_type' => 'client_credentials',
|
||||
@@ -199,4 +198,4 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
|
||||
$server->addGrantType($grant);
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,13 @@ namespace LeagueTests\Grant;
|
||||
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;
|
||||
use League\OAuth2\Server\Entity\ClientEntity;
|
||||
use League\OAuth2\Server\AuthorizationServer;
|
||||
use Mockery as M;
|
||||
|
||||
class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testCompleteFlowMissingClientId()
|
||||
public function testCompleteFlowMissingClientId()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -27,7 +25,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
function testCompleteFlowMissingClientSecret()
|
||||
public function testCompleteFlowMissingClientSecret()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -43,7 +41,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowInvalidClient()
|
||||
public function testCompleteFlowInvalidClient()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException');
|
||||
|
||||
@@ -66,7 +64,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testNoUsername()
|
||||
public function testNoUsername()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -108,7 +106,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testNoPassword()
|
||||
public function testNoPassword()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -151,7 +149,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testNoCallable()
|
||||
public function testNoCallable()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\ServerErrorException');
|
||||
|
||||
@@ -195,7 +193,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowInvalidScope()
|
||||
public function testCompleteFlowInvalidScope()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidScopeException');
|
||||
|
||||
@@ -243,7 +241,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowNoScopes()
|
||||
public function testCompleteFlowNoScopes()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -292,7 +290,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowInvalidCredentials()
|
||||
public function testCompleteFlowInvalidCredentials()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidCredentialsException');
|
||||
|
||||
@@ -348,7 +346,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlow()
|
||||
public function testCompleteFlow()
|
||||
{
|
||||
$_POST = [
|
||||
'grant_type' => 'password',
|
||||
@@ -407,7 +405,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue(isset($response['expires']));
|
||||
}
|
||||
|
||||
function testCompleteFlowRefreshToken()
|
||||
public function testCompleteFlowRefreshToken()
|
||||
{
|
||||
$_POST = [
|
||||
'grant_type' => 'password',
|
||||
@@ -474,4 +472,4 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue(isset($response['expires_in']));
|
||||
$this->assertTrue(isset($response['expires']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ use Mockery as M;
|
||||
|
||||
class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testSetRefreshTokenTTL()
|
||||
public function testSetRefreshTokenTTL()
|
||||
{
|
||||
$grant = new RefreshTokenGrant;
|
||||
$grant->setRefreshTokenTTL(86400);
|
||||
@@ -24,7 +24,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(86400, $property->getValue($grant));
|
||||
}
|
||||
|
||||
function testCompleteFlowMissingClientId()
|
||||
public function testCompleteFlowMissingClientId()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -37,7 +37,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowMissingClientSecret()
|
||||
public function testCompleteFlowMissingClientSecret()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -53,7 +53,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowInvalidClient()
|
||||
public function testCompleteFlowInvalidClient()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException');
|
||||
|
||||
@@ -76,7 +76,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowMissingRefreshToken()
|
||||
public function testCompleteFlowMissingRefreshToken()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
|
||||
|
||||
@@ -110,7 +110,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowInvalidRefreshToken()
|
||||
public function testCompleteFlowInvalidRefreshToken()
|
||||
{
|
||||
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRefreshException');
|
||||
|
||||
@@ -146,7 +146,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
|
||||
function testCompleteFlowExistingScopes()
|
||||
public function testCompleteFlowExistingScopes()
|
||||
{
|
||||
$_POST = [
|
||||
'grant_type' => 'refresh_token',
|
||||
@@ -215,7 +215,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue(isset($response['expires']));
|
||||
}
|
||||
|
||||
function testCompleteFlowRequestScopes()
|
||||
public function testCompleteFlowRequestScopes()
|
||||
{
|
||||
$_POST = [
|
||||
'grant_type' => 'refresh_token',
|
||||
@@ -287,7 +287,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue(isset($response['expires']));
|
||||
}
|
||||
|
||||
function testCompleteFlowRequestScopesInvalid()
|
||||
public function testCompleteFlowRequestScopesInvalid()
|
||||
{
|
||||
$_POST = [
|
||||
'grant_type' => 'refresh_token',
|
||||
@@ -355,4 +355,4 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$server->issueAccessToken();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user