TYPO3  7.6
ExpressionTest.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 
13 
15 
16 class ExpressionTest extends \PHPUnit_Framework_TestCase
17 {
21  public function testTypeGuesser($expr, $type)
22  {
23  $this->assertEquals($type, Expression::create($expr)->getType());
24  }
25 
29  public function testCaseSensitive($expr, $isCaseSensitive)
30  {
31  $this->assertEquals($isCaseSensitive, Expression::create($expr)->isCaseSensitive());
32  }
33 
37  public function testRegexRendering($expr, $body)
38  {
39  $this->assertEquals($body, Expression::create($expr)->renderPattern());
40  }
41 
42  public function getTypeGuesserData()
43  {
44  return array(
45  array('{foo}', Expression::TYPE_REGEX),
46  array('/foo/', Expression::TYPE_REGEX),
47  array('foo', Expression::TYPE_GLOB),
48  array('foo*', Expression::TYPE_GLOB),
49  );
50  }
51 
52  public function getCaseSensitiveData()
53  {
54  return array(
55  array('{foo}m', true),
56  array('/foo/i', false),
57  array('foo*', true),
58  );
59  }
60 
61  public function getRegexRenderingData()
62  {
63  return array(
64  array('{foo}m', 'foo'),
65  array('/foo/i', 'foo'),
66  );
67  }
68 }