You are here

public function ClassMetadataTest::testSerialize in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php \Symfony\Component\Validator\Tests\Mapping\ClassMetadataTest::testSerialize()
  2. 8 vendor/symfony/serializer/Tests/Mapping/ClassMetadataTest.php \Symfony\Component\Serializer\Tests\Mapping\ClassMetadataTest::testSerialize()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php \Symfony\Component\Validator\Tests\Mapping\ClassMetadataTest::testSerialize()

File

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

Class

ClassMetadataTest

Namespace

Symfony\Component\Validator\Tests\Mapping

Code

public function testSerialize() {
  $this->metadata
    ->addConstraint(new ConstraintA(array(
    'property1' => 'A',
  )));
  $this->metadata
    ->addConstraint(new ConstraintB(array(
    'groups' => 'TestGroup',
  )));
  $this->metadata
    ->addPropertyConstraint('firstName', new ConstraintA());
  $this->metadata
    ->addGetterConstraint('lastName', new ConstraintB());
  $metadata = unserialize(serialize($this->metadata));
  $this
    ->assertEquals($this->metadata, $metadata);
}