You are here

public function ClassMetadataTest::testMergeConstraintsMergesClassConstraints in Plug 7

File

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