@@ -31,28 +31,32 @@ public function testMakeRelative($absolutePath, $basePath, $relativePath)
31
31
32
32
$ relative = Url::makeRelative ($ host .$ absolutePath , $ host .$ basePath );
33
33
$ this ->assertSame ($ relativePath , $ relative );
34
+ $ relative = Url::makeRelative ($ absolutePath , $ host .$ basePath );
35
+ $ this ->assertSame ($ relativePath , $ relative );
34
36
}
35
37
36
38
/**
37
- * @dataProvider provideMakeRelativeTests
39
+ * @dataProvider provideMakeRelativeIsAlreadyRelativeTests
38
40
* @covers Webmozart\PathUtil\Url
39
41
*/
40
- public function testMakeRelativeWithFullUrl ($ absolutePath , $ basePath , $ relativePath )
42
+ public function testMakeRelativeIsAlreadyRelative ($ absolutePath , $ basePath , $ relativePath )
41
43
{
42
- $ host = 'ftp ://user:password@ example.com:8080 ' ;
44
+ $ host = 'http ://example.com ' ;
43
45
44
- $ relative = Url::makeRelative ($ host . $ absolutePath , $ host .$ basePath );
46
+ $ relative = Url::makeRelative ($ absolutePath , $ host .$ basePath );
45
47
$ this ->assertSame ($ relativePath , $ relative );
46
48
}
47
49
48
50
/**
49
- * @expectedException \InvalidArgumentException
50
- * @expectedExceptionMessage "/webmozart/puli/css/style.css" is not an absolute Url.
51
+ * @dataProvider provideMakeRelativeTests
51
52
* @covers Webmozart\PathUtil\Url
52
53
*/
53
- public function testMakeRelativeWithoutFullUrl ( )
54
+ public function testMakeRelativeWithFullUrl ( $ absolutePath , $ basePath , $ relativePath )
54
55
{
55
- Url::makeRelative ('/webmozart/puli/css/style.css ' , 'http://example.com/webmozart/puli ' );
56
+ $ host = 'ftp://user:password@example.com:8080 ' ;
57
+
58
+ $ relative = Url::makeRelative ($ host .$ absolutePath , $ host .$ basePath );
59
+ $ this ->assertSame ($ relativePath , $ relative );
56
60
}
57
61
58
62
/**
@@ -149,6 +153,18 @@ public function provideMakeRelativeTests()
149
153
150
154
// second argument shorter than first
151
155
array ('/webmozart/puli ' , '/css ' , '../webmozart/puli ' ),
156
+
157
+ array ('' , '' , '' ),
158
+ );
159
+ }
160
+
161
+ public function provideMakeRelativeIsAlreadyRelativeTests ()
162
+ {
163
+ return array (
164
+ array ('css/style.css ' , '/webmozart/puli ' , 'css/style.css ' ),
165
+ array ('css/style.css ' , '' , 'css/style.css ' ),
166
+ array ('css/../style.css ' , '' , 'style.css ' ),
167
+ array ('css/./style.css ' , '' , 'css/style.css ' ),
152
168
);
153
169
}
154
170
}
0 commit comments