use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\ValidatorBuilder;
class ValidatorCacheWarmerTest extends TestCase
{ public function testWarmUp() { $validatorBuilder =
new ValidatorBuilder();
$validatorBuilder->
addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml'
);
$validatorBuilder->
addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml'
);
$validatorBuilder->
addMethodMapping('loadValidatorMetadata'
);
$validatorBuilder->
enableAttributeMapping();
$file =
sys_get_temp_dir().'/cache-validator.php';
@
unlink($file);
$warmer =
new ValidatorCacheWarmer($validatorBuilder,
$file);
$warmer->
warmUp(\
dirname($file));
$this->
assertFileExists($file);
$arrayPool =
new PhpArrayAdapter($file,
new NullAdapter());