Cleaned up tests

This commit is contained in:
Alex Bilbie 2014-05-03 10:55:25 +01:00
parent ed7f5370ca
commit 5c8ed58c67
22 changed files with 75 additions and 88 deletions

View File

@ -3,11 +3,10 @@
namespace LeagueTests; namespace LeagueTests;
use LeagueTests\Stubs\StubAbstractServer; use LeagueTests\Stubs\StubAbstractServer;
use \Mockery as M;
class AbstractTokenTest extends \PHPUnit_Framework_TestCase class AbstractServerTest extends \PHPUnit_Framework_TestCase
{ {
function testSetGet() public function testSetGet()
{ {
$server = new StubAbstractServer(); $server = new StubAbstractServer();
$this->assertTrue($server->getRequest() instanceof \Symfony\Component\HttpFoundation\Request); $this->assertTrue($server->getRequest() instanceof \Symfony\Component\HttpFoundation\Request);
@ -17,7 +16,7 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($server2->getRequest() instanceof \Symfony\Component\HttpFoundation\Request); $this->assertTrue($server2->getRequest() instanceof \Symfony\Component\HttpFoundation\Request);
} }
function testGetStorageException() public function testGetStorageException()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\ServerErrorException'); $this->setExpectedException('League\OAuth2\Server\Exception\ServerErrorException');
$server = new StubAbstractServer(); $server = new StubAbstractServer();

View File

@ -7,7 +7,7 @@ use League\OAuth2\Server\Grant\GrantTypeInterface;
use League\OAuth2\Server\Storage\ScopeInterface; use League\OAuth2\Server\Storage\ScopeInterface;
use \Mockery as M; use \Mockery as M;
class AuthorizationTest extends \PHPUnit_Framework_TestCase class AuthorizationServerTest extends \PHPUnit_Framework_TestCase
{ {
public function testSetGet() public function testSetGet()
{ {

View File

@ -1,6 +1,5 @@
<?php <?php
if ( ! @include_once __DIR__ . '/../vendor/autoload.php') if (! @include_once __DIR__ . '/../vendor/autoload.php') {
{
exit("You must set up the project dependencies, run the following commands:\n> wget http://getcomposer.org/composer.phar\n> php composer.phar install\n"); exit("You must set up the project dependencies, run the following commands:\n> wget http://getcomposer.org/composer.phar\n> php composer.phar install\n");
} }

View File

@ -8,7 +8,7 @@ use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use \Mockery as M; use \Mockery as M;
class AbstractTokenTests extends \PHPUnit_Framework_TestCase class AbstractTokenTest extends \PHPUnit_Framework_TestCase
{ {
public function testSetGet() public function testSetGet()
{ {

View File

@ -5,12 +5,11 @@ namespace LeagueTests\Entity;
use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\AccessTokenEntity; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\AuthorizationServer;
use \Mockery as M; use \Mockery as M;
class AccessTokenTests extends \PHPUnit_Framework_TestCase class AccessTokenTest extends \PHPUnit_Framework_TestCase
{ {
function testSave() public function testSave()
{ {
$server = M::mock('League\OAuth2\Server\AbstractServer'); $server = M::mock('League\OAuth2\Server\AbstractServer');
$server->shouldReceive('setAccessTokenStorage'); $server->shouldReceive('setAccessTokenStorage');
@ -40,7 +39,7 @@ class AccessTokenTests extends \PHPUnit_Framework_TestCase
$this->assertTrue($entity->save() instanceof AccessTokenEntity); $this->assertTrue($entity->save() instanceof AccessTokenEntity);
} }
function testExpire() public function testExpire()
{ {
$server = M::mock('League\OAuth2\Server\AbstractServer'); $server = M::mock('League\OAuth2\Server\AbstractServer');

View File

@ -10,7 +10,7 @@ use \Mockery as M;
class AuthCodeTest extends \PHPUnit_Framework_TestCase class AuthCodeTest extends \PHPUnit_Framework_TestCase
{ {
function testSetGet() public function testSetGet()
{ {
$server = M::mock('League\OAuth2\Server\AbstractServer'); $server = M::mock('League\OAuth2\Server\AbstractServer');
@ -26,7 +26,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($code->getSession() instanceof \League\OAuth2\Server\Entity\SessionEntity); $this->assertTrue($code->getSession() instanceof \League\OAuth2\Server\Entity\SessionEntity);
} }
function testSave() public function testSave()
{ {
$server = M::mock('League\OAuth2\Server\AbstractServer'); $server = M::mock('League\OAuth2\Server\AbstractServer');
$server->shouldReceive('setAuthCodeStorage'); $server->shouldReceive('setAuthCodeStorage');
@ -57,7 +57,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($entity->save() instanceof AuthCodeEntity); $this->assertTrue($entity->save() instanceof AuthCodeEntity);
} }
function testExpire() public function testExpire()
{ {
$server = new AuthorizationServer(); $server = new AuthorizationServer();

View File

@ -6,12 +6,11 @@ use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\AccessTokenEntity; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\RefreshTokenEntity; use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\AuthorizationServer as Authorization;
use \Mockery as M; use \Mockery as M;
class RefreshTokenTests extends \PHPUnit_Framework_TestCase class RefreshTokenTest extends \PHPUnit_Framework_TestCase
{ {
function testSetAccessToken() public function testSetAccessToken()
{ {
$server = M::mock('League\OAuth2\Server\AbstractServer'); $server = M::mock('League\OAuth2\Server\AbstractServer');
$entity = new RefreshTokenEntity($server); $entity = new RefreshTokenEntity($server);
@ -24,7 +23,7 @@ class RefreshTokenTests extends \PHPUnit_Framework_TestCase
$this->assertTrue($accessTokenProperty->getValue($entity) instanceof AccessTokenEntity); $this->assertTrue($accessTokenProperty->getValue($entity) instanceof AccessTokenEntity);
} }
function testSave() public function testSave()
{ {
$server = M::mock('League\OAuth2\Server\AbstractServer'); $server = M::mock('League\OAuth2\Server\AbstractServer');
$server->shouldReceive('setAccessTokenStorage'); $server->shouldReceive('setAccessTokenStorage');
@ -63,7 +62,7 @@ class RefreshTokenTests extends \PHPUnit_Framework_TestCase
$this->assertSame(null, $entity->save()); $this->assertSame(null, $entity->save());
} }
function testExpire() public function testExpire()
{ {
$server = M::mock('League\OAuth2\Server\AbstractServer'); $server = M::mock('League\OAuth2\Server\AbstractServer');
$server->shouldReceive('setRefreshTokenStorage'); $server->shouldReceive('setRefreshTokenStorage');

View File

@ -5,7 +5,7 @@ namespace LeagueTests\Entity;
use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\ScopeEntity;
use \Mockery as M; use \Mockery as M;
class ScopeTests extends \PHPUnit_Framework_TestCase class ScopeTest extends \PHPUnit_Framework_TestCase
{ {
public function testSetGet() public function testSetGet()
{ {

View File

@ -3,7 +3,6 @@
namespace LeagueTests\Entity; namespace LeagueTests\Entity;
use League\OAuth2\Server\Entity\AccessTokenEntity; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\RefreshTokenEntity; use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\SessionEntity;
@ -11,7 +10,7 @@ use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use \Mockery as M; use \Mockery as M;
class SessionTests extends \PHPUnit_Framework_TestCase class SessionTest extends \PHPUnit_Framework_TestCase
{ {
public function testSetGet() public function testSetGet()
{ {
@ -114,7 +113,7 @@ class SessionTests extends \PHPUnit_Framework_TestCase
$this->assertFalse($entity->hasScope('foo')); $this->assertFalse($entity->hasScope('foo'));
} }
function testSave() public function testSave()
{ {
$server = M::mock('League\OAuth2\Server\AuthorizationServer'); $server = M::mock('League\OAuth2\Server\AuthorizationServer');
$server->shouldReceive('setSessionStorage'); $server->shouldReceive('setSessionStorage');

View File

@ -11,7 +11,7 @@ use Mockery as M;
class AbstractGrantTest extends \PHPUnit_Framework_TestCase class AbstractGrantTest extends \PHPUnit_Framework_TestCase
{ {
function testSetGet() public function testSetGet()
{ {
$server = new AuthorizationServer; $server = new AuthorizationServer;

View File

@ -121,7 +121,6 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase
$clientStorage->shouldReceive('setServer'); $clientStorage->shouldReceive('setServer');
$clientStorage->shouldReceive('get')->andReturn(null); $clientStorage->shouldReceive('get')->andReturn(null);
$server->setClientStorage($clientStorage); $server->setClientStorage($clientStorage);
$server->addGrantType($grant); $server->addGrantType($grant);

View File

@ -6,12 +6,11 @@ use League\OAuth2\Server\Grant\ClientCredentialsGrant;
use League\OAuth2\Server\Entity\ScopeEntity; use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Grant\ClientException;
use Mockery as M; 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'); $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'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -41,7 +40,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowInvalidClient() public function testCompleteFlowInvalidClient()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException');
@ -64,7 +63,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowInvalidScope() public function testCompleteFlowInvalidScope()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidScopeException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidScopeException');
@ -107,7 +106,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowNoScopes() public function testCompleteFlowNoScopes()
{ {
$_POST = [ $_POST = [
'grant_type' => 'client_credentials', 'grant_type' => 'client_credentials',
@ -151,7 +150,7 @@ class ClientCredentialsGrantTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlow() public function testCompleteFlow()
{ {
$_POST = [ $_POST = [
'grant_type' => 'client_credentials', 'grant_type' => 'client_credentials',

View File

@ -5,15 +5,13 @@ namespace LeagueTests\Grant;
use League\OAuth2\Server\Grant\PasswordGrant; use League\OAuth2\Server\Grant\PasswordGrant;
use League\OAuth2\Server\Grant\RefreshTokenGrant; use League\OAuth2\Server\Grant\RefreshTokenGrant;
use League\OAuth2\Server\Entity\ScopeEntity; 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\Entity\ClientEntity;
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use Mockery as M; use Mockery as M;
class PasswordTest extends \PHPUnit_Framework_TestCase class PasswordTest extends \PHPUnit_Framework_TestCase
{ {
function testCompleteFlowMissingClientId() public function testCompleteFlowMissingClientId()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException'); $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'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -43,7 +41,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowInvalidClient() public function testCompleteFlowInvalidClient()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException');
@ -66,7 +64,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testNoUsername() public function testNoUsername()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -108,7 +106,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testNoPassword() public function testNoPassword()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -151,7 +149,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testNoCallable() public function testNoCallable()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\ServerErrorException'); $this->setExpectedException('League\OAuth2\Server\Exception\ServerErrorException');
@ -195,7 +193,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowInvalidScope() public function testCompleteFlowInvalidScope()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidScopeException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidScopeException');
@ -243,7 +241,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowNoScopes() public function testCompleteFlowNoScopes()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -292,7 +290,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowInvalidCredentials() public function testCompleteFlowInvalidCredentials()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidCredentialsException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidCredentialsException');
@ -348,7 +346,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlow() public function testCompleteFlow()
{ {
$_POST = [ $_POST = [
'grant_type' => 'password', 'grant_type' => 'password',
@ -407,7 +405,7 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(isset($response['expires'])); $this->assertTrue(isset($response['expires']));
} }
function testCompleteFlowRefreshToken() public function testCompleteFlowRefreshToken()
{ {
$_POST = [ $_POST = [
'grant_type' => 'password', 'grant_type' => 'password',

View File

@ -13,7 +13,7 @@ use Mockery as M;
class RefreshTokenTest extends \PHPUnit_Framework_TestCase class RefreshTokenTest extends \PHPUnit_Framework_TestCase
{ {
function testSetRefreshTokenTTL() public function testSetRefreshTokenTTL()
{ {
$grant = new RefreshTokenGrant; $grant = new RefreshTokenGrant;
$grant->setRefreshTokenTTL(86400); $grant->setRefreshTokenTTL(86400);
@ -24,7 +24,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(86400, $property->getValue($grant)); $this->assertEquals(86400, $property->getValue($grant));
} }
function testCompleteFlowMissingClientId() public function testCompleteFlowMissingClientId()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -37,7 +37,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowMissingClientSecret() public function testCompleteFlowMissingClientSecret()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -53,7 +53,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowInvalidClient() public function testCompleteFlowInvalidClient()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidClientException');
@ -76,7 +76,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowMissingRefreshToken() public function testCompleteFlowMissingRefreshToken()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRequestException');
@ -110,7 +110,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowInvalidRefreshToken() public function testCompleteFlowInvalidRefreshToken()
{ {
$this->setExpectedException('League\OAuth2\Server\Exception\InvalidRefreshException'); $this->setExpectedException('League\OAuth2\Server\Exception\InvalidRefreshException');
@ -146,7 +146,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$server->issueAccessToken(); $server->issueAccessToken();
} }
function testCompleteFlowExistingScopes() public function testCompleteFlowExistingScopes()
{ {
$_POST = [ $_POST = [
'grant_type' => 'refresh_token', 'grant_type' => 'refresh_token',
@ -215,7 +215,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(isset($response['expires'])); $this->assertTrue(isset($response['expires']));
} }
function testCompleteFlowRequestScopes() public function testCompleteFlowRequestScopes()
{ {
$_POST = [ $_POST = [
'grant_type' => 'refresh_token', 'grant_type' => 'refresh_token',
@ -287,7 +287,7 @@ class RefreshTokenTest extends \PHPUnit_Framework_TestCase
$this->assertTrue(isset($response['expires'])); $this->assertTrue(isset($response['expires']));
} }
function testCompleteFlowRequestScopesInvalid() public function testCompleteFlowRequestScopesInvalid()
{ {
$_POST = [ $_POST = [
'grant_type' => 'refresh_token', 'grant_type' => 'refresh_token',

View File

@ -3,7 +3,6 @@
namespace LeagueTests; namespace LeagueTests;
use League\OAuth2\Server\ResourceServer; use League\OAuth2\Server\ResourceServer;
use League\OAuth2\Server\Grant\GrantTypeInterface;
use League\OAuth2\Server\Entity\AccessTokenEntity; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\ClientEntity; use League\OAuth2\Server\Entity\ClientEntity;
@ -33,7 +32,7 @@ class ResourceServerTest extends \PHPUnit_Framework_TestCase
return $server; return $server;
} }
function testGetSet() public function testGetSet()
{ {
$sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface'); $sessionStorage = M::mock('League\OAuth2\Server\Storage\SessionInterface');
$sessionStorage->shouldReceive('setServer'); $sessionStorage->shouldReceive('setServer');

View File

@ -4,11 +4,10 @@ namespace LeagueTests\Storage;
use League\OAuth2\Server\Storage\Adapter; use League\OAuth2\Server\Storage\Adapter;
use LeagueTests\Stubs\StubAbstractServer; use LeagueTests\Stubs\StubAbstractServer;
use \Mockery as M;
class AdapterTest extends \PHPUnit_Framework_TestCase class AdapterTest extends \PHPUnit_Framework_TestCase
{ {
function testSetGet() public function testSetGet()
{ {
$adapter = new Adapter; $adapter = new Adapter;

View File

@ -1,20 +1,19 @@
<?php <?php
namespace LeagueTests\Util; namespace LeagueTests\util;
use League\OAuth2\Server\Util\RedirectUri; use League\OAuth2\Server\Util\RedirectUri;
use \Mockery as M;
class RedirectUriTest extends \PHPUnit_Framework_TestCase class RedirectUriTest extends \PHPUnit_Framework_TestCase
{ {
function testMake() public function testMake()
{ {
$v1 = RedirectUri::make('https://foobar/', array('foo'=>'bar')); $v1 = RedirectUri::make('https://foobar/', array('foo'=>'bar'));
$v2 = RedirectUri::make('https://foobar/', array('foo'=>'bar'), '#'); $v2 = RedirectUri::make('https://foobar/', array('foo'=>'bar'), '#');
$v3 = RedirectUri::make('https://foobar/', array('foo'=>'bar', 'bar' => 'foo')); $v3 = RedirectUri::make('https://foobar/', array('foo'=>'bar', 'bar' => 'foo'));
$this->assertEquals('https://foobar/?foo=bar', $v1); $this->assertEquals('https://foobar/?foo=bar', $v1);
$this->assertEquals('https://foobar/#foo=bar', $v2); $this->assertEquals('https://foobar/#foo=bar', $v2);
$this->assertEquals('https://foobar/?foo=bar&bar=foo', $v3); $this->assertEquals('https://foobar/?foo=bar&bar=foo', $v3);
} }
} }

View File

@ -1,13 +1,12 @@
<?php <?php
namespace LeagueTests\Util; namespace LeagueTests\util;
use \League\OAuth2\Server\Util\SecureKey; use \League\OAuth2\Server\Util\SecureKey;
use \Mockery as M;
class SecureKeyTest extends \PHPUnit_Framework_TestCase class SecureKeyTest extends \PHPUnit_Framework_TestCase
{ {
function testGenerate() public function testGenerate()
{ {
$v1 = SecureKey::generate(); $v1 = SecureKey::generate();
$v2 = SecureKey::generate(); $v2 = SecureKey::generate();