You are here

public function XmlFileLoaderTest::testLoadClassMetadataWithNonStrings in Plug 7

File

lib/Symfony/validator/Symfony/Component/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);
}