TYPO3  7.6
SizeRangeFilterIteratorTest.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  $inner = new InnerSizeIterator(self::$files);
25 
26  $iterator = new SizeRangeFilterIterator($inner, $size);
27 
28  $this->assertIterator($expected, $iterator);
29  }
30 
31  public function getAcceptData()
32  {
33  $lessThan1KGreaterThan05K = array(
34  '.foo',
35  '.git',
36  'foo',
37  'test.php',
38  'toto',
39  );
40 
41  return array(
42  array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)),
43  );
44  }
45 }
46 
47 class InnerSizeIterator extends \ArrayIterator
48 {
49  public function current()
50  {
51  return new \SplFileInfo(parent::current());
52  }
53 
54  public function getFilename()
55  {
56  return parent::current();
57  }
58 
59  public function isFile()
60  {
61  return $this->current()->isFile();
62  }
63 
64  public function getSize()
65  {
66  return $this->current()->getSize();
67  }
68 }