diff --git a/tests/Authentication/Authenticators/JWTAuthenticatorTest.php b/tests/Authentication/Authenticators/JWTAuthenticatorTest.php index 5c074df12..3bd24070f 100644 --- a/tests/Authentication/Authenticators/JWTAuthenticatorTest.php +++ b/tests/Authentication/Authenticators/JWTAuthenticatorTest.php @@ -105,7 +105,7 @@ public function testCheckNoToken(): void $this->assertFalse($result->isOK()); $this->assertSame( - \lang('Auth.noToken', [config(AuthJWT::class)->authenticatorHeader]), + \lang('Auth.noToken', [config('AuthJWT')->authenticatorHeader]), $result->reason() ); } diff --git a/tests/Authentication/Filters/JWTFilterTest.php b/tests/Authentication/Filters/JWTFilterTest.php index 082627888..e8f4d3b39 100644 --- a/tests/Authentication/Filters/JWTFilterTest.php +++ b/tests/Authentication/Filters/JWTFilterTest.php @@ -33,7 +33,8 @@ protected function setUp(): void $_SESSION = []; // Add JWT Authenticator - $config = config(Auth::class); + /** @var Auth $config */ + $config = config('Auth'); $config->authenticators['jwt'] = JWT::class; // Register our filter diff --git a/tests/Unit/Authentication/JWT/Adapters/FirebaseAdapaterTest.php b/tests/Unit/Authentication/JWT/Adapters/FirebaseAdapaterTest.php index 9618c151e..8385a3f00 100644 --- a/tests/Unit/Authentication/JWT/Adapters/FirebaseAdapaterTest.php +++ b/tests/Unit/Authentication/JWT/Adapters/FirebaseAdapaterTest.php @@ -82,7 +82,8 @@ public function testDecodeInvalidTokenExceptionUnexpectedValueException(): void $token = $this->generateJWT(); // Change algorithm and it makes the key invalid. - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['default'][0]['alg'] = 'ES256'; $adapter = new FirebaseAdapter(); @@ -110,7 +111,8 @@ public function testDecodeInvalidArgumentException(): void $token = $this->generateJWT(); // Set invalid key. - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['default'][0] = [ 'alg' => '', 'secret' => '', @@ -128,7 +130,8 @@ public function testEncodeLogicExceptionLogicException(): void $this->expectExceptionMessage('Cannot encode JWT: Algorithm not supported'); // Set unsupported algorithm. - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['default'][0]['alg'] = 'PS256'; $adapter = new FirebaseAdapter(); diff --git a/tests/Unit/Authentication/JWT/JWTManagerTest.php b/tests/Unit/Authentication/JWT/JWTManagerTest.php index 7f5adfc1a..045e70633 100644 --- a/tests/Unit/Authentication/JWT/JWTManagerTest.php +++ b/tests/Unit/Authentication/JWT/JWTManagerTest.php @@ -55,7 +55,8 @@ public function testGenerateTokenPayload(array $data): void $manager = $this->createJWTManager(); $payload = $manager->parse($token); - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $expected = [ 'iss' => $config->defaultClaims['iss'], 'sub' => '1', @@ -121,7 +122,8 @@ public function testIssuePayload(array $data): void $manager = $this->createJWTManager(); $payload = $manager->parse($token); - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $expected = [ 'iss' => $config->defaultClaims['iss'], 'user_id' => '1', @@ -137,7 +139,8 @@ public function testIssueSetKid(): void $manager = $this->createJWTManager(); // Set kid - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['default'][0]['kid'] = 'Key01'; $payload = [ @@ -181,7 +184,8 @@ public function testIssueWithAsymmetricKey(): void { $manager = $this->createJWTManager(); - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['default'][0] = [ 'alg' => 'RS256', // algorithm. 'public' => '', // Public Key @@ -257,7 +261,8 @@ private function decodeJWT(string $token, $part): array public function testParseCanDecodeTokenSignedByOldKey(): void { - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['default'] = [ [ 'kid' => 'Key01', @@ -294,7 +299,8 @@ public function testParseCanDecodeTokenSignedByOldKey(): void public function testParseCanSpecifyKey(): void { - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['mobile'] = [ [ 'kid' => 'Key01', @@ -329,7 +335,8 @@ private function generateJWTWithAsymmetricKey(): string { $manager = $this->createJWTManager(); - $config = config(AuthJWT::class); + /** @var AuthJWT $config */ + $config = config('AuthJWT'); $config->keys['default'][0] = [ 'alg' => 'RS256', // algorithm. 'public' => <<<'EOD'