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\FilenameFilterIterator;
16 class FilenameFilterIteratorTest extends IteratorTestCase
19 * @dataProvider getAcceptData
21 public function testAccept($matchPatterns, $noMatchPatterns, $expected)
23 $inner = new InnerNameIterator(array('test.php', 'test.py', 'foo.php'));
25 $iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns);
27 $this->assertIterator($expected, $iterator);
30 public function getAcceptData()
33 array(array('test.*'), array(), array('test.php', 'test.py')),
34 array(array(), array('test.*'), array('foo.php')),
35 array(array('*.php'), array('test.*'), array('foo.php')),
36 array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.py')),
37 array(array('/\.php$/'), array(), array('test.php', 'foo.php')),
38 array(array(), array('/\.php$/'), array('test.py')),
43 class InnerNameIterator extends \ArrayIterator
45 public function current()
47 return new \SplFileInfo(parent::current());
50 public function getFilename()
52 return parent::current();