File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
test/phpunit/Path/FileMatch Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,16 @@ class MagicFileMatch extends FileMatch {
1010 ];
1111
1212 public function matches (string $ uriPath ):bool {
13- $ uriPath = trim ($ uriPath , "/ " );
13+ $ uriPath = trim ($ uriPath , "/ " ) . " / " ;
1414 $ uriPathParts = explode ("/ " , $ uriPath );
1515
1616 $ filePathTrimmed = $ this ->getTrimmedFilePath ();
1717 $ uriPathParts = $ this ->filterDynamicPathParts ($ filePathTrimmed , $ uriPathParts );
1818
1919 $ searchDir = "" ;
2020 foreach ($ uriPathParts as $ pathPart ) {
21+
22+
2123 foreach (self ::MAGIC_FILENAME_ARRAY as $ magicFilename ) {
2224 $ searchFilepath = trim ("$ searchDir/ $ magicFilename " , "/ " );
2325 if ($ searchFilepath === $ filePathTrimmed ) {
Original file line number Diff line number Diff line change @@ -37,6 +37,14 @@ public function testMatches_parentDir():void {
3737 self ::assertTrue ($ sut ->matches ("/something/nested " ));
3838 }
3939
40+ public function testMatches_parentParentDir ():void {
41+ $ sut = new MagicFileMatch (
42+ "basedir/_common.php " ,
43+ "basedir "
44+ );
45+ self ::assertTrue ($ sut ->matches ("/something/deeply/nested " ));
46+ }
47+
4048 public function testMatches_ancestorDir ():void {
4149 $ sut = new MagicFileMatch (
4250 "basedir/something/_common.php " ,
@@ -52,4 +60,12 @@ public function testMatches_dynamicDir():void {
5260 );
5361 self ::assertTrue ($ sut ->matches ("/something/this-is-dynamic/test " ));
5462 }
63+
64+ public function testMatches_dynamicInDir ():void {
65+ $ sut = new MagicFileMatch (
66+ "basedir/something/@dynamic/_common.php " ,
67+ "basedir "
68+ );
69+ self ::assertTrue ($ sut ->matches ("/something/this-is-dynamic " ));
70+ }
5571}
You can’t perform that action at this time.
0 commit comments