Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #14287 [Finder] Removed duplicated toRegex() code (jaytaph)
This PR was merged into the 2.7 branch. Discussion ---------- [Finder] Removed duplicated toRegex() code This patch removes duplicated `toRegex()` code by using the already existing `Glob` class. As this class wasn't unit-tested to begin with, this duplication also makes sure this class is tested properly. | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14075 | License | MIT Commits ------- 6150c3a Removed duplicated toRegex() code
- Loading branch information
Showing
4 changed files
with
35 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?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; | ||
|
||
use Symfony\Component\Finder\Glob; | ||
|
||
class GlobTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
public function testGlobToRegexDelimiters() | ||
{ | ||
$this->assertEquals(Glob::toRegex('.*'), '#^\.[^/]*$#'); | ||
$this->assertEquals(Glob::toRegex('.*', true, true, ''), '^\.[^/]*$'); | ||
$this->assertEquals(Glob::toRegex('.*', true, true, '/'), '/^\.[^/]*$/'); | ||
} | ||
|
||
} |