You are here

public function CollectionValidatorTest::testWalkSingleConstraint in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php, line 70

Class

CollectionValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testWalkSingleConstraint() {
  $constraint = new Range(array(
    'min' => 4,
  ));
  $array = array(
    'foo' => 3,
    'bar' => 5,
  );
  $i = 0;
  foreach ($array as $key => $value) {
    $this
      ->expectValidateValueAt($i++, '[' . $key . ']', $value, array(
      $constraint,
    ));
  }
  $data = $this
    ->prepareTestData($array);
  $this->validator
    ->validate($data, new Collection(array(
    'fields' => array(
      'foo' => $constraint,
      'bar' => $constraint,
    ),
  )));
  $this
    ->assertNoViolation();
}