Yaffs site version 1.1
[yaffs-website] / vendor / symfony / finder / Tests / Iterator / ExcludeDirectoryFilterIteratorTest.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\ExcludeDirectoryFilterIterator;
15 use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator;
16
17 class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
18 {
19     /**
20      * @dataProvider getAcceptData
21      */
22     public function testAccept($directories, $expected)
23     {
24         $inner = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
25
26         $iterator = new ExcludeDirectoryFilterIterator($inner, $directories);
27
28         $this->assertIterator($expected, $iterator);
29     }
30
31     public function getAcceptData()
32     {
33         $foo = array(
34             '.bar',
35             '.foo',
36             '.foo/.bar',
37             '.foo/bar',
38             '.git',
39             'test.py',
40             'test.php',
41             'toto',
42             'toto/.git',
43             'foo bar',
44         );
45
46         $fo = array(
47             '.bar',
48             '.foo',
49             '.foo/.bar',
50             '.foo/bar',
51             '.git',
52             'test.py',
53             'foo',
54             'foo/bar.tmp',
55             'test.php',
56             'toto',
57             'toto/.git',
58             'foo bar',
59         );
60
61         $toto = array(
62             '.bar',
63             '.foo',
64             '.foo/.bar',
65             '.foo/bar',
66             '.git',
67             'test.py',
68             'foo',
69             'foo/bar.tmp',
70             'test.php',
71             'foo bar',
72         );
73
74         return array(
75             array(array('foo'), $this->toAbsolute($foo)),
76             array(array('fo'), $this->toAbsolute($fo)),
77             array(array('toto/'), $this->toAbsolute($toto)),
78         );
79     }
80 }