public function shouldBatchIteratorElements() { //given $iterator = new \ArrayIterator(array(1, 2, 3, 4)); //when $result = FluentIterator::from($iterator)->batch(2); //then $this->assertEquals(array(array(1, 2), array(3, 4)), $result->toArray()); }