File tree 1 file changed +17
-0
lines changed
src/Symfony/Component/Cache/Tests/Adapter
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 14
14
use Symfony \Component \Cache \Adapter \FilesystemAdapter ;
15
15
use Symfony \Component \Cache \Adapter \Psr16Adapter ;
16
16
use Symfony \Component \Cache \Psr16Cache ;
17
+ use Symfony \Component \Debug \BufferingLogger ;
17
18
18
19
/**
19
20
* @group time-sensitive
@@ -28,4 +29,20 @@ public function createCachePool($defaultLifetime = 0)
28
29
{
29
30
return new Psr16Adapter (new Psr16Cache (new FilesystemAdapter ()), '' , $ defaultLifetime );
30
31
}
32
+
33
+ public function testValidCacheKeyWithNamespace ()
34
+ {
35
+ $ logger = new BufferingLogger ();
36
+ $ cache = new Psr16Adapter (new Psr16Cache (new FilesystemAdapter ()), 'some_namespace ' , 0 );
37
+ $ cache ->setLogger ($ logger );
38
+ $ this ->assertSame ('foo ' , $ cache ->get ('my_key ' , function () {
39
+ return 'foo ' ;
40
+ }));
41
+ $ logs = $ logger ->cleanLogs ();
42
+ foreach ($ logs as $ log ) {
43
+ if ('warning ' === $ log [0 ] || 'error ' === $ log [0 ]) {
44
+ $ this ->fail ('An error was triggered while caching key with a namespace: ' .$ log [1 ]);
45
+ }
46
+ }
47
+ }
31
48
}
You can’t perform that action at this time.
0 commit comments