4
4
5
5
namespace Pdp \Storage ;
6
6
7
+ use DateInterval ;
8
+ use DateTimeImmutable ;
7
9
use InvalidArgumentException ;
8
10
use Pdp \Rules ;
9
11
use PHPUnit \Framework \TestCase ;
@@ -54,7 +56,7 @@ public function testItReturnsNullIfTheCacheContentCannotBeConvertedToTheCorrectI
54
56
$ cache = $ this ->createStub (CacheInterface::class);
55
57
$ cache ->method ('get ' )->willReturn ('{"foo":"bar"} ' );
56
58
57
- $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new \ DateTimeImmutable ('+1 DAY ' ));
59
+ $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new DateTimeImmutable ('+1 DAY ' ));
58
60
59
61
self ::assertNull ($ pslCache ->fetch ('http://www.example.com ' ));
60
62
}
@@ -65,7 +67,7 @@ public function testItCanStoreAPublicSuffixListInstance(): void
65
67
$ cache ->method ('set ' )->willReturn (true );
66
68
67
69
$ psl = Rules::fromPath (dirname (__DIR__ , 2 ).'/test_data/public_suffix_list.dat ' );
68
- $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new \ DateInterval ('P1D ' ));
70
+ $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new DateInterval ('P1D ' ));
69
71
70
72
self ::assertTrue ($ pslCache ->remember ('http://www.example.com ' , $ psl ));
71
73
}
@@ -76,7 +78,7 @@ public function testItReturnsFalseIfItCantStoreAPublicSuffixListInstance(): void
76
78
$ cache ->method ('set ' )->willReturn (false );
77
79
78
80
$ psl = Rules::fromPath (dirname (__DIR__ , 2 ).'/test_data/public_suffix_list.dat ' );
79
- $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new \ DateInterval ('P1D ' ));
81
+ $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new DateInterval ('P1D ' ));
80
82
81
83
self ::assertFalse ($ pslCache ->remember ('http://www.example.com ' , $ psl ));
82
84
}
@@ -89,7 +91,7 @@ public function testItReturnsFalseIfItCantCacheAPublicSuffixListInstance(): void
89
91
$ cache ->method ('set ' )->will (self ::throwException ($ exception ));
90
92
91
93
$ psl = Rules::fromPath (dirname (__DIR__ , 2 ).'/test_data/public_suffix_list.dat ' );
92
- $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new \ DateInterval ('P1D ' ));
94
+ $ pslCache = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new DateInterval ('P1D ' ));
93
95
94
96
self ::assertFalse ($ pslCache ->remember ('http://www.example.com ' , $ psl ));
95
97
}
@@ -120,7 +122,7 @@ public function testItCanDeleteTheCachedDatabase(): void
120
122
$ cache = $ this ->createStub (CacheInterface::class);
121
123
$ cache ->method ('delete ' )->willReturn (true );
122
124
123
- $ instance = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new \ DateInterval ('P1D ' ));
125
+ $ instance = new PublicSuffixListPsr16Cache ($ cache , 'pdp_ ' , new DateInterval ('P1D ' ));
124
126
self ::assertTrue ($ instance ->forget ($ uri ));
125
127
}
126
128
0 commit comments