@@ -153,7 +153,6 @@ public function testUriStringAbsolute()
153153
154154 Services::injectMock ('request ' , $ request );
155155
156- $ url = current_url ();
157156 $ this ->assertEquals ('/assets/image.jpg ' , uri_string ());
158157 }
159158
@@ -167,7 +166,6 @@ public function testUriStringRelative()
167166
168167 Services::injectMock ('request ' , $ request );
169168
170- $ url = current_url ();
171169 $ this ->assertEquals ('assets/image.jpg ' , uri_string (true ));
172170 }
173171
@@ -182,7 +180,6 @@ public function testUriStringNoTrailingSlashAbsolute()
182180
183181 Services::injectMock ('request ' , $ request );
184182
185- $ url = current_url ();
186183 $ this ->assertEquals ('/assets/image.jpg ' , uri_string ());
187184 }
188185
@@ -197,7 +194,6 @@ public function testUriStringNoTrailingSlashRelative()
197194
198195 Services::injectMock ('request ' , $ request );
199196
200- $ url = current_url ();
201197 $ this ->assertEquals ('assets/image.jpg ' , uri_string (true ));
202198 }
203199
@@ -208,7 +204,6 @@ public function testUriStringEmptyAbsolute()
208204
209205 Services::injectMock ('request ' , $ request );
210206
211- $ url = current_url ();
212207 $ this ->assertEquals ('/ ' , uri_string ());
213208 }
214209
@@ -219,7 +214,6 @@ public function testUriStringEmptyRelative()
219214
220215 Services::injectMock ('request ' , $ request );
221216
222- $ url = current_url ();
223217 $ this ->assertEquals ('' , uri_string (true ));
224218 }
225219
@@ -234,23 +228,21 @@ public function testUriStringSubfolderAbsolute()
234228
235229 Services::injectMock ('request ' , $ request );
236230
237- $ url = current_url ();
238231 $ this ->assertEquals ('/subfolder/assets/image.jpg ' , uri_string ());
239232 }
240233
241234 public function testUriStringSubfolderRelative ()
242235 {
243236 $ _SERVER ['HTTP_HOST ' ] = 'example.com ' ;
244- $ _SERVER ['REQUEST_URI ' ] = '/assets/image.jpg ' ;
245237 $ _SERVER ['REQUEST_URI ' ] = '/subfolder/assets/image.jpg ' ;
238+ $ _SERVER ['SCRIPT_NAME ' ] = '/subfolder/index.php ' ;
246239
247240 $ this ->config ->baseURL = 'http://example.com/subfolder/ ' ;
248241 $ request = Services::request ($ this ->config );
249242 $ request ->uri = new URI ('http://example.com/subfolder/assets/image.jpg ' );
250243
251244 Services::injectMock ('request ' , $ request );
252245
253- $ url = current_url ();
254246 $ this ->assertEquals ('assets/image.jpg ' , uri_string (true ));
255247 }
256248
@@ -304,7 +296,8 @@ public function urlIsProvider()
304296 */
305297 public function testUrlIs (string $ currentPath , string $ testPath , bool $ expected )
306298 {
307- $ _SERVER ['HTTP_HOST ' ] = 'example.com ' ;
299+ $ _SERVER ['HTTP_HOST ' ] = 'example.com ' ;
300+ $ _SERVER ['REQUEST_URI ' ] = '/ ' . $ currentPath ;
308301
309302 $ request = Services::request ();
310303 $ request ->uri = new URI ('http://example.com/ ' . $ currentPath );
@@ -319,6 +312,7 @@ public function testUrlIs(string $currentPath, string $testPath, bool $expected)
319312 public function testUrlIsNoIndex (string $ currentPath , string $ testPath , bool $ expected )
320313 {
321314 $ _SERVER ['HTTP_HOST ' ] = 'example.com ' ;
315+ $ _SERVER ['REQUEST_URI ' ] = '/ ' . $ currentPath ;
322316 $ this ->config ->indexPage = '' ;
323317
324318 $ request = Services::request ($ this ->config );
@@ -333,8 +327,10 @@ public function testUrlIsNoIndex(string $currentPath, string $testPath, bool $ex
333327 */
334328 public function testUrlIsWithSubfolder (string $ currentPath , string $ testPath , bool $ expected )
335329 {
336- $ _SERVER ['HTTP_HOST ' ] = 'example.com ' ;
337- $ this ->config ->baseURL = 'http://example.com/subfolder/ ' ;
330+ $ _SERVER ['HTTP_HOST ' ] = 'example.com ' ;
331+ $ _SERVER ['REQUEST_URI ' ] = '/ ' . $ currentPath ;
332+ $ _SERVER ['SCRIPT_NAME ' ] = '/subfolder/index.php ' ;
333+ $ this ->config ->baseURL = 'http://example.com/subfolder/ ' ;
338334
339335 $ request = Services::request ($ this ->config );
340336 $ request ->uri = new URI ('http://example.com/subfolder/ ' . $ currentPath );
0 commit comments