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\DateRangeFilterIterator;
15 use Symfony\Component\Finder\Comparator\DateComparator;
17 class DateRangeFilterIteratorTest extends RealIteratorTestCase
20 * @dataProvider getAcceptData
22 public function testAccept($size, $expected)
24 $files = self::$files;
25 $files[] = self::toAbsolute('doesnotexist');
26 $inner = new Iterator($files);
28 $iterator = new DateRangeFilterIterator($inner, $size);
30 $this->assertIterator($expected, $iterator);
33 public function getAcceptData()
35 $since20YearsAgo = array(
50 $since2MonthsAgo = array(
63 $untilLastMonth = array(
69 array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)),
70 array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)),
71 array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)),