assertSame(ArrayUtil::min($array), $min); $this->assertSame(ArrayUtil::max($array), $max); } public function getIterableData(): array { return [ 'name' => 'item', 'children' => [ 0 => [ 'name' => 'price', 'children' => [ 0 => [ 'type' => 'xs:decimal', 'name' => 'without_vat', 'documentation' => 'Cena produktu bez DPH. Je-li produkt ve slevě, tak po započtení slevy.', ], 1 => [ 'type' => 'xs:decimal', 'name' => 'with_vat', 'documentation' => 'Koncová cena produktu s DPH (prodejní cena na shopu). Je-li produkt ve slevě, pak cena po započtení slevy.', ], ], 'type' => 'priceType', ], 1 => [ 'name' => 'set', 'children' => [ 0 => [ 'type' => 'xs:string', 'name' => 'content', 'minOccurs' => '0', ], ], 'type' => 'setType', 'minOccurs' => '0', ], 2 => [ 'name' => 'product', 'children' => [ 0 => [ 'type' => 'xs:string', 'name' => 'title', 'documentation' => 'Název produktu z eshopu (co je uvedeno v H1).', ], ], 'type' => 'productType', ], 3 => [ 'name' => 'brand', 'children' => [ 0 => [ 'type' => 'xs:string', 'name' => 'title', 'documentation' => 'Název značky, jak je na webu včetně spec zanků a kapitalizace.', ], 2 => [ 'type' => 'xs:string', 'name' => 'url', 'documentation' => 'url značky', ], ], 'type' => 'brandType', ], 4 => [ 'name' => 'serie', 'children' => [ 0 => [ 'type' => 'xs:string', 'name' => 'title', 'documentation' => 'Název modelové řady, jak je na webu včetně spec zanků a kapitalizace.', ], ], 'type' => 'serieType', ], ], ]; } public function testIterableChunkSingleElementInChunk(): void { $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($this->getIterableData())); $chunks = iterator_to_array(ArrayUtil::iterableChunk($iterator, 3)); $this->assertTrue(count(array_pop($chunks)) <= 3); foreach ($chunks as $chunk) { $this->assertCount(3, $chunk); } } }