You are here

public function XmlFileLoaderTest::testLoadClassMetadataWithNonStrings in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php \Symfony\Component\Validator\Tests\Mapping\Loader\XmlFileLoaderTest::testLoadClassMetadataWithNonStrings()

File

vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php, line 80

Class

XmlFileLoaderTest

Namespace

Symfony\Component\Validator\Tests\Mapping\Loader

Code

public function testLoadClassMetadataWithNonStrings() {
  $loader = new XmlFileLoader(__DIR__ . '/constraint-mapping-non-strings.xml');
  $metadata = new ClassMetadata('Symfony\\Component\\Validator\\Tests\\Fixtures\\Entity');
  $loader
    ->loadClassMetadata($metadata);
  $expected = new ClassMetadata('Symfony\\Component\\Validator\\Tests\\Fixtures\\Entity');
  $expected
    ->addPropertyConstraint('firstName', new Regex(array(
    'pattern' => '/^1/',
    'match' => false,
  )));
  $properties = $metadata
    ->getPropertyMetadata('firstName');
  $constraints = $properties[0]
    ->getConstraints();
  $this
    ->assertFalse($constraints[0]->match);
}