public function LazyLoadingMetadataFactoryTest::testWriteMetadataToCache in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php \Symfony\Component\Validator\Tests\Mapping\Factory\LazyLoadingMetadataFactoryTest::testWriteMetadataToCache()
File
- vendor/
symfony/ validator/ Tests/ Mapping/ Factory/ LazyLoadingMetadataFactoryTest.php, line 61
Class
Namespace
Symfony\Component\Validator\Tests\Mapping\FactoryCode
public function testWriteMetadataToCache() {
$cache = $this
->getMock('Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface');
$factory = new LazyLoadingMetadataFactory(new TestLoader(), $cache);
$tester = $this;
$constraints = array(
new ConstraintA(array(
'groups' => array(
'Default',
'EntityParent',
),
)),
);
$cache
->expects($this
->never())
->method('has');
$cache
->expects($this
->once())
->method('read')
->with($this
->equalTo(self::PARENTCLASS))
->will($this
->returnValue(false));
$cache
->expects($this
->once())
->method('write')
->will($this
->returnCallback(function ($metadata) use ($tester, $constraints) {
$tester
->assertEquals($constraints, $metadata
->getConstraints());
}));
$metadata = $factory
->getMetadataFor(self::PARENTCLASS);
$this
->assertEquals(self::PARENTCLASS, $metadata
->getClassName());
$this
->assertEquals($constraints, $metadata
->getConstraints());
}