Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
AnnotationsCacheWarmer example
$fs
->
remove
(
$this
->cacheDir
)
;
parent::
tearDown
(
)
;
}
public
function
testAnnotationsCacheWarmerWithDebugDisabled
(
)
{
file_put_contents
(
$this
->cacheDir.'/annotations.map',
sprintf
(
'<?php return %s;',
var_export
(
[
__CLASS__
]
, true
)
)
)
;
$cacheFile
=
tempnam
(
$this
->cacheDir, __FUNCTION__
)
;
$reader
=
new
AnnotationReader
(
)
;
$this
->
expectDeprecation
(
'Since symfony/framework-bundle 6.4: The "Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer" class is deprecated without replacement.'
)
;
$warmer
=
new
AnnotationsCacheWarmer
(
$reader
,
$cacheFile
)
;
$warmer
->
warmUp
(
$this
->cacheDir
)
;
$this
->
assertFileExists
(
$cacheFile
)
;
// Assert cache is valid
$reader
=
new
PsrCachedReader
(
$this
->
getReadOnlyReader
(
)
,
new
PhpArrayAdapter
(
$cacheFile
,
new
NullAdapter
(
)
)
)
;
$refClass
=
new
\
ReflectionClass
(
$this
)
;
$reader
->
getClassAnnotations
(
$refClass
)
;