1
0
Fork 0

Updated the regexp and added an other test case for sub dirs

pull/2769/head
Sandy Pleyte 2014-02-28 16:30:55 +01:00
parent 1d51e54a31
commit 3e161e8ea9
2 changed files with 10 additions and 5 deletions

View File

@ -137,7 +137,7 @@ abstract class BaseExcludeFilter
$pattern .= '^/'; $pattern .= '^/';
$rule = substr($rule, 1); $rule = substr($rule, 1);
} elseif (strlen($rule) - 1 === strpos($rule, '/')) { } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
$pattern .= '^/'; $pattern .= '/';
$rule = substr($rule, 0, -1); $rule = substr($rule, 0, -1);
} elseif (false === strpos($rule, '/')) { } elseif (false === strpos($rule, '/')) {
$pattern .= '/'; $pattern .= '/';

View File

@ -58,10 +58,12 @@ class ArchivableFilesFinderTest extends \PHPUnit_Framework_TestCase
'D/prefixD', 'D/prefixD',
'D/prefixE', 'D/prefixE',
'D/prefixF', 'D/prefixF',
'/E/subtestA.foo', 'E/subtestA.foo',
'/F/subtestA.foo', 'F/subtestA.foo',
'/G/subtestA.foo', 'G/subtestA.foo',
'/H/subtestA.foo', 'H/subtestA.foo',
'I/J/subtestA.foo',
'K/dirJ/subtestA.foo',
'toplevelA.foo', 'toplevelA.foo',
'toplevelB.foo', 'toplevelB.foo',
'prefixA.foo', 'prefixA.foo',
@ -127,6 +129,8 @@ class ArchivableFilesFinderTest extends \PHPUnit_Framework_TestCase
'/F/subtestA.foo', '/F/subtestA.foo',
'/G/subtestA.foo', '/G/subtestA.foo',
'/H/subtestA.foo', '/H/subtestA.foo',
'/I/J/subtestA.foo',
'/K/dirJ/subtestA.foo',
'/parameters.yml', '/parameters.yml',
'/parameters.yml.dist', '/parameters.yml.dist',
'/prefixB.foo', '/prefixB.foo',
@ -164,6 +168,7 @@ class ArchivableFilesFinderTest extends \PHPUnit_Framework_TestCase
'F/', 'F/',
'G/*', 'G/*',
'H/**', 'H/**',
'J/',
'parameters.yml', 'parameters.yml',
'\!important!.txt' '\!important!.txt'
))); )));