public function AbstractValidatorTest::testDisableTraversableTraversal in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php \Symfony\Component\Validator\Tests\Validator\AbstractValidatorTest::testDisableTraversableTraversal()
File
- vendor/
symfony/ validator/ Tests/ Validator/ AbstractValidatorTest.php, line 712
Class
- AbstractValidatorTest
- @since 2.5
Namespace
Symfony\Component\Validator\Tests\ValidatorCode
public function testDisableTraversableTraversal() {
$entity = new Entity();
$entity->reference = new \ArrayIterator(array(
'key' => new Reference(),
));
$callback = function ($value, ExecutionContextInterface $context) {
$context
->addViolation('Message %param%', array(
'%param%' => 'value',
));
};
$this->metadataFactory
->addMetadata(new ClassMetadata('ArrayIterator'));
$this->metadata
->addPropertyConstraint('reference', new Valid(array(
'traverse' => false,
)));
$this->referenceMetadata
->addConstraint(new Callback($callback));
$violations = $this
->validate($entity);
/* @var ConstraintViolationInterface[] $violations */
$this
->assertCount(0, $violations);
}