8000 [Finder] add case insensitive name and iname function by debreczeniandras · Pull Request #1 · jschaedl/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Finder] add case insensitive name and iname function #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Finder] Restore folder permissions after failed assertions in Finder…
…Test suite

add CaseInsensitiveFilenameFilterIteratorTest
  • Loading branch information
Andras Debreczeni committed Sep 24, 2018
commit 7246f4f9a992316b537b6200970a7f3f0d5023c0
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?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 CaseInsens 8E35 itiveFilenameFilterIteratorTest extends IteratorTestCase
{
/**
* @dataProvider getAcceptData
*/
public function testAccept($matchPatterns, $noMatchPatterns, $expected)
{
$inner = new InnerCaseInsensitiveFilenameFilterIterator(array('test.php', 'test.PY', 'foo.php', 'baz.PHP'));

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

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

public function getAcceptData()
{
return array(
array(array('test.*'), array(), array('test.php', 'test.PY')),
array(array(), array('test.*'), array('foo.php', 'baz.PHP')),
array(array('*.php'), array('test.*'), array('foo.php', 'baz.PHP')),
array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.PY', 'baz.PHP')),
array(array('/\.php$/'), array(), array('test.php', 'foo.php', 'baz.PHP')),
array(array('/\.php$/i'), array(), array('test.php', 'foo.php', 'baz.PHP')),
array(array(), array('/\.php$/'), array('test.PY')),
);
}
}

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

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