| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 | 
							- <?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\Expression;
 
- use PHPUnit\Framework\TestCase;
 
- use Symfony\Component\Finder\Expression\Expression;
 
- /**
 
-  * @group legacy
 
-  */
 
- class RegexTest extends TestCase
 
- {
 
-     /**
 
-      * @dataProvider getHasFlagsData
 
-      */
 
-     public function testHasFlags($regex, $start, $end)
 
-     {
 
-         $expr = new Expression($regex);
 
-         $this->assertEquals($start, $expr->getRegex()->hasStartFlag());
 
-         $this->assertEquals($end, $expr->getRegex()->hasEndFlag());
 
-     }
 
-     /**
 
-      * @dataProvider getHasJokersData
 
-      */
 
-     public function testHasJokers($regex, $start, $end)
 
-     {
 
-         $expr = new Expression($regex);
 
-         $this->assertEquals($start, $expr->getRegex()->hasStartJoker());
 
-         $this->assertEquals($end, $expr->getRegex()->hasEndJoker());
 
-     }
 
-     /**
 
-      * @dataProvider getSetFlagsData
 
-      */
 
-     public function testSetFlags($regex, $start, $end, $expected)
 
-     {
 
-         $expr = new Expression($regex);
 
-         $expr->getRegex()->setStartFlag($start)->setEndFlag($end);
 
-         $this->assertEquals($expected, $expr->render());
 
-     }
 
-     /**
 
-      * @dataProvider getSetJokersData
 
-      */
 
-     public function testSetJokers($regex, $start, $end, $expected)
 
-     {
 
-         $expr = new Expression($regex);
 
-         $expr->getRegex()->setStartJoker($start)->setEndJoker($end);
 
-         $this->assertEquals($expected, $expr->render());
 
-     }
 
-     public function testOptions()
 
-     {
 
-         $expr = new Expression('~abc~is');
 
-         $expr->getRegex()->removeOption('i')->addOption('m');
 
-         $this->assertEquals('~abc~sm', $expr->render());
 
-     }
 
-     public function testMixFlagsAndJokers()
 
-     {
 
-         $expr = new Expression('~^.*abc.*$~is');
 
-         $expr->getRegex()->setStartFlag(false)->setEndFlag(false)->setStartJoker(false)->setEndJoker(false);
 
-         $this->assertEquals('~abc~is', $expr->render());
 
-         $expr->getRegex()->setStartFlag(true)->setEndFlag(true)->setStartJoker(true)->setEndJoker(true);
 
-         $this->assertEquals('~^.*abc.*$~is', $expr->render());
 
-     }
 
-     /**
 
-      * @dataProvider getReplaceJokersTestData
 
-      */
 
-     public function testReplaceJokers($regex, $expected)
 
-     {
 
-         $expr = new Expression($regex);
 
-         $expr = $expr->getRegex()->replaceJokers('@');
 
-         $this->assertEquals($expected, $expr->renderPattern());
 
-     }
 
-     public function getHasFlagsData()
 
-     {
 
-         return array(
 
-             array('~^abc~', true, false),
 
-             array('~abc$~', false, true),
 
-             array('~abc~', false, false),
 
-             array('~^abc$~', true, true),
 
-             array('~^abc\\$~', true, false),
 
-         );
 
-     }
 
-     public function getHasJokersData()
 
-     {
 
-         return array(
 
-             array('~.*abc~', true, false),
 
-             array('~abc.*~', false, true),
 
-             array('~abc~', false, false),
 
-             array('~.*abc.*~', true, true),
 
-             array('~.*abc\\.*~', true, false),
 
-         );
 
-     }
 
-     public function getSetFlagsData()
 
-     {
 
-         return array(
 
-             array('~abc~', true, false, '~^abc~'),
 
-             array('~abc~', false, true, '~abc$~'),
 
-             array('~abc~', false, false, '~abc~'),
 
-             array('~abc~', true, true, '~^abc$~'),
 
-         );
 
-     }
 
-     public function getSetJokersData()
 
-     {
 
-         return array(
 
-             array('~abc~', true, false, '~.*abc~'),
 
-             array('~abc~', false, true, '~abc.*~'),
 
-             array('~abc~', false, false, '~abc~'),
 
-             array('~abc~', true, true, '~.*abc.*~'),
 
-         );
 
-     }
 
-     public function getReplaceJokersTestData()
 
-     {
 
-         return array(
 
-             array('~.abc~', '@abc'),
 
-             array('~\\.abc~', '\\.abc'),
 
-             array('~\\\\.abc~', '\\\\@abc'),
 
-             array('~\\\\\\.abc~', '\\\\\\.abc'),
 
-         );
 
-     }
 
- }
 
 
  |