Sha256: d98dc3754b4e57854e12e6ffa45a9210fdf7146d697be65e751d6e9f982dc88f

Contents?: true

Size: 1.37 KB

Versions: 18

Compression:

Stored size: 1.37 KB

Contents

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Finder\Tests\Iterator;

use Symfony\Component\Finder\Iterator\FilenameFilterIterator;

class FilenameFilterIteratorTest extends IteratorTestCase
{
    /**
     * @dataProvider getAcceptData
     */
    public function testAccept($matchPatterns, $noMatchPatterns, $expected)
    {
        $inner = new InnerNameIterator(['test.php', 'test.py', 'foo.php']);

        $iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns);

        $this->assertIterator($expected, $iterator);
    }

    public function getAcceptData()
    {
        return [
            [['test.*'], [], ['test.php', 'test.py']],
            [[], ['test.*'], ['foo.php']],
            [['*.php'], ['test.*'], ['foo.php']],
            [['*.php', '*.py'], ['foo.*'], ['test.php', 'test.py']],
            [['/\.php$/'], [], ['test.php', 'foo.php']],
            [[], ['/\.php$/'], ['test.py']],
        ];
    }
}

class InnerNameIterator extends \ArrayIterator
{
    public function current()
    {
        return new \SplFileInfo(parent::current());
    }

    public function getFilename()
    {
        return parent::current();
    }
}

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
dependabot-composer-0.119.0.beta1 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.113.19 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.112.1 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.111.57 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.111.56 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.111.52 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.111.50 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.111.25 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.111.17 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.111.15 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.110.13 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.108.11 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.108.8 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.107.47 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.107.39 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.107.36 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.107.28 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php
dependabot-composer-0.107.14 helpers/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php