You are here

public function ConstraintViolationListTest::testIterator in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/ConstraintViolationListTest.php, line 71

Class

ConstraintViolationListTest

Namespace

Symfony\Component\Validator\Tests

Code

public function testIterator() {
  $violations = array(
    10 => $this
      ->getViolation('Error 1'),
    20 => $this
      ->getViolation('Error 2'),
    30 => $this
      ->getViolation('Error 3'),
  );
  $this->list = new ConstraintViolationList($violations);

  // indices are reset upon adding -> array_values()
  $this
    ->assertSame(array_values($violations), iterator_to_array($this->list));
}