You are here

public function LazyLoadingMetadataFactoryTest::testReadMetadataFromCache in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php \Symfony\Component\Validator\Tests\Mapping\Factory\LazyLoadingMetadataFactoryTest::testReadMetadataFromCache()

File

vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php, line 89

Class

LazyLoadingMetadataFactoryTest

Namespace

Symfony\Component\Validator\Tests\Mapping\Factory

Code

public function testReadMetadataFromCache() {
  $loader = $this
    ->getMock('Symfony\\Component\\Validator\\Mapping\\Loader\\LoaderInterface');
  $cache = $this
    ->getMock('Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface');
  $factory = new LazyLoadingMetadataFactory($loader, $cache);
  $tester = $this;
  $metadata = new ClassMetadata(self::PARENTCLASS);
  $metadata
    ->addConstraint(new ConstraintA());
  $loader
    ->expects($this
    ->never())
    ->method('loadClassMetadata');
  $cache
    ->expects($this
    ->never())
    ->method('has');
  $cache
    ->expects($this
    ->once())
    ->method('read')
    ->will($this
    ->returnValue($metadata));
  $this
    ->assertEquals($metadata, $factory
    ->getMetadataFor(self::PARENTCLASS));
}