You are here

public function ClassMetadataTest::testMergeConstraintsMergesClassConstraints 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::testMergeConstraintsMergesClassConstraints()

File

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

Class

ClassMetadataTest

Namespace

Symfony\Component\Validator\Tests\Mapping

Code

public function testMergeConstraintsMergesClassConstraints() {
  $parent = new ClassMetadata(self::PARENTCLASS);
  $parent
    ->addConstraint(new ConstraintA());
  $this->metadata
    ->mergeConstraints($parent);
  $this->metadata
    ->addConstraint(new ConstraintA());
  $constraints = array(
    new ConstraintA(array(
      'groups' => array(
        'Default',
        'EntityParent',
        'Entity',
      ),
    )),
    new ConstraintA(array(
      'groups' => array(
        'Default',
        'Entity',
      ),
    )),
  );
  $this
    ->assertEquals($constraints, $this->metadata
    ->getConstraints());
}