[FrameworkBundle] Don't populate fallback cache on warmup
This commit is contained in:
parent
bc45a0ed82
commit
c857ba5ded
@ -11,11 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
|
namespace Symfony\Bundle\FrameworkBundle\CacheWarmer;
|
||||||
|
|
||||||
use Psr\Cache\CacheItemPoolInterface;
|
|
||||||
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
|
||||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||||
|
use Symfony\Component\Cache\Adapter\NullAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
|
||||||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
|
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,19 +22,13 @@ use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
|
|||||||
abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
||||||
{
|
{
|
||||||
private $phpArrayFile;
|
private $phpArrayFile;
|
||||||
private $fallbackPool;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
|
||||||
*/
|
*/
|
||||||
public function __construct(string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
public function __construct(string $phpArrayFile)
|
||||||
{
|
{
|
||||||
$this->phpArrayFile = $phpArrayFile;
|
$this->phpArrayFile = $phpArrayFile;
|
||||||
if (!$fallbackPool instanceof AdapterInterface) {
|
|
||||||
$fallbackPool = new ProxyAdapter($fallbackPool);
|
|
||||||
}
|
|
||||||
$this->fallbackPool = $fallbackPool;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,13 +60,7 @@ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
|||||||
// so here we un-serialize the values first
|
// so here we un-serialize the values first
|
||||||
$values = array_map(function ($val) { return null !== $val ? unserialize($val) : null; }, $arrayAdapter->getValues());
|
$values = array_map(function ($val) { return null !== $val ? unserialize($val) : null; }, $arrayAdapter->getValues());
|
||||||
|
|
||||||
$this->warmUpPhpArrayAdapter(new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool), $values);
|
$this->warmUpPhpArrayAdapter(new PhpArrayAdapter($this->phpArrayFile, new NullAdapter()), $values);
|
||||||
|
|
||||||
foreach ($values as $k => $v) {
|
|
||||||
$item = $this->fallbackPool->getItem($k);
|
|
||||||
$this->fallbackPool->saveDeferred($item->set($v));
|
|
||||||
}
|
|
||||||
$this->fallbackPool->commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array $values)
|
protected function warmUpPhpArrayAdapter(PhpArrayAdapter $phpArrayAdapter, array $values)
|
||||||
|
@ -31,13 +31,18 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
private $debug;
|
private $debug;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Reader $annotationReader
|
* @param string $phpArrayFile The PHP file where annotations are cached
|
||||||
* @param string $phpArrayFile The PHP file where annotations are cached
|
* @param string $excludeRegexp
|
||||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered annotations are cached
|
* @param bool $debug
|
||||||
*/
|
*/
|
||||||
public function __construct(Reader $annotationReader, string $phpArrayFile, CacheItemPoolInterface $fallbackPool, string $excludeRegexp = null, bool $debug = false)
|
public function __construct(Reader $annotationReader, string $phpArrayFile, $excludeRegexp = null, $debug = false)
|
||||||
{
|
{
|
||||||
parent::__construct($phpArrayFile, $fallbackPool);
|
if ($excludeRegexp instanceof CacheItemPoolInterface) {
|
||||||
|
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
|
||||||
|
$excludeRegexp = $debug;
|
||||||
|
$debug = 4 < \func_num_args() && \func_get_arg(4);
|
||||||
|
}
|
||||||
|
parent::__construct($phpArrayFile);
|
||||||
$this->annotationReader = $annotationReader;
|
$this->annotationReader = $annotationReader;
|
||||||
$this->excludeRegexp = $excludeRegexp;
|
$this->excludeRegexp = $excludeRegexp;
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
|
@ -31,13 +31,15 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
private $loaders;
|
private $loaders;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param LoaderInterface[] $loaders The serializer metadata loaders
|
* @param LoaderInterface[] $loaders The serializer metadata loaders
|
||||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
|
||||||
*/
|
*/
|
||||||
public function __construct(array $loaders, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
public function __construct(array $loaders, string $phpArrayFile)
|
||||||
{
|
{
|
||||||
parent::__construct($phpArrayFile, $fallbackPool);
|
if (2 < \func_num_args() && \func_get_arg(2) instanceof CacheItemPoolInterface) {
|
||||||
|
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
|
parent::__construct($phpArrayFile);
|
||||||
$this->loaders = $loaders;
|
$this->loaders = $loaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,13 +33,14 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
private $validatorBuilder;
|
private $validatorBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ValidatorBuilderInterface $validatorBuilder
|
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
|
||||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ValidatorBuilderInterface $validatorBuilder, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
public function __construct(ValidatorBuilderInterface $validatorBuilder, string $phpArrayFile)
|
||||||
{
|
{
|
||||||
parent::__construct($phpArrayFile, $fallbackPool);
|
if (2 < \func_num_args() && \func_get_arg(2) instanceof CacheItemPoolInterface) {
|
||||||
|
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
|
parent::__construct($phpArrayFile);
|
||||||
$this->validatorBuilder = $validatorBuilder;
|
$this->validatorBuilder = $validatorBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
<service id="annotations.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer">
|
<service id="annotations.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer">
|
||||||
<argument type="service" id="annotations.reader" />
|
<argument type="service" id="annotations.reader" />
|
||||||
<argument>%kernel.cache_dir%/annotations.php</argument>
|
<argument>%kernel.cache_dir%/annotations.php</argument>
|
||||||
<argument type="service" id="cache.annotations" />
|
|
||||||
<argument>#^Symfony\\(?:Component\\HttpKernel\\|Bundle\\FrameworkBundle\\Controller\\(?!AbstractController$|Controller$))#</argument>
|
<argument>#^Symfony\\(?:Component\\HttpKernel\\|Bundle\\FrameworkBundle\\Controller\\(?!AbstractController$|Controller$))#</argument>
|
||||||
<argument>%kernel.debug%</argument>
|
<argument>%kernel.debug%</argument>
|
||||||
</service>
|
</service>
|
||||||
|
@ -90,7 +90,6 @@
|
|||||||
<service id="serializer.mapping.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer">
|
<service id="serializer.mapping.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer">
|
||||||
<argument type="collection" /><!-- Loaders injected by the extension -->
|
<argument type="collection" /><!-- Loaders injected by the extension -->
|
||||||
<argument>%serializer.mapping.cache.file%</argument>
|
<argument>%serializer.mapping.cache.file%</argument>
|
||||||
<argument type="service" id="cache.serializer" />
|
|
||||||
<tag name="kernel.cache_warmer" />
|
<tag name="kernel.cache_warmer" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
<service id="validator.mapping.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer">
|
<service id="validator.mapping.cache_warmer" class="Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer">
|
||||||
<argument type="service" id="validator.builder" />
|
<argument type="service" id="validator.builder" />
|
||||||
<argument>%validator.mapping.cache.file%</argument>
|
<argument>%validator.mapping.cache.file%</argument>
|
||||||
<argument type="service" id="cache.validator" />
|
|
||||||
<tag name="kernel.cache_warmer" />
|
<tag name="kernel.cache_warmer" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ use Doctrine\Common\Annotations\CachedReader;
|
|||||||
use Doctrine\Common\Annotations\Reader;
|
use Doctrine\Common\Annotations\Reader;
|
||||||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
|
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
|
||||||
use Symfony\Component\Cache\Adapter\NullAdapter;
|
use Symfony\Component\Cache\Adapter\NullAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||||
use Symfony\Component\Cache\DoctrineProvider;
|
use Symfony\Component\Cache\DoctrineProvider;
|
||||||
@ -37,13 +36,7 @@ class AnnotationsCacheWarmerTest extends TestCase
|
|||||||
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export(array(__CLASS__), true)));
|
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export(array(__CLASS__), true)));
|
||||||
$cacheFile = tempnam($this->cacheDir, __FUNCTION__);
|
$cacheFile = tempnam($this->cacheDir, __FUNCTION__);
|
||||||
$reader = new AnnotationReader();
|
$reader = new AnnotationReader();
|
||||||
$fallbackPool = new ArrayAdapter();
|
$warmer = new AnnotationsCacheWarmer($reader, $cacheFile);
|
||||||
$warmer = new AnnotationsCacheWarmer(
|
|
||||||
$reader,
|
|
||||||
$cacheFile,
|
|
||||||
$fallbackPool,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
$warmer->warmUp($this->cacheDir);
|
$warmer->warmUp($this->cacheDir);
|
||||||
$this->assertFileExists($cacheFile);
|
$this->assertFileExists($cacheFile);
|
||||||
|
|
||||||
@ -63,14 +56,7 @@ class AnnotationsCacheWarmerTest extends TestCase
|
|||||||
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export(array(__CLASS__), true)));
|
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export(array(__CLASS__), true)));
|
||||||
$cacheFile = tempnam($this->cacheDir, __FUNCTION__);
|
$cacheFile = tempnam($this->cacheDir, __FUNCTION__);
|
||||||
$reader = new AnnotationReader();
|
$reader = new AnnotationReader();
|
||||||
$fallbackPool = new ArrayAdapter();
|
$warmer = new AnnotationsCacheWarmer($reader, $cacheFile, null, true);
|
||||||
$warmer = new AnnotationsCacheWarmer(
|
|
||||||
$reader,
|
|
||||||
$cacheFile,
|
|
||||||
$fallbackPool,
|
|
||||||
null,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$warmer->warmUp($this->cacheDir);
|
$warmer->warmUp($this->cacheDir);
|
||||||
$this->assertFileExists($cacheFile);
|
$this->assertFileExists($cacheFile);
|
||||||
// Assert cache is valid
|
// Assert cache is valid
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
|
|||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer;
|
use Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
|
||||||
use Symfony\Component\Cache\Adapter\NullAdapter;
|
use Symfony\Component\Cache\Adapter\NullAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||||
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
|
use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory;
|
||||||
@ -36,9 +35,7 @@ class SerializerCacheWarmerTest extends TestCase
|
|||||||
$file = sys_get_temp_dir().'/cache-serializer.php';
|
$file = sys_get_temp_dir().'/cache-serializer.php';
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
|
|
||||||
$fallbackPool = new ArrayAdapter();
|
$warmer = new SerializerCacheWarmer($loaders, $file);
|
||||||
|
|
||||||
$warmer = new SerializerCacheWarmer($loaders, $file, $fallbackPool);
|
|
||||||
$warmer->warmUp(\dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
@ -47,13 +44,6 @@ class SerializerCacheWarmerTest extends TestCase
|
|||||||
|
|
||||||
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person')->isHit());
|
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person')->isHit());
|
||||||
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit());
|
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit());
|
||||||
|
|
||||||
$values = $fallbackPool->getValues();
|
|
||||||
|
|
||||||
$this->assertInternalType('array', $values);
|
|
||||||
$this->assertCount(2, $values);
|
|
||||||
$this->assertArrayHasKey('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person', $values);
|
|
||||||
$this->assertArrayHasKey('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author', $values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWarmUpWithoutLoader()
|
public function testWarmUpWithoutLoader()
|
||||||
@ -65,16 +55,9 @@ class SerializerCacheWarmerTest extends TestCase
|
|||||||
$file = sys_get_temp_dir().'/cache-serializer-without-loader.php';
|
$file = sys_get_temp_dir().'/cache-serializer-without-loader.php';
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
|
|
||||||
$fallbackPool = new ArrayAdapter();
|
$warmer = new SerializerCacheWarmer(array(), $file);
|
||||||
|
|
||||||
$warmer = new SerializerCacheWarmer(array(), $file, $fallbackPool);
|
|
||||||
$warmer->warmUp(\dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
$values = $fallbackPool->getValues();
|
|
||||||
|
|
||||||
$this->assertInternalType('array', $values);
|
|
||||||
$this->assertCount(0, $values);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
|
|||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
|
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
|
||||||
use Symfony\Component\Cache\Adapter\NullAdapter;
|
use Symfony\Component\Cache\Adapter\NullAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||||
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
use Symfony\Component\Validator\Mapping\ClassMetadata;
|
||||||
@ -32,9 +31,7 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
$file = sys_get_temp_dir().'/cache-validator.php';
|
$file = sys_get_temp_dir().'/cache-validator.php';
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
|
|
||||||
$fallbackPool = new ArrayAdapter();
|
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file);
|
||||||
|
|
||||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
|
||||||
$warmer->warmUp(\dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
@ -43,13 +40,6 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
|
|
||||||
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Person')->isHit());
|
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Person')->isHit());
|
||||||
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author')->isHit());
|
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author')->isHit());
|
||||||
|
|
||||||
$values = $fallbackPool->getValues();
|
|
||||||
|
|
||||||
$this->assertInternalType('array', $values);
|
|
||||||
$this->assertCount(2, $values);
|
|
||||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Person', $values);
|
|
||||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author', $values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWarmUpWithAnnotations()
|
public function testWarmUpWithAnnotations()
|
||||||
@ -61,9 +51,7 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
$file = sys_get_temp_dir().'/cache-validator-with-annotations.php';
|
$file = sys_get_temp_dir().'/cache-validator-with-annotations.php';
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
|
|
||||||
$fallbackPool = new ArrayAdapter();
|
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file);
|
||||||
|
|
||||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
|
||||||
$warmer->warmUp(\dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
@ -74,13 +62,6 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
$this->assertTrue($item->isHit());
|
$this->assertTrue($item->isHit());
|
||||||
|
|
||||||
$this->assertInstanceOf(ClassMetadata::class, $item->get());
|
$this->assertInstanceOf(ClassMetadata::class, $item->get());
|
||||||
|
|
||||||
$values = $fallbackPool->getValues();
|
|
||||||
|
|
||||||
$this->assertInternalType('array', $values);
|
|
||||||
$this->assertCount(2, $values);
|
|
||||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Category', $values);
|
|
||||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.SubCategory', $values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWarmUpWithoutLoader()
|
public function testWarmUpWithoutLoader()
|
||||||
@ -90,16 +71,9 @@ class ValidatorCacheWarmerTest extends TestCase
|
|||||||
$file = sys_get_temp_dir().'/cache-validator-without-loaders.php';
|
$file = sys_get_temp_dir().'/cache-validator-without-loaders.php';
|
||||||
@unlink($file);
|
@unlink($file);
|
||||||
|
|
||||||
$fallbackPool = new ArrayAdapter();
|
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file);
|
||||||
|
|
||||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, $file, $fallbackPool);
|
|
||||||
$warmer->warmUp(\dirname($file));
|
$warmer->warmUp(\dirname($file));
|
||||||
|
|
||||||
$this->assertFileExists($file);
|
$this->assertFileExists($file);
|
||||||
|
|
||||||
$values = $fallbackPool->getValues();
|
|
||||||
|
|
||||||
$this->assertInternalType('array', $values);
|
|
||||||
$this->assertCount(0, $values);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user