use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
class DepthRangeFilterIteratorTest extends RealIteratorTestCase
{ /**
* @dataProvider getAcceptData
*/
public function testAccept($minDepth,
$maxDepth,
$expected) { $inner =
new \
RecursiveIteratorIterator(new \
RecursiveDirectoryIterator($this->
toAbsolute(), \FilesystemIterator::SKIP_DOTS
), \RecursiveIteratorIterator::SELF_FIRST
);
$iterator =
new DepthRangeFilterIterator($inner,
$minDepth,
$maxDepth);
$actual =
array_keys(iterator_to_array($iterator));
sort($expected);
sort($actual);
$this->
assertEquals($expected,
$actual);
} public static function getAcceptData() { $lessThan1 =
[ '.git',