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 2
2
namespace Gt \Routing ;
3
3
4
4
use Countable ;
5
+ use Gt \Routing \Path \FileMatch \MagicFileMatch ;
5
6
use Iterator ;
6
7
7
8
/** @implements Iterator<int, string> */
@@ -36,7 +37,8 @@ public function remove(string $path):void {
36
37
public function containsDistinctFile ():bool {
37
38
foreach ($ this ->pathList as $ path ) {
38
39
$ fileName = pathinfo ($ path , PATHINFO_FILENAME );
39
- if ($ fileName [0 ] !== "_ " ) {
40
+ if (!str_starts_with ($ fileName , "_ " )
41
+ || !in_array ($ fileName , MagicFileMatch::MAGIC_FILENAME_ARRAY )) {
40
42
return true ;
41
43
}
42
44
}
Original file line number Diff line number Diff line change @@ -92,4 +92,18 @@ public function testContainsDistinctFile():void {
92
92
93
93
self ::assertTrue ($ sut ->containsDistinctFile ());
94
94
}
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
+ }
95
109
}
You can’t perform that action at this time.
0 commit comments