Yaffs site version 1.1
[yaffs-website] / vendor / symfony / finder / Tests / Expression / ExpressionTest.php
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\Expression;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Finder\Expression\Expression;
16
17 /**
18  * @group legacy
19  */
20 class ExpressionTest extends TestCase
21 {
22     /**
23      * @dataProvider getTypeGuesserData
24      */
25     public function testTypeGuesser($expr, $type)
26     {
27         $this->assertEquals($type, Expression::create($expr)->getType());
28     }
29
30     /**
31      * @dataProvider getCaseSensitiveData
32      */
33     public function testCaseSensitive($expr, $isCaseSensitive)
34     {
35         $this->assertEquals($isCaseSensitive, Expression::create($expr)->isCaseSensitive());
36     }
37
38     /**
39      * @dataProvider getRegexRenderingData
40      */
41     public function testRegexRendering($expr, $body)
42     {
43         $this->assertEquals($body, Expression::create($expr)->renderPattern());
44     }
45
46     public function getTypeGuesserData()
47     {
48         return array(
49             array('{foo}', Expression::TYPE_REGEX),
50             array('/foo/', Expression::TYPE_REGEX),
51             array('foo',   Expression::TYPE_GLOB),
52             array('foo*',  Expression::TYPE_GLOB),
53         );
54     }
55
56     public function getCaseSensitiveData()
57     {
58         return array(
59             array('{foo}m', true),
60             array('/foo/i', false),
61             array('foo*',   true),
62         );
63     }
64
65     public function getRegexRenderingData()
66     {
67         return array(
68             array('{foo}m', 'foo'),
69             array('/foo/i', 'foo'),
70         );
71     }
72 }