Skip to content

Commit 09e2df5

Browse files
Add more tests for relative path
1 parent 8115c5c commit 09e2df5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Url.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static function split($url)
100100
} else {
101101
// No path, only host
102102
$host = $url;
103-
$url = '';
103+
$url = '/';
104104
}
105105

106106
// At this point, we have $scheme, $host and $path

tests/UrlTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,15 @@ public function provideMakeRelativeIsAlreadyRelativeTests()
165165
array('css/style.css', '', 'css/style.css'),
166166
array('css/../style.css', '', 'style.css'),
167167
array('css/./style.css', '', 'css/style.css'),
168+
array('../style.css', '/', 'style.css'),
169+
array('./style.css', '/', 'style.css'),
170+
array('../../style.css', '/', 'style.css'),
171+
array('../../style.css', '', 'style.css'),
172+
array('./style.css', '', 'style.css'),
173+
array('../style.css', '', 'style.css'),
174+
array('./../style.css', '', 'style.css'),
175+
array('css/./../style.css', '', 'style.css'),
176+
array('css//style.css', '', 'css/style.css'),
168177
);
169178
}
170179
}

0 commit comments

Comments
 (0)