mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	Update PHPUnit, run static analysis on tests
This commit is contained in:
		@@ -198,16 +198,16 @@ class AuthorizationServerTest extends TestCase
 | 
			
		||||
        $clientRepositoryMock->method('getClientEntity')->willReturn($client);
 | 
			
		||||
 | 
			
		||||
        $grant = new AuthCodeGrant(
 | 
			
		||||
            $this->getMock(AuthCodeRepositoryInterface::class),
 | 
			
		||||
            $this->getMock(RefreshTokenRepositoryInterface::class),
 | 
			
		||||
            $this->getMockBuilder(AuthCodeRepositoryInterface::class)->getMock(),
 | 
			
		||||
            $this->getMockBuilder(RefreshTokenRepositoryInterface::class)->getMock(),
 | 
			
		||||
            new \DateInterval('PT10M')
 | 
			
		||||
        );
 | 
			
		||||
        $grant->setClientRepository($clientRepositoryMock);
 | 
			
		||||
 | 
			
		||||
        $server = new AuthorizationServer(
 | 
			
		||||
            $clientRepositoryMock,
 | 
			
		||||
            $this->getMock(AccessTokenRepositoryInterface::class),
 | 
			
		||||
            $this->getMock(ScopeRepositoryInterface::class),
 | 
			
		||||
            $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock(),
 | 
			
		||||
            $this->getMockBuilder(ScopeRepositoryInterface::class)->getMock(),
 | 
			
		||||
            'file://' . __DIR__ . '/Stubs/private.key',
 | 
			
		||||
            'file://' . __DIR__ . '/Stubs/public.key'
 | 
			
		||||
        );
 | 
			
		||||
 
 | 
			
		||||
@@ -20,9 +20,7 @@ class BearerResponseTypeTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testGenerateHttpResponse()
 | 
			
		||||
    {
 | 
			
		||||
        $accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
 | 
			
		||||
 | 
			
		||||
        $responseType = new BearerTokenResponse($accessTokenRepositoryMock);
 | 
			
		||||
        $responseType = new BearerTokenResponse();
 | 
			
		||||
        $responseType->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
 | 
			
		||||
        $responseType->setEncryptionKey(base64_encode(random_bytes(36)));
 | 
			
		||||
 | 
			
		||||
@@ -64,9 +62,7 @@ class BearerResponseTypeTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testGenerateHttpResponseWithExtraParams()
 | 
			
		||||
    {
 | 
			
		||||
        $accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
 | 
			
		||||
 | 
			
		||||
        $responseType = new BearerTokenResponseWithParams($accessTokenRepositoryMock);
 | 
			
		||||
        $responseType = new BearerTokenResponseWithParams();
 | 
			
		||||
        $responseType->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
 | 
			
		||||
        $responseType->setEncryptionKey(base64_encode(random_bytes(36)));
 | 
			
		||||
 | 
			
		||||
@@ -111,10 +107,7 @@ class BearerResponseTypeTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testDetermineAccessTokenInHeaderValidToken()
 | 
			
		||||
    {
 | 
			
		||||
        $accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
 | 
			
		||||
        $accessTokenRepositoryMock->method('isAccessTokenRevoked')->willReturn(false);
 | 
			
		||||
 | 
			
		||||
        $responseType = new BearerTokenResponse($accessTokenRepositoryMock);
 | 
			
		||||
        $responseType = new BearerTokenResponse();
 | 
			
		||||
        $responseType->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
 | 
			
		||||
        $responseType->setEncryptionKey(base64_encode(random_bytes(36)));
 | 
			
		||||
 | 
			
		||||
@@ -158,9 +151,8 @@ class BearerResponseTypeTest extends TestCase
 | 
			
		||||
    public function testDetermineAccessTokenInHeaderInvalidJWT()
 | 
			
		||||
    {
 | 
			
		||||
        $accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
 | 
			
		||||
        $accessTokenRepositoryMock->method('isAccessTokenRevoked')->willReturn(false);
 | 
			
		||||
 | 
			
		||||
        $responseType = new BearerTokenResponse($accessTokenRepositoryMock);
 | 
			
		||||
        $responseType = new BearerTokenResponse();
 | 
			
		||||
        $responseType->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
 | 
			
		||||
        $responseType->setEncryptionKey(base64_encode(random_bytes(36)));
 | 
			
		||||
 | 
			
		||||
@@ -247,9 +239,7 @@ class BearerResponseTypeTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testDetermineAccessTokenInHeaderInvalidToken()
 | 
			
		||||
    {
 | 
			
		||||
        $accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
 | 
			
		||||
 | 
			
		||||
        $responseType = new BearerTokenResponse($accessTokenRepositoryMock);
 | 
			
		||||
        $responseType = new BearerTokenResponse();
 | 
			
		||||
        $responseType->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
 | 
			
		||||
        $responseType->setEncryptionKey(base64_encode(random_bytes(36)));
 | 
			
		||||
 | 
			
		||||
@@ -273,9 +263,7 @@ class BearerResponseTypeTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testDetermineMissingBearerInHeader()
 | 
			
		||||
    {
 | 
			
		||||
        $accessTokenRepositoryMock = $this->getMockBuilder(AccessTokenRepositoryInterface::class)->getMock();
 | 
			
		||||
 | 
			
		||||
        $responseType = new BearerTokenResponse($accessTokenRepositoryMock);
 | 
			
		||||
        $responseType = new BearerTokenResponse();
 | 
			
		||||
        $responseType->setPrivateKey(new CryptKey('file://' . __DIR__ . '/../Stubs/private.key'));
 | 
			
		||||
        $responseType->setEncryptionKey(base64_encode(random_bytes(36)));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ class CryptKeyTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testKeyCreation()
 | 
			
		||||
    {
 | 
			
		||||
        $keyFile = __DIR__ . '/Stubs/public.key';
 | 
			
		||||
        $keyFile = __DIR__ . '/../Stubs/public.key';
 | 
			
		||||
        $key = new CryptKey($keyFile, 'secret');
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals('file://' . $keyFile, $key->getKeyPath());
 | 
			
		||||
@@ -26,7 +26,7 @@ class CryptKeyTest extends TestCase
 | 
			
		||||
 | 
			
		||||
    public function testKeyFileCreation()
 | 
			
		||||
    {
 | 
			
		||||
        $keyContent = file_get_contents(__DIR__ . '/Stubs/public.key');
 | 
			
		||||
        $keyContent = file_get_contents(__DIR__ . '/../Stubs/public.key');
 | 
			
		||||
        $key = new CryptKey($keyContent);
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(
 | 
			
		||||
@@ -34,7 +34,7 @@ class CryptKeyTest extends TestCase
 | 
			
		||||
            $key->getKeyPath()
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $keyContent = file_get_contents(__DIR__ . '/Stubs/private.key.crlf');
 | 
			
		||||
        $keyContent = file_get_contents(__DIR__ . '/../Stubs/private.key.crlf');
 | 
			
		||||
        $key = new CryptKey($keyContent);
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(
 | 
			
		||||
		Reference in New Issue
	
	Block a user