You are here

protected function IteratorTestCase::assertOrderedIteratorForGroups in Database Sanitize 7

Same as assertOrderedIterator, but checks the order of groups of array elements.

Parameters

array $expected - an array of arrays. For any two subarrays: $a and $b such that $a goes before $b in $expected, the method asserts that any element of $a goes before any element of $b in the sequence generated by $iterator @param \Traversable $iterator

1 call to IteratorTestCase::assertOrderedIteratorForGroups()
SortableIteratorTest::testAccept in vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php
@dataProvider getAcceptData

File

vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php, line 49

Class

IteratorTestCase

Namespace

Symfony\Component\Finder\Tests\Iterator

Code

protected function assertOrderedIteratorForGroups($expected, \Traversable $iterator) {
  $values = array_values(array_map(function (\SplFileInfo $fileinfo) {
    return $fileinfo
      ->getPathname();
  }, iterator_to_array($iterator)));
  foreach ($expected as $subarray) {
    $temp = array();
    while (\count($values) && \count($temp) < \count($subarray)) {
      $temp[] = array_shift($values);
    }
    sort($temp);
    sort($subarray);
    $this
      ->assertEquals($subarray, $temp);
  }
}