diff --git a/tests/Auth/OAuth2/Grant/AuthorizationCodeTest.php b/tests/Auth/OAuth2/Grant/AuthorizationCodeTest.php index ff478530c..623eaf877 100644 --- a/tests/Auth/OAuth2/Grant/AuthorizationCodeTest.php +++ b/tests/Auth/OAuth2/Grant/AuthorizationCodeTest.php @@ -23,7 +23,7 @@ class AuthorizationCodeTest extends \PHPUnit\Framework\TestCase { private AuthorizationCode $grant; - public function setUp() : void + protected function setUp() : void { $this->grant = new AuthorizationCode(); } @@ -33,17 +33,17 @@ class AuthorizationCodeTest extends \PHPUnit\Framework\TestCase self::assertEquals('authorization_code', $this->grant->__toString()); self::assertEquals( [ - 'code' => 'value', + 'code' => 'value', 'option' => '2', - 'test' => 'value2', + 'test' => 'value2', ], $this->grant->prepareRequestParamters( [ - 'code' => 'value' + 'code' => 'value', ], [ 'option' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ) ); @@ -54,11 +54,11 @@ class AuthorizationCodeTest extends \PHPUnit\Framework\TestCase $this->expectException(\Exception::class); $this->grant->prepareRequestParamters( [ - 'test' => 'value' + 'test' => 'value', ], [ 'option' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ); } diff --git a/tests/Auth/OAuth2/Grant/ClientCredentialsTest.php b/tests/Auth/OAuth2/Grant/ClientCredentialsTest.php index bbbb71eac..577c003b9 100644 --- a/tests/Auth/OAuth2/Grant/ClientCredentialsTest.php +++ b/tests/Auth/OAuth2/Grant/ClientCredentialsTest.php @@ -23,7 +23,7 @@ class ClientCredentialsTest extends \PHPUnit\Framework\TestCase { private ClientCredentials $grant; - public function setUp() : void + protected function setUp() : void { $this->grant = new ClientCredentials(); } @@ -33,17 +33,17 @@ class ClientCredentialsTest extends \PHPUnit\Framework\TestCase self::assertEquals('client_credentials', $this->grant->__toString()); self::assertEquals( [ - 'code' => 'value', + 'code' => 'value', 'option' => '2', - 'test' => 'value2', + 'test' => 'value2', ], $this->grant->prepareRequestParamters( [ - 'code' => 'value' + 'code' => 'value', ], [ 'option' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ) ); diff --git a/tests/Auth/OAuth2/Grant/GrantAbstractTest.php b/tests/Auth/OAuth2/Grant/GrantAbstractTest.php index 4f5614b6c..101c8dac7 100644 --- a/tests/Auth/OAuth2/Grant/GrantAbstractTest.php +++ b/tests/Auth/OAuth2/Grant/GrantAbstractTest.php @@ -23,9 +23,9 @@ class GrantAbstractTest extends \PHPUnit\Framework\TestCase { private GrantAbstract $grant; - public function setUp() : void + protected function setUp() : void { - $this->grant = new class extends GrantAbstract { + $this->grant = new class() extends GrantAbstract { protected function getName() : string { return 'TestGrant'; @@ -43,16 +43,16 @@ class GrantAbstractTest extends \PHPUnit\Framework\TestCase self::assertEquals('TestGrant', $this->grant->__toString()); self::assertEquals( [ - 'test' => 'value2', - 'option' => '2' + 'test' => 'value2', + 'option' => '2', ], $this->grant->prepareRequestParamters( [ - 'test' => 'value' + 'test' => 'value', ], [ 'option' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ) ); @@ -63,7 +63,7 @@ class GrantAbstractTest extends \PHPUnit\Framework\TestCase $this->expectException(\Exception::class); $this->grant->prepareRequestParamters( [ - 'something' => 'value' + 'something' => 'value', ], [ 'option' => '2', diff --git a/tests/Auth/OAuth2/Grant/GrantFactoryTest.php b/tests/Auth/OAuth2/Grant/GrantFactoryTest.php index 405f6e3ff..86c997bec 100644 --- a/tests/Auth/OAuth2/Grant/GrantFactoryTest.php +++ b/tests/Auth/OAuth2/Grant/GrantFactoryTest.php @@ -15,8 +15,8 @@ declare(strict_types=1); namespace phpOMS\tests\Auth\OAuth2\Grant; use phpOMS\Auth\OAuth2\Grant\AuthorizationCode; -use phpOMS\Auth\OAuth2\Grant\GrantFactory; use phpOMS\Auth\OAuth2\Grant\GrantAbstract; +use phpOMS\Auth\OAuth2\Grant\GrantFactory; /** * @internal @@ -25,7 +25,7 @@ class GrantFactoryTest extends \PHPUnit\Framework\TestCase { private GrantFactory $factory; - public function setUp() : void + protected function setUp() : void { $this->factory = new GrantFactory(); } @@ -38,7 +38,7 @@ class GrantFactoryTest extends \PHPUnit\Framework\TestCase public function testGrantInputOutput() : void { - $grant = new class extends GrantAbstract { + $grant = new class() extends GrantAbstract { protected function getName() : string { return 'TestGrant'; diff --git a/tests/Auth/OAuth2/Grant/PasswordTest.php b/tests/Auth/OAuth2/Grant/PasswordTest.php index ecbe9d36a..f863b517d 100644 --- a/tests/Auth/OAuth2/Grant/PasswordTest.php +++ b/tests/Auth/OAuth2/Grant/PasswordTest.php @@ -23,7 +23,7 @@ class PasswordTest extends \PHPUnit\Framework\TestCase { private Password $grant; - public function setUp() : void + protected function setUp() : void { $this->grant = new Password(); } @@ -35,15 +35,15 @@ class PasswordTest extends \PHPUnit\Framework\TestCase [ 'username' => 'value', 'password' => '2', - 'test' => 'value2', + 'test' => 'value2', ], $this->grant->prepareRequestParamters( [ - 'username' => 'value' + 'username' => 'value', ], [ 'password' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ) ); @@ -54,11 +54,11 @@ class PasswordTest extends \PHPUnit\Framework\TestCase $this->expectException(\Exception::class); $this->grant->prepareRequestParamters( [ - 'username' => 'value' + 'username' => 'value', ], [ 'option' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ); } diff --git a/tests/Auth/OAuth2/Grant/RefreshTokenTest.php b/tests/Auth/OAuth2/Grant/RefreshTokenTest.php index 4fc5989d9..ab216ef6c 100644 --- a/tests/Auth/OAuth2/Grant/RefreshTokenTest.php +++ b/tests/Auth/OAuth2/Grant/RefreshTokenTest.php @@ -23,7 +23,7 @@ class RefreshTokenTest extends \PHPUnit\Framework\TestCase { private RefreshToken $grant; - public function setUp() : void + protected function setUp() : void { $this->grant = new RefreshToken(); } @@ -34,16 +34,16 @@ class RefreshTokenTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ 'refresh_token' => 'value', - 'option' => '2', - 'test' => 'value2', + 'option' => '2', + 'test' => 'value2', ], $this->grant->prepareRequestParamters( [ - 'refresh_token' => 'value' + 'refresh_token' => 'value', ], [ 'option' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ) ); @@ -54,11 +54,11 @@ class RefreshTokenTest extends \PHPUnit\Framework\TestCase $this->expectException(\Exception::class); $this->grant->prepareRequestParamters( [ - 'test' => 'value' + 'test' => 'value', ], [ 'option' => '2', - 'test' => 'value2' + 'test' => 'value2', ] ); } diff --git a/tests/Auth/OAuth2/OptionProvider/HttpBasicAuthOptionProviderTest.php b/tests/Auth/OAuth2/OptionProvider/HttpBasicAuthOptionProviderTest.php index 66eb95918..a81c108be 100644 --- a/tests/Auth/OAuth2/OptionProvider/HttpBasicAuthOptionProviderTest.php +++ b/tests/Auth/OAuth2/OptionProvider/HttpBasicAuthOptionProviderTest.php @@ -25,7 +25,7 @@ class HttpBasicAuthOptionProviderTest extends \PHPUnit\Framework\TestCase { private HttpBasicAuthOptionProvider $provider; - public function setUp() : void + protected function setUp() : void { $this->provider = new HttpBasicAuthOptionProvider(); } @@ -35,16 +35,16 @@ class HttpBasicAuthOptionProviderTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ 'headers' => [ - 'content-type' => MimeType::M_POST, - 'Authorization' => 'Basic aWQ6c2VjcmV0' + 'content-type' => MimeType::M_POST, + 'Authorization' => 'Basic aWQ6c2VjcmV0', ], 'body' => 'para=test¶2=test2', ], $this->provider->getAccessTokenOptions(RequestMethod::POST, [ - 'para' => 'test', - 'para2' => 'test2', - 'client_id' => 'id', - 'client_secret' => 'secret' + 'para' => 'test', + 'para2' => 'test2', + 'client_id' => 'id', + 'client_secret' => 'secret', ] ) ); @@ -54,8 +54,8 @@ class HttpBasicAuthOptionProviderTest extends \PHPUnit\Framework\TestCase { self::assertEquals([], $this->provider->getAccessTokenOptions(RequestMethod::POST, [ - 'para' => 'test', - 'para2' => 'test2', + 'para' => 'test', + 'para2' => 'test2', 'client_id' => 'id', ] ) diff --git a/tests/Auth/OAuth2/OptionProvider/PostAuthOptionProviderTest.php b/tests/Auth/OAuth2/OptionProvider/PostAuthOptionProviderTest.php index 2584313ab..dd1f0688a 100644 --- a/tests/Auth/OAuth2/OptionProvider/PostAuthOptionProviderTest.php +++ b/tests/Auth/OAuth2/OptionProvider/PostAuthOptionProviderTest.php @@ -25,7 +25,7 @@ class PostAuthOptionProviderTest extends \PHPUnit\Framework\TestCase { private PostAuthOptionProvider $provider; - public function setUp() : void + protected function setUp() : void { $this->provider = new PostAuthOptionProvider(); } @@ -35,7 +35,7 @@ class PostAuthOptionProviderTest extends \PHPUnit\Framework\TestCase self::assertEquals( [ 'headers' => ['content-type' => MimeType::M_POST], - 'body' => 'para=test¶2=test2', + 'body' => 'para=test¶2=test2', ], $this->provider->getAccessTokenOptions(RequestMethod::POST, ['para' => 'test', 'para2' => 'test2']) ); diff --git a/tests/Auth/OAuth2/Token/AccessTokenTest.php b/tests/Auth/OAuth2/Token/AccessTokenTest.php index fa9d76176..b188508c5 100644 --- a/tests/Auth/OAuth2/Token/AccessTokenTest.php +++ b/tests/Auth/OAuth2/Token/AccessTokenTest.php @@ -27,9 +27,9 @@ class AccessTokenTest extends \PHPUnit\Framework\TestCase self::assertEquals('token', $token->getToken()); self::assertEquals('token', $token->__toString()); self::assertEquals(-1, $token->getExpires()); - self::assertEquals(null, $token->getRefreshToken()); - self::assertEquals(null, $token->getResourceOwnerId()); - self::assertEquals(false, $token->hasExpired()); + self::assertNull($token->getRefreshToken()); + self::assertNull($token->getResourceOwnerId()); + self::assertFalse($token->hasExpired()); self::assertEquals([], $token->getValues()); self::assertEquals(['access_token' => 'token'], $token->jsonSerialize()); } @@ -74,11 +74,11 @@ class AccessTokenTest extends \PHPUnit\Framework\TestCase public function testValuesInputOutput() : void { $token = new AccessToken([ - 'access_token' => 'token', + 'access_token' => 'token', 'resource_owner_id' => 'owner', - 'expires_in' => 10, - 'refresh_token' => 'refresh', - 'more' => 'values' + 'expires_in' => 10, + 'refresh_token' => 'refresh', + 'more' => 'values', ]); self::assertEquals( @@ -92,20 +92,20 @@ class AccessTokenTest extends \PHPUnit\Framework\TestCase $expires = \time() + 10; $token = new AccessToken([ - 'access_token' => 'token', + 'access_token' => 'token', 'resource_owner_id' => 'owner', - 'expires' => $expires, - 'refresh_token' => 'refresh', - 'more' => 'values' + 'expires' => $expires, + 'refresh_token' => 'refresh', + 'more' => 'values', ]); self::assertEquals( [ - 'access_token' => 'token', + 'access_token' => 'token', 'resource_owner_id' => 'owner', - 'expires' => $expires, - 'refresh_token' => 'refresh', - 'more' => 'values' + 'expires' => $expires, + 'refresh_token' => 'refresh', + 'more' => 'values', ], $token->jsonSerialize() );