TYPO3  7.6
DateRangeFilterIteratorTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace Symfony\Component\Finder\Tests\Iterator;
13 
16 
18 {
22  public function testAccept($size, $expected)
23  {
24  $files = self::$files;
25  $files[] = self::toAbsolute('doesnotexist');
26  $inner = new Iterator($files);
27 
28  $iterator = new DateRangeFilterIterator($inner, $size);
29 
30  $this->assertIterator($expected, $iterator);
31  }
32 
33  public function getAcceptData()
34  {
35  $since20YearsAgo = array(
36  '.git',
37  'test.py',
38  'foo',
39  'foo/bar.tmp',
40  'test.php',
41  'toto',
42  '.bar',
43  '.foo',
44  '.foo/.bar',
45  'foo bar',
46  '.foo/bar',
47  );
48 
49  $since2MonthsAgo = array(
50  '.git',
51  'test.py',
52  'foo',
53  'toto',
54  '.bar',
55  '.foo',
56  '.foo/.bar',
57  'foo bar',
58  '.foo/bar',
59  );
60 
61  $untilLastMonth = array(
62  'foo/bar.tmp',
63  'test.php',
64  );
65 
66  return array(
67  array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)),
68  array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)),
69  array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)),
70  );
71  }
72 }