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\FileTypeFilterIterator;
16 class FileTypeFilterIteratorTest extends RealIteratorTestCase
19 * @dataProvider getAcceptData
21 public function testAccept($mode, $expected)
23 $inner = new InnerTypeIterator(self::$files);
25 $iterator = new FileTypeFilterIterator($inner, $mode);
27 $this->assertIterator($expected, $iterator);
30 public function getAcceptData()
42 $onlyDirectories = array(
51 array(FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)),
52 array(FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)),
57 class InnerTypeIterator extends \ArrayIterator
59 public function current()
61 return new \SplFileInfo(parent::current());
64 public function isFile()
66 return $this->current()->isFile();
69 public function isDir()
71 return $this->current()->isDir();