Yaffs site version 1.1
[yaffs-website] / vendor / symfony / finder / Tests / Iterator / CustomFilterIteratorTest.php
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
14 use Symfony\Component\Finder\Iterator\CustomFilterIterator;
15
16 class CustomFilterIteratorTest extends IteratorTestCase
17 {
18     /**
19      * @expectedException \InvalidArgumentException
20      */
21     public function testWithInvalidFilter()
22     {
23         new CustomFilterIterator(new Iterator(), array('foo'));
24     }
25
26     /**
27      * @dataProvider getAcceptData
28      */
29     public function testAccept($filters, $expected)
30     {
31         $inner = new Iterator(array('test.php', 'test.py', 'foo.php'));
32
33         $iterator = new CustomFilterIterator($inner, $filters);
34
35         $this->assertIterator($expected, $iterator);
36     }
37
38     public function getAcceptData()
39     {
40         return array(
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()),
44         );
45     }
46 }