mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
AuthCode grant
This commit is contained in:
@@ -5,14 +5,29 @@ namespace LeagueTests\Entities;
|
||||
use League\OAuth2\Server\Entity\Scope;
|
||||
use League\OAuth2\Server\Entity\Session;
|
||||
use League\OAuth2\Server\Entity\AuthCode;
|
||||
use League\OAuth2\Server\AuthorizationServer as Authorization;
|
||||
use League\OAuth2\Server\AuthorizationServer;
|
||||
use \Mockery as M;
|
||||
|
||||
class AuthCodeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
function testSetGet()
|
||||
{
|
||||
$server = new AuthorizationServer;
|
||||
$session = M::mock('League\OAuth2\Server\Entity\Session');
|
||||
|
||||
$code = new AuthCode($server);
|
||||
$code->setRedirectUri('http://foo/bar');
|
||||
$code->setToken('foobar');
|
||||
$code->setSession($session);
|
||||
|
||||
$this->assertEquals('http://foo/bar', $code->getRedirectUri());
|
||||
$this->assertEquals('http://foo/bar?code=foobar', $code->generateRedirectUri());
|
||||
$this->assertTrue($code->getSession() instanceof \League\OAuth2\Server\Entity\Session);
|
||||
}
|
||||
|
||||
function testSave()
|
||||
{
|
||||
$server = new Authorization();
|
||||
$server = new AuthorizationServer();
|
||||
|
||||
$authCodeStorage = M::mock('League\OAuth2\Server\Storage\AuthCodeInterface');
|
||||
$authCodeStorage->shouldReceive('create');
|
||||
@@ -37,7 +52,7 @@ class AuthCodeTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
function testExpire()
|
||||
{
|
||||
$server = new Authorization();
|
||||
$server = new AuthorizationServer();
|
||||
|
||||
$authCodeStorage = M::mock('League\OAuth2\Server\Storage\AuthCodeInterface');
|
||||
$authCodeStorage->shouldReceive('delete');
|
||||
|
Reference in New Issue
Block a user