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\CustomFilterIterator;
16 class CustomFilterIteratorTest extends IteratorTestCase
19 * @expectedException \InvalidArgumentException
21 public function testWithInvalidFilter()
23 new CustomFilterIterator(new Iterator(), array('foo'));
27 * @dataProvider getAcceptData
29 public function testAccept($filters, $expected)
31 $inner = new Iterator(array('test.php', 'test.py', 'foo.php'));
33 $iterator = new CustomFilterIterator($inner, $filters);
35 $this->assertIterator($expected, $iterator);
38 public function getAcceptData()
41 array(array(function (\SplFileInfo $fileinfo) { return false; }), array()),
42 array(array(function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }), array('test.php', 'test.py')),
43 array(array('is_dir'), array()),