You are here

public function ArrayCollectionTest::testIterator in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php \Doctrine\Tests\Common\Collections\ArrayCollectionTest::testIterator()

@dataProvider provideDifferentElements

File

vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php, line 144

Class

ArrayCollectionTest
Tests for { @covers \Doctrine\Common\Collections\ArrayCollection

Namespace

Doctrine\Tests\Common\Collections

Code

public function testIterator($elements) {
  $collection = new ArrayCollection($elements);
  $iterations = 0;
  foreach ($collection
    ->getIterator() as $key => $item) {
    $this
      ->assertSame($elements[$key], $item, "Item {$key} not match");
    $iterations++;
  }
  $this
    ->assertEquals(count($elements), $iterations, "Number of iterations not match");
}