TYPO3  7.6
MultiplePcreFilterIteratorTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace Symfony\Component\Finder\Tests\Iterator;
13 
15 
16 class MultiplePcreFilterIteratorTest extends \PHPUnit_Framework_TestCase
17 {
21  public function testIsRegex($string, $isRegex, $message)
22  {
23  $testIterator = new TestMultiplePcreFilterIterator();
24  $this->assertEquals($isRegex, $testIterator->isRegex($string), $message);
25  }
26 
27  public function getIsRegexFixtures()
28  {
29  return array(
30  array('foo', false, 'string'),
31  array(' foo ', false, '" " is not a valid delimiter'),
32  array('\\foo\\', false, '"\\" is not a valid delimiter'),
33  array('afooa', false, '"a" is not a valid delimiter'),
34  array('//', false, 'the pattern should contain at least 1 character'),
35  array('/a/', true, 'valid regex'),
36  array('/foo/', true, 'valid regex'),
37  array('/foo/i', true, 'valid regex with a single modifier'),
38  array('/foo/imsxu', true, 'valid regex with multiple modifiers'),
39  array('#foo#', true, '"#" is a valid delimiter'),
40  array('{foo}', true, '"{,}" is a valid delimiter pair'),
41  array('*foo.*', false, '"*" is not considered as a valid delimiter'),
42  array('?foo.?', false, '"?" is not considered as a valid delimiter'),
43  );
44  }
45 }
46 
48 {
49  public function __construct()
50  {
51  }
52 
53  public function accept()
54  {
55  throw new \BadFunctionCallException('Not implemented');
56  }
57 
58  public function isRegex($str)
59  {
60  return parent::isRegex($str);
61  }
62 
63  public function toRegex($str)
64  {
65  throw new \BadFunctionCallException('Not implemented');
66  }
67 }