@@ -18,7 +18,7 @@ class PathTest extends SapphireTest
1818 #[DataProvider('providerTestJoinPaths ' )]
1919 public function testJoinPaths ($ args , $ expected )
2020 {
21- $ joined = Path::join ($ args );
21+ $ joined = Path::join (... $ args );
2222 $ this ->assertEquals ($ expected , $ joined );
2323 }
2424
@@ -47,10 +47,18 @@ public static function providerTestJoinPaths()
4747 [['' , '/root ' , '/ ' , ' ' , '/ ' , '\\' ], '/root ' ],
4848 [['' , 'root ' , '/ ' , ' ' , '/ ' , '\\' ], 'root ' ],
4949 [['\\' , '' , '/root ' , '/ ' , ' ' , '/ ' , '\\' ], '/root ' ],
50+ [[' one ' , ' ' , 'two ' , null ], 'one/two ' ],
5051 // join blocks of paths
5152 [['/root/dir ' , 'another/path \\to/join ' ], '/root/dir/another/path/to/join ' ],
5253 // Double dot is fine if it's not attempting directory traversal
5354 [['/root/my..name/ ' , 'another/path \\to/join ' ], '/root/my..name/another/path/to/join ' ],
55+ // Don't remove zero
56+ [['0 ' ], '0 ' ],
57+ [[0 ], '0 ' ],
58+ [['1 ' , '0 ' , 'a ' ], '1/0/a ' ],
59+ [[1 , 0 , 'a ' ], '1/0/a ' ],
60+ // first arg is array
61+ [[['one ' , 'two ' , 'three ' ]], 'one/two/three ' ],
5462 ];
5563
5664 // Rewrite tests for other filesystems (output arg only)
0 commit comments