/** * @test */ public function shouldRewindIterator() { $ait = new ArrayIterator(array('a', 'b', 'c', 'd')); $ait->next(); $ait->next(); $batchIterator = new BatchingIterator($ait, 2); //when $batchIterator->rewind(); //then $this->assertEquals(array(array('a', 'b'), array('c', 'd')), iterator_to_array($batchIterator)); }