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\SizeRangeFilterIterator;
15 use Symfony\Component\Finder\Comparator\NumberComparator;
17 class SizeRangeFilterIteratorTest extends RealIteratorTestCase
20 * @dataProvider getAcceptData
22 public function testAccept($size, $expected)
24 $inner = new InnerSizeIterator(self::$files);
26 $iterator = new SizeRangeFilterIterator($inner, $size);
28 $this->assertIterator($expected, $iterator);
31 public function getAcceptData()
33 $lessThan1KGreaterThan05K = array(
43 array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)),
48 class InnerSizeIterator extends \ArrayIterator
50 public function current()
52 return new \SplFileInfo(parent::current());
55 public function getFilename()
57 return parent::current();
60 public function isFile()
62 return $this->current()->isFile();
65 public function getSize()
67 return $this->current()->getSize();