You are here

public function ClassMetadataTest::testAddMultipleGetterConstraints in Zircon Profile 8

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

File

vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php, line 94

Class

ClassMetadataTest

Namespace

Symfony\Component\Validator\Tests\Mapping

Code

public function testAddMultipleGetterConstraints() {
  $this->metadata
    ->addGetterConstraints('lastName', array(
    new ConstraintA(),
    new ConstraintB(),
  ));
  $constraints = array(
    new ConstraintA(array(
      'groups' => array(
        'Default',
        'Entity',
      ),
    )),
    new ConstraintB(array(
      'groups' => array(
        'Default',
        'Entity',
      ),
    )),
  );
  $properties = $this->metadata
    ->getPropertyMetadata('lastName');
  $this
    ->assertCount(1, $properties);
  $this
    ->assertEquals('getLastName', $properties[0]
    ->getName());
  $this
    ->assertEquals($constraints, $properties[0]
    ->getConstraints());
}