TestMultiplePcreFilterIterator example

use PHPUnit\Framework\TestCase;
use Symfony\Component\Finder\Iterator\MultiplePcreFilterIterator;

class MultiplePcreFilterIteratorTest extends TestCase
{
    /** * @dataProvider getIsRegexFixtures */
    public function testIsRegex($string$isRegex$message)
    {
        $testIterator = new TestMultiplePcreFilterIterator();
        $this->assertEquals($isRegex$testIterator->isRegex($string)$message);
    }

    public static function getIsRegexFixtures()
    {
        yield ['foo', false, 'string'];
        yield [' foo ', false, '" " is not a valid delimiter'];
        yield ['\\foo\\', false, '"\\" is not a valid delimiter'];
        yield ['afooa', false, '"a" is not a valid delimiter'];
        yield ['//', false, 'the pattern should contain at least 1 character'];
        yield ['/a/', true, 'valid regex'];
        
Home | Imprint | This part of the site doesn't use cookies.