4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Finder\Tests\Iterator;
14 use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
16 class DepthRangeFilterIteratorTest extends RealIteratorTestCase
19 * @dataProvider getAcceptData
21 public function testAccept($minDepth, $maxDepth, $expected)
23 $inner = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
25 $iterator = new DepthRangeFilterIterator($inner, $minDepth, $maxDepth);
27 $actual = array_keys(iterator_to_array($iterator));
30 $this->assertEquals($expected, $actual);
33 public function getAcceptData()
46 $lessThanOrEqualTo1 = array(
61 $graterThanOrEqualTo1 = array(
76 array(0, 0, $this->toAbsolute($lessThan1)),
77 array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)),
78 array(2, PHP_INT_MAX, array()),
79 array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)),
80 array(1, 1, $this->toAbsolute($equalTo1)),