* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Tests\Mapping; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\Mapping\MemberMetadata; use Symfony\Component\Validator\Tests\Fixtures\ClassConstraint; use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; class MemberMetadataTest extends TestCase { protected $metadata; protected function setUp() { $this->metadata = new TestMemberMetadata( 'Symfony\Component\Validator\Tests\Fixtures\Entity', 'getLastName', 'lastName' ); } protected function tearDown() { $this->metadata = null; } public function testAddConstraintRequiresClassConstraints() { $this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('Symfony\Component\Validator\Exception\ConstraintDefinitionException'); $this->metadata->addConstraint(new ClassConstraint()); } public function testSerialize() { $this->metadata->addConstraint(new ConstraintA(array('property1' => 'A'))); $this->metadata->addConstraint(new ConstraintB(array('groups' => 'TestGroup'))); $metadata = unserialize(serialize($this->metadata)); $this->assertEquals($this->metadata, $metadata); } public function testSerializeCollectionCascaded() { $this->metadata->addConstraint(new Valid(array('traverse' => true))); $metadata = unserialize(serialize($this->metadata)); $this->assertEquals($this->metadata, $metadata); } public function testSerializeCollectionNotCascaded() { $this->metadata->addConstraint(new Valid(array('traverse' => false))); $metadata = unserialize(serialize($this->metadata)); $this->assertEquals($this->metadata, $metadata); } } class TestMemberMetadata extends MemberMetadata { public function getPropertyValue($object) { } protected function newReflectionMember($object) { } } __halt_compiler();----SIGNATURE:----bkH9oZQUt1j42vNFPj9+WJWGG/vls7YvpafEvnDMk2+u4Knrq2i/N3JIGCTgNwHEUkRYlgsyffnQ9xvHFba5KHc5+K6u93ApobkECyaq39c51XRJ33UES1W2+aAFn0ijmOjVzr5DANlDfpYVePpMDvWX5oNd5qyKsbX5Ol5TCExfICgnUnckUH1a/Mf2gU4uWnzbbWZsk7nukqwTot97vWtTQ8kCzUaTvOj+fzOO+vvCbWqydf6FsNSXl49O6zNFehBm72/MG0Cba02XKfCU9QfbeyhRlwZpmcwoq9FA30wcuWK/TEKmWbCH5+5c+lbi4qFYcnEsdWp06GPeEyAY5fTX1vhwxAjQFYAvsC6yNwvdWWAjDFLtoNkd6pkEd63aKk/tP3Sjpyyxb+qHFksEyc5AhC7Av4Yog3flPASGAEpa/11k7KtGO8YrB6rI/9ohrq3yNU5zkqS9hM2IO5ZEO2ZbFH9YrWFcqBUVfUUlaupo2aiPGpFYkPg8Jxn5MHBnDaSm5ORhuRpT17Vv9pH7+zgBaz1tNhpK1qFkeYpo6U8DIP+lGLr+gSb0HF87s7DKF7aLdxFD1GguZ4efF0uQB0l3fd/xDs3n33nZZV3bYqPQDu5KDyPTujfDwDzsIMr1fyLm8AUhyG8S73llQqAqMLn+xjFVUC19q4lgFIr0IKY=----ATTACHMENT:----MjEzNTg3ODg3NTY3NjQyMCA4NDU1NTQ0NjQ3NzY5NDU3IDc5Nzc4NjMzMzI4MjY1MQ==