Ouzo\Utilities\Iterator\BatchingIteratorTest::shouldChunkElementsWhenLengthNotDivisibleByChunk PHP Method

shouldChunkElementsWhenLengthNotDivisibleByChunk() public method

    public function shouldChunkElementsWhenLengthNotDivisibleByChunk()
    {
        //given
        $array = array(1, 2, 3);
        $batchIterator = new BatchingIterator(new ArrayIterator($array), 2);
        $result = array();
        //when
        foreach ($batchIterator as $key => $value) {
            $result[$key] = $value;
        }
        //then
        $this->assertEquals(array(array(1, 2), array(3)), $result);
    }