template renderer holds template related information

This commit is contained in:
Julián Gutiérrez
2016-03-16 12:32:21 +01:00
parent 25f93071ea
commit ee91072455
13 changed files with 133 additions and 171 deletions

View File

@@ -28,9 +28,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
$this->getMock(AuthCodeRepositoryInterface::class),
$this->getMock(RefreshTokenRepositoryInterface::class),
$this->getMock(UserRepositoryInterface::class),
new \DateInterval('PT10M'),
'foo/bar.php',
'foo/bar.php'
new \DateInterval('PT10M')
);
$this->assertEquals('authorization_code', $grant->getIdentifier());
@@ -77,9 +75,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
$this->getMock(AuthCodeRepositoryInterface::class),
$this->getMock(RefreshTokenRepositoryInterface::class),
$userRepositoryMock,
new \DateInterval('PT10M'),
'',
''
new \DateInterval('PT10M')
);
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
@@ -134,9 +130,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
$this->getMock(AuthCodeRepositoryInterface::class),
$this->getMock(RefreshTokenRepositoryInterface::class),
$userRepositoryMock,
new \DateInterval('PT10M'),
'',
''
new \DateInterval('PT10M')
);
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
@@ -196,9 +190,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
$this->getMock(AuthCodeRepositoryInterface::class),
$this->getMock(RefreshTokenRepositoryInterface::class),
$userRepositoryMock,
new \DateInterval('PT10M'),
'',
''
new \DateInterval('PT10M')
);
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
@@ -365,9 +357,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
$this->getMock(AuthCodeRepositoryInterface::class),
$this->getMock(RefreshTokenRepositoryInterface::class),
$userRepositoryMock,
new \DateInterval('PT10M'),
'',
''
new \DateInterval('PT10M')
);
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
@@ -417,9 +407,7 @@ class AuthCodeGrantTest extends \PHPUnit_Framework_TestCase
$this->getMock(AuthCodeRepositoryInterface::class),
$this->getMock(RefreshTokenRepositoryInterface::class),
$userRepositoryMock,
new \DateInterval('PT10M'),
'',
''
new \DateInterval('PT10M')
);
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');

View File

@@ -18,22 +18,14 @@ class ImplicitGrantTest extends \PHPUnit_Framework_TestCase
{
public function testGetIdentifier()
{
$grant = new ImplicitGrant(
$this->getMock(UserRepositoryInterface::class),
'foo/bar.php',
'foo/bar.php'
);
$grant = new ImplicitGrant($this->getMock(UserRepositoryInterface::class));
$this->assertEquals('implicit', $grant->getIdentifier());
}
public function testCanRespondToRequest()
{
$grant = new ImplicitGrant(
$this->getMock(UserRepositoryInterface::class),
'foo/bar.php',
'foo/bar.php'
);
$grant = new ImplicitGrant($this->getMock(UserRepositoryInterface::class));
$request = new ServerRequest(
[],
@@ -65,7 +57,7 @@ class ImplicitGrantTest extends \PHPUnit_Framework_TestCase
$accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
$accessTokenRepositoryMock->method('persistNewAccessToken')->willReturnSelf();
$grant = new ImplicitGrant($userRepositoryMock, 'foo', 'foo');
$grant = new ImplicitGrant($userRepositoryMock);
$grant->setClientRepository($clientRepositoryMock);
$grant->setAccessTokenRepository($accessTokenRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
@@ -106,11 +98,7 @@ class ImplicitGrantTest extends \PHPUnit_Framework_TestCase
*/
public function testRespondToAuthorizationRequestMissingClientId()
{
$grant = new ImplicitGrant(
$this->getMock(UserRepositoryInterface::class),
'foo/bar.php',
'foo/bar.php'
);
$grant = new ImplicitGrant($this->getMock(UserRepositoryInterface::class));
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
$grant->setPathToPrivateKey('file://' . __DIR__ . '/../Utils/private.key');
@@ -151,11 +139,7 @@ class ImplicitGrantTest extends \PHPUnit_Framework_TestCase
$clientRepositoryMock = $this->getMockBuilder(ClientRepositoryInterface::class)->getMock();
$clientRepositoryMock->method('getClientEntity')->willReturn($client);
$grant = new ImplicitGrant(
$this->getMock(UserRepositoryInterface::class),
'foo/bar.php',
'foo/bar.php'
);
$grant = new ImplicitGrant($this->getMock(UserRepositoryInterface::class));
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
$grant->setPathToPrivateKey('file://' . __DIR__ . '/../Utils/private.key');
@@ -205,11 +189,7 @@ class ImplicitGrantTest extends \PHPUnit_Framework_TestCase
$userEntity = new UserEntity();
$userRepositoryMock->method('getUserEntityByUserCredentials')->willReturn($userEntity);
$grant = new ImplicitGrant(
$this->getMock(UserRepositoryInterface::class),
'foo/bar.php',
'foo/bar.php'
);
$grant = new ImplicitGrant($this->getMock(UserRepositoryInterface::class));
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
$grant->setPathToPrivateKey('file://' . __DIR__ . '/../Utils/private.key');
@@ -265,11 +245,7 @@ class ImplicitGrantTest extends \PHPUnit_Framework_TestCase
$userEntity = new UserEntity();
$userRepositoryMock->method('getUserEntityByUserCredentials')->willReturn($userEntity);
$grant = new ImplicitGrant(
$this->getMock(UserRepositoryInterface::class),
'foo/bar.php',
'foo/bar.php'
);
$grant = new ImplicitGrant($this->getMock(UserRepositoryInterface::class));
$grant->setClientRepository($clientRepositoryMock);
$grant->setPathToPublicKey('file://' . __DIR__ . '/../Utils/public.key');
$grant->setPathToPrivateKey('file://' . __DIR__ . '/../Utils/private.key');