public function CollectionValidatorTest::testWalkMultipleConstraints in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\CollectionValidatorTest::testWalkMultipleConstraints()
File
- vendor/
symfony/ validator/ Tests/ Constraints/ CollectionValidatorTest.php, line 97
Class
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
public function testWalkMultipleConstraints() {
$constraints = array(
new Range(array(
'min' => 4,
)),
new NotNull(),
);
$array = array(
'foo' => 3,
'bar' => 5,
);
$i = 0;
foreach ($array as $key => $value) {
$this
->expectValidateValueAt($i++, '[' . $key . ']', $value, $constraints);
}
$data = $this
->prepareTestData($array);
$this->validator
->validate($data, new Collection(array(
'fields' => array(
'foo' => $constraints,
'bar' => $constraints,
),
)));
$this
->assertNoViolation();
}