/** * @dataProvider provideDifferentElements */ 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'); } }