5
5
use Contributte \Tester \Environment ;
6
6
use Contributte \Tester \Utils \ContainerBuilder ;
7
7
use Contributte \Tester \Utils \Neonkit ;
8
- use Doctrine \Common \Annotations \CachedReader ;
8
+ use Doctrine \Common \Annotations \PsrCachedReader ;
9
9
use Doctrine \Common \Annotations \Reader ;
10
- use Doctrine \Common \Cache \ApcuCache ;
11
- use Doctrine \Common \Cache \Cache ;
12
- use Doctrine \Common \Cache \PhpFileCache ;
13
10
use Nette \DI \Compiler ;
14
11
use Nette \InvalidStateException ;
15
12
use Nettrine \Annotations \DI \AnnotationsExtension ;
16
- use Nettrine \Cache \DI \CacheExtension ;
13
+ use Symfony \Component \Cache \Adapter \ArrayAdapter ;
14
+ use Symfony \Component \Cache \Adapter \PhpFilesAdapter ;
17
15
use Tester \Assert ;
18
16
use Tester \TestCase ;
19
17
@@ -27,18 +25,20 @@ public function testAutowiredCache(): void
27
25
$ container = ContainerBuilder::of ()
28
26
->withCompiler (function (Compiler $ compiler ): void {
29
27
$ compiler ->addExtension ('annotations ' , new AnnotationsExtension ());
30
- $ compiler ->addExtension ('cache ' , new CacheExtension ());
31
28
$ compiler ->addConfig ([
32
29
'parameters ' => [
33
30
'tempDir ' => Environment::getTestDir (),
34
31
],
32
+ 'annotations ' => [
33
+ 'cache ' => PhpFilesAdapter::class, // Use PSR-6 cache
34
+ ],
35
35
]);
36
36
$ compiler ->addDependencies ([__FILE__ ]);
37
37
})
38
38
->build ();
39
39
40
- Assert::type (CachedReader ::class, $ container ->getByType (Reader::class));
41
- Assert::type (PhpFileCache ::class, $ container ->getService ('cache.driver ' ));
40
+ Assert::type (PsrCachedReader ::class, $ container ->getByType (Reader::class));
41
+ Assert::type (PhpFilesAdapter ::class, $ container ->getService ('annotations.cache ' ));
42
42
}
43
43
44
44
public function testProvidedCache (): void
@@ -47,16 +47,15 @@ public function testProvidedCache(): void
47
47
->withCompiler (function (Compiler $ compiler ): void {
48
48
$ compiler ->addExtension ('annotations ' , new AnnotationsExtension ());
49
49
$ compiler ->addConfig (Neonkit::load ('
50
- annotations:
51
- cache: Doctrine\Common \Cache\ApcuCache
52
- ' ));
50
+ annotations:
51
+ cache: Symfony\Component \Cache\Adapter\ArrayAdapter
52
+ ' ));
53
53
$ compiler ->addDependencies ([__FILE__ ]);
54
54
})
55
55
->build ();
56
56
57
- Assert::type (CachedReader::class, $ container ->getByType (Reader::class));
58
- Assert::type (ApcuCache::class, $ container ->getService ('annotations.cache ' ));
59
- Assert::null ($ container ->getByType (Cache::class, false ));
57
+ Assert::type (PsrCachedReader::class, $ container ->getByType (Reader::class));
58
+ Assert::type (ArrayAdapter::class, $ container ->getService ('annotations.cache ' ));
60
59
}
61
60
62
61
public function testNoCache (): void
0 commit comments