CustomFilterIterator example



namespace Symfony\Component\Finder\Tests\Iterator;

use Symfony\Component\Finder\Iterator\CustomFilterIterator;

class CustomFilterIteratorTest extends IteratorTestCase
{
    public function testWithInvalidFilter()
    {
        $this->expectException(\InvalidArgumentException::class);
        new CustomFilterIterator(new Iterator()['foo']);
    }

    /** * @dataProvider getAcceptData */
    public function testAccept($filters$expected)
    {
        $inner = new Iterator(['test.php', 'test.py', 'foo.php']);

        $iterator = new CustomFilterIterator($inner$filters);

        


        if ($this->sizes) {
            $iterator = new Iterator\SizeRangeFilterIterator($iterator$this->sizes);
        }

        if ($this->dates) {
            $iterator = new Iterator\DateRangeFilterIterator($iterator$this->dates);
        }

        if ($this->filters) {
            $iterator = new Iterator\CustomFilterIterator($iterator$this->filters);
        }

        if ($this->paths || $notPaths) {
            $iterator = new Iterator\PathFilterIterator($iterator$this->paths, $notPaths);
        }

        if (static::IGNORE_VCS_IGNORED_FILES === (static::IGNORE_VCS_IGNORED_FILES & $this->ignore)) {
            $iterator = new Iterator\VcsIgnoredFilterIterator($iterator$dir);
        }

        return $iterator;
    }
Home | Imprint | This part of the site doesn't use cookies.