You are here

public function ConstraintViolationListTest::testIterator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/ConstraintViolationListTest.php \Symfony\Component\Validator\Tests\ConstraintViolationListTest::testIterator()

File

vendor/symfony/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));
}