1
1
<?php
2
2
3
- namespace Lexik \Bundle \JWTAuthenticationBundle \Tests \Services ;
3
+ namespace Lexik \Bundle \JWTAuthenticationBundle \Tests \Services \ BlockedToken ;
4
4
5
5
use DateTime ;
6
6
use DateTimeImmutable ;
7
7
use Lexik \Bundle \JWTAuthenticationBundle \Exception \MissingClaimException ;
8
- use Lexik \Bundle \JWTAuthenticationBundle \Services \BlockedTokenManager ;
8
+ use Lexik \Bundle \JWTAuthenticationBundle \Services \BlockedToken \ CacheItemPoolBlockedTokenManager ;
9
9
use PHPUnit \Framework \TestCase ;
10
10
use Symfony \Bridge \PhpUnit \ClockMock ;
11
11
use Symfony \Component \Cache \Adapter \ArrayAdapter ;
12
12
13
- class BlockedTokenManagerTest extends TestCase
13
+ class CacheItemPoolBlockedTokenManagerTest extends TestCase
14
14
{
15
15
private const JTI = '3de41d11099ed70e23e634eb32c959da ' ;
16
16
private const IAT = 1699455323 ;
@@ -19,7 +19,7 @@ public function testAddPayloadWithoutExpirationShouldThrowsAnException()
19
19
{
20
20
$ this ->expectException (MissingClaimException::class);
21
21
$ cacheAdapter = new ArrayAdapter ();
22
- $ blockedTokenManager = new BlockedTokenManager ($ cacheAdapter );
22
+ $ blockedTokenManager = new CacheItemPoolBlockedTokenManager ($ cacheAdapter );
23
23
$ blockedTokenManager ->add (
24
24
[
25
25
'iat ' => self ::IAT ,
@@ -36,7 +36,7 @@ public function testAddPayloadWithoutJitShouldThrowsAnException()
36
36
{
37
37
$ this ->expectException (MissingClaimException::class);
38
38
$ cacheAdapter = new ArrayAdapter ();
39
- $ blockedTokenManager = new BlockedTokenManager ($ cacheAdapter );
39
+ $ blockedTokenManager = new CacheItemPoolBlockedTokenManager ($ cacheAdapter );
40
40
$ blockedTokenManager ->add (
41
41
[
42
42
'iat ' => self ::IAT ,
@@ -52,7 +52,7 @@ public function testAddPayloadWithoutJitShouldThrowsAnException()
52
52
public function testShouldNotAddPayloadIfItHasExpired ()
53
53
{
54
54
$ cacheAdapter = new ArrayAdapter ();
55
- $ blockedTokenManager = new BlockedTokenManager ($ cacheAdapter );
55
+ $ blockedTokenManager = new CacheItemPoolBlockedTokenManager ($ cacheAdapter );
56
56
self ::assertFalse (
57
57
$ blockedTokenManager ->add (
58
58
[
@@ -74,7 +74,7 @@ public function testShouldBlockTokenIfPaylaodHasNotExpired()
74
74
ClockMock::register (ArrayAdapter::class);
75
75
76
76
$ cacheAdapter = new ArrayAdapter ();
77
- $ blockedTokenManager = new BlockedTokenManager ($ cacheAdapter );
77
+ $ blockedTokenManager = new CacheItemPoolBlockedTokenManager ($ cacheAdapter );
78
78
79
79
$ expirationDateTime = new DateTimeImmutable ('2050-01-01 00:00:00 ' );
80
80
self ::assertTrue (
@@ -103,7 +103,7 @@ public function testShouldBlockTokenIfPaylaodHasNotExpired()
103
103
public function testHasToken ()
104
104
{
105
105
$ cacheAdapter = new ArrayAdapter ();
106
- $ blockedTokenManager = new BlockedTokenManager ($ cacheAdapter );
106
+ $ blockedTokenManager = new CacheItemPoolBlockedTokenManager ($ cacheAdapter );
107
107
108
108
$ expirationDateTime = new DateTimeImmutable ('2050-01-01 00:00:00 ' );
109
109
$ payload = [
0 commit comments