44
55use Doctrine \Common \Annotations \AnnotationReader ;
66use Doctrine \Common \Annotations \CachedReader ;
7+ use Doctrine \Common \Annotations \PsrCachedReader ;
78use Doctrine \Common \Annotations \Reader ;
89use PHPUnit \Framework \MockObject \MockObject ;
910use Symfony \Bundle \FrameworkBundle \CacheWarmer \AnnotationsCacheWarmer ;
@@ -42,10 +43,13 @@ public function testAnnotationsCacheWarmerWithDebugDisabled()
4243 $ this ->assertFileExists ($ cacheFile );
4344
4445 // Assert cache is valid
45- $ reader = new CachedReader (
46- $ this ->getReadOnlyReader (),
47- new DoctrineProvider (new PhpArrayAdapter ($ cacheFile , new NullAdapter ()))
48- );
46+ $ psr6Cache = new PhpArrayAdapter ($ cacheFile , new NullAdapter ());
47+ if (class_exists (PsrCachedReader::class)) {
48+ $ reader = new PsrCachedReader ($ this ->getReadOnlyReader (), $ psr6Cache );
49+ } else {
50+ $ reader = new CachedReader ($ this ->getReadOnlyReader (), new DoctrineProvider ($ psr6Cache ));
51+ }
52+
4953 $ refClass = new \ReflectionClass ($ this );
5054 $ reader ->getClassAnnotations ($ refClass );
5155 $ reader ->getMethodAnnotations ($ refClass ->getMethod (__FUNCTION__ ));
@@ -60,12 +64,15 @@ public function testAnnotationsCacheWarmerWithDebugEnabled()
6064 $ warmer = new AnnotationsCacheWarmer ($ reader , $ cacheFile , null , true );
6165 $ warmer ->warmUp ($ this ->cacheDir );
6266 $ this ->assertFileExists ($ cacheFile );
67+
6368 // Assert cache is valid
64- $ reader = new CachedReader (
65- $ this ->getReadOnlyReader (),
66- new DoctrineProvider (new PhpArrayAdapter ($ cacheFile , new NullAdapter ())),
67- true
68- );
69+ $ psr6Cache = new PhpArrayAdapter ($ cacheFile , new NullAdapter ());
70+ if (class_exists (PsrCachedReader::class)) {
71+ $ reader = new PsrCachedReader ($ this ->getReadOnlyReader (), $ psr6Cache );
72+ } else {
73+ $ reader = new CachedReader ($ this ->getReadOnlyReader (), new DoctrineProvider ($ psr6Cache ));
74+ }
75+
6976 $ refClass = new \ReflectionClass ($ this );
7077 $ reader ->getClassAnnotations ($ refClass );
7178 $ reader ->getMethodAnnotations ($ refClass ->getMethod (__FUNCTION__ ));
0 commit comments