Skip to content

Commit 05e033d

Browse files
authored
Merge pull request #803 from kenjis/fix-test-config-fqcn
test: use short classname for `config()`
2 parents 63891c7 + a90e40a commit 05e033d

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

tests/Authentication/Authenticators/JWTAuthenticatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testCheckNoToken(): void
105105

106106
$this->assertFalse($result->isOK());
107107
$this->assertSame(
108-
\lang('Auth.noToken', [config(AuthJWT::class)->authenticatorHeader]),
108+
\lang('Auth.noToken', [config('AuthJWT')->authenticatorHeader]),
109109
$result->reason()
110110
);
111111
}

tests/Authentication/Filters/JWTFilterTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ protected function setUp(): void
3333
$_SESSION = [];
3434

3535
// Add JWT Authenticator
36-
$config = config(Auth::class);
36+
/** @var Auth $config */
37+
$config = config('Auth');
3738
$config->authenticators['jwt'] = JWT::class;
3839

3940
// Register our filter

tests/Unit/Authentication/JWT/Adapters/FirebaseAdapaterTest.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ public function testDecodeInvalidTokenExceptionUnexpectedValueException(): void
8282
$token = $this->generateJWT();
8383

8484
// Change algorithm and it makes the key invalid.
85-
$config = config(AuthJWT::class);
85+
/** @var AuthJWT $config */
86+
$config = config('AuthJWT');
8687
$config->keys['default'][0]['alg'] = 'ES256';
8788

8889
$adapter = new FirebaseAdapter();
@@ -110,7 +111,8 @@ public function testDecodeInvalidArgumentException(): void
110111
$token = $this->generateJWT();
111112

112113
// Set invalid key.
113-
$config = config(AuthJWT::class);
114+
/** @var AuthJWT $config */
115+
$config = config('AuthJWT');
114116
$config->keys['default'][0] = [
115117
'alg' => '',
116118
'secret' => '',
@@ -128,7 +130,8 @@ public function testEncodeLogicExceptionLogicException(): void
128130
$this->expectExceptionMessage('Cannot encode JWT: Algorithm not supported');
129131

130132
// Set unsupported algorithm.
131-
$config = config(AuthJWT::class);
133+
/** @var AuthJWT $config */
134+
$config = config('AuthJWT');
132135
$config->keys['default'][0]['alg'] = 'PS256';
133136

134137
$adapter = new FirebaseAdapter();

tests/Unit/Authentication/JWT/JWTManagerTest.php

+14-7
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public function testGenerateTokenPayload(array $data): void
5555
$manager = $this->createJWTManager();
5656
$payload = $manager->parse($token);
5757

58-
$config = config(AuthJWT::class);
58+
/** @var AuthJWT $config */
59+
$config = config('AuthJWT');
5960
$expected = [
6061
'iss' => $config->defaultClaims['iss'],
6162
'sub' => '1',
@@ -121,7 +122,8 @@ public function testIssuePayload(array $data): void
121122
$manager = $this->createJWTManager();
122123
$payload = $manager->parse($token);
123124

124-
$config = config(AuthJWT::class);
125+
/** @var AuthJWT $config */
126+
$config = config('AuthJWT');
125127
$expected = [
126128
'iss' => $config->defaultClaims['iss'],
127129
'user_id' => '1',
@@ -137,7 +139,8 @@ public function testIssueSetKid(): void
137139
$manager = $this->createJWTManager();
138140

139141
// Set kid
140-
$config = config(AuthJWT::class);
142+
/** @var AuthJWT $config */
143+
$config = config('AuthJWT');
141144
$config->keys['default'][0]['kid'] = 'Key01';
142145

143146
$payload = [
@@ -181,7 +184,8 @@ public function testIssueWithAsymmetricKey(): void
181184
{
182185
$manager = $this->createJWTManager();
183186

184-
$config = config(AuthJWT::class);
187+
/** @var AuthJWT $config */
188+
$config = config('AuthJWT');
185189
$config->keys['default'][0] = [
186190
'alg' => 'RS256', // algorithm.
187191
'public' => '', // Public Key
@@ -257,7 +261,8 @@ private function decodeJWT(string $token, $part): array
257261

258262
public function testParseCanDecodeTokenSignedByOldKey(): void
259263
{
260-
$config = config(AuthJWT::class);
264+
/** @var AuthJWT $config */
265+
$config = config('AuthJWT');
261266
$config->keys['default'] = [
262267
[
263268
'kid' => 'Key01',
@@ -294,7 +299,8 @@ public function testParseCanDecodeTokenSignedByOldKey(): void
294299

295300
public function testParseCanSpecifyKey(): void
296301
{
297-
$config = config(AuthJWT::class);
302+
/** @var AuthJWT $config */
303+
$config = config('AuthJWT');
298304
$config->keys['mobile'] = [
299305
[
300306
'kid' => 'Key01',
@@ -329,7 +335,8 @@ private function generateJWTWithAsymmetricKey(): string
329335
{
330336
$manager = $this->createJWTManager();
331337

332-
$config = config(AuthJWT::class);
338+
/** @var AuthJWT $config */
339+
$config = config('AuthJWT');
333340
$config->keys['default'][0] = [
334341
'alg' => 'RS256', // algorithm.
335342
'public' => <<<'EOD'

0 commit comments

Comments
 (0)