8000 minor #17820 [Form] fix violation mapper tests (xabbuh) · symfony/symfony@fd33367 · GitHub
[go: up one dir, main page]

Skip to content

Commit fd33367

Browse files
committed
minor #17820 [Form] fix violation mapper tests (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] fix violation mapper tests | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17099 | License | MIT | Doc PR | 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. Commits ------- f87558d [Form] fix violation mapper tests
2 parents 2c59be5 + f87558d commit fd33367

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

Lines changed: 3 additions & 1 deletion
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)
0