File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 22namespace Gt \Routing ;
33
44use Countable ;
5+ use Gt \Routing \Path \FileMatch \MagicFileMatch ;
56use Iterator ;
67
78/** @implements Iterator<int, string> */
@@ -36,7 +37,8 @@ public function remove(string $path):void {
3637 public function containsDistinctFile ():bool {
3738 foreach ($ this ->pathList as $ path ) {
3839 $ fileName = pathinfo ($ path , PATHINFO_FILENAME );
39- if ($ fileName [0 ] !== "_ " ) {
40+ if (!str_starts_with ($ fileName , "_ " )
41+ || !in_array ($ fileName , MagicFileMatch::MAGIC_FILENAME_ARRAY )) {
4042 return true ;
4143 }
4244 }
Original file line number Diff line number Diff line change @@ -92,4 +92,18 @@ public function testContainsDistinctFile():void {
9292
9393 self ::assertTrue ($ sut ->containsDistinctFile ());
9494 }
95+
96+ public function testContainsDistinctFile_magicFilename ():void {
97+ $ pathList = [
98+ "/var/www/_header.html " ,
99+ "/var/www/_new.html " ,
100+ "/var/www/_footer.html " ,
101+ ];
102+ $ sut = new Assembly ();
103+ foreach ($ pathList as $ path ) {
104+ $ sut ->add ($ path );
105+ }
106+
107+ self ::assertTrue ($ sut ->containsDistinctFile ());
108+ }
95109}
You can’t perform that action at this time.
0 commit comments