public function testValidateCascadedPropertyDoesNotRecurseByDefault() {
$entity = new Entity();
$entity->reference = new \ArrayIterator(array(
// The inner iterator should not be traversed by default
'key' => new \ArrayIterator(array(
'nested' => new Entity(),
)),
));
$this->metadataFactory
->addMetadata(new ClassMetadata('ArrayIterator'));
// add a constraint for the entity that always fails
$this->metadata
->addConstraint(new FailingConstraint());
// validate iterator when validating the property "reference"
$this->metadata
->addPropertyConstraint('reference', new Valid());
$this->visitor
->validate($entity, 'Default', '');
$violations = new ConstraintViolationList(array(
// generated by the root object
new ConstraintViolation('Failed', 'Failed', array(), 'Root', '', $entity),
));
$this
->assertEquals($violations, $this->visitor
->getViolations());
}