Skip to content

Commit f87558d

Browse files
committed
[Form] fix violation mapper tests
This takes into account the changes to the `getErrors()` in Symfony 2.5 (the method rturns a `FormErrorIterator` instead of an array) as well as the fact that non-submitted forms do not accept errors since #10567 anymore.
1 parent 1c79c7b commit f87558d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1552,12 +1552,14 @@ public function testBacktrackIfSeveralSubFormsWithSamePropertyPath()
15521552
$parent->add($child2);
15531553
$child2->add($grandChild);
15541554

1555+
$parent->submit(array());
1556+
15551557
$this->mapper->mapViolation($violation, $parent);
15561558

15571559
// The error occurred on the child of the second form with the same path
15581560
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
15591561
$this->assertCount(0, $child1->getErrors(), $child1->getName().' should not have an error, but has one');
15601562
$this->assertCount(0, $child2->getErrors(), $child2->getName().' should not have an error, but has one');
1561-
$this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChild->getName().' should have an error, but has none');
1563+
$this->assertEquals(array($this->getFormError($violation, $grandChild)), iterator_to_array($grandChild->getErrors()), $grandChild->getName().' should have an error, but has none');
15621564
}
15631565
}

0 commit comments

Comments
 (0)