@@ -58,4 +58,38 @@ public function testGlobToRegexDoubleStarNonStrictDots()
5858
5959 $ this ->assertSame (array ('.dot/b/c.neon ' , '.dot/b/d.neon ' , 'one/b/c.neon ' , 'one/b/d.neon ' ), $ match );
6060 }
61+
62+ public function testGlobToRegexDoubleStarWithoutLeadingSlash ()
63+ {
64+ $ finder = new Finder ();
65+ $ finder ->ignoreDotFiles (false );
66+ $ regex = Glob::toRegex ('/Fixtures/one/** ' );
67+
68+ foreach ($ finder ->in (__DIR__ ) as $ k => $ v ) {
69+ $ k = str_replace (DIRECTORY_SEPARATOR , '/ ' , $ k );
70+ if (preg_match ($ regex , substr ($ k , strlen (__DIR__ )))) {
71+ $ match [] = substr ($ k , 10 + strlen (__DIR__ ));
72+ }
73+ }
74+ sort ($ match );
75+
76+ $ this ->assertSame (array ('one/a ' , 'one/b ' , 'one/b/c.neon ' , 'one/b/d.neon ' ), $ match );
77+ }
78+
79+ public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot ()
80+ {
81+ $ finder = new Finder ();
82+ $ finder ->ignoreDotFiles (false );
83+ $ regex = Glob::toRegex ('/Fixtures/one/** ' , false );
84+
85+ foreach ($ finder ->in (__DIR__ ) as $ k => $ v ) {
86+ $ k = str_replace (DIRECTORY_SEPARATOR , '/ ' , $ k );
87+ if (preg_match ($ regex , substr ($ k , strlen (__DIR__ )))) {
88+ $ match [] = substr ($ k , 10 + strlen (__DIR__ ));
89+ }
90+ }
91+ sort ($ match );
92+
93+ $ this ->assertSame (array ('one/.dot ' , 'one/a ' , 'one/b ' , 'one/b/c.neon ' , 'one/b/d.neon ' ), $ match );
94+ }
6195}
0 commit comments