@@ -28,12 +28,38 @@ public function setUp() {
2828
2929 /**
3030 * Make sure the rel_path function makes relative paths.
31+ * @dataProvider data_rel_path
3132 */
32- public function test_rel_path () {
33- $ abspath1 = ' /a/random/path/to/a/place ' ;
34- $ abspath2 = ' /a/random/path/to/another/place ' ;
33+ public function test_rel_path ( $ path1 , $ path2 , $ sep , $ expected ) {
34+ $ this -> assertEquals ( Util \rel_path ( $ path1 , $ path2 , $ sep ), $ expected ) ;
35+ }
3536
36- $ calculatedRel = Util \rel_path ( $ abspath1 , $ abspath2 , '/ ' );
37- $ this ->assertEquals ( $ calculatedRel , '../../another/place ' );
37+ public function data_rel_path (){
38+ return array (
39+ array (
40+ '/a/random/path/to/a/place ' ,
41+ '/a/random/path/to/another/place ' ,
42+ '/ ' ,
43+ '../../another/place ' ,
44+ ),
45+ array (
46+ '/somewhere/over/the/rainbow ' ,
47+ '/somewhere/over/the/rainbow/bluebirds/sing ' ,
48+ '/ ' ,
49+ 'bluebirds/sing ' ,
50+ ),
51+ array (
52+ '/just/some/test ' ,
53+ '/just\some\mixed\slash\example ' ,
54+ '/ ' ,
55+ '../mixed/slash/example ' ,
56+ ),
57+ array (
58+ '/testing/inverse/directory/separators ' ,
59+ '/unix/to/windows ' ,
60+ '\\' ,
61+ '..\..\..\..\unix\to\windows ' ,
62+ ),
63+ );
3864 }
3965}
0 commit comments