You are here

public function ArrayCollectionTest::testNext in Plug 7

@dataProvider provideDifferentElements

File

lib/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ArrayCollectionTest.php, line 78

Class

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

Namespace

Doctrine\Tests\Common\Collections

Code

public function testNext($elements) {
  $collection = new ArrayCollection($elements);
  while (true) {
    $collectionNext = $collection
      ->next();
    $arrayNext = next($elements);
    if (!$collectionNext || !$arrayNext) {
      break;
    }
    $this
      ->assertSame($arrayNext, $collectionNext, "Returned value of ArrayCollection::next() and next() not match");
    $this
      ->assertSame(key($elements), $collection
      ->key(), "Keys not match");
    $this
      ->assertSame(current($elements), $collection
      ->current(), "Current values not match");
  }
}