File tree Expand file tree Collapse file tree
tests/system/Helpers/URLHelper Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -314,6 +314,24 @@ public function testBaseURLService()
314314 $ this ->assertSame ('http://example.com/ci/v4/controller/method ' , base_url ('controller/method ' , null ));
315315 }
316316
317+ public function testBaseURLWithCLIRequest ()
318+ {
319+ unset($ _SERVER ['HTTP_HOST ' ], $ _SERVER ['REQUEST_URI ' ]);
320+
321+ $ this ->config ->baseURL = 'http://example.com/ ' ;
322+ $ request = Services::clirequest ($ this ->config );
323+ Services::injectMock ('request ' , $ request );
324+
325+ $ this ->assertSame (
326+ 'http://example.com/index.php/controller/method ' ,
327+ site_url ('controller/method ' , null , $ this ->config )
328+ );
329+ $ this ->assertSame (
330+ 'http://example.com/controller/method ' ,
331+ base_url ('controller/method ' , null )
332+ );
333+ }
334+
317335 public function testSiteURLWithAllowedHostname ()
318336 {
319337 $ _SERVER ['HTTP_HOST ' ] = 'www.example.jp ' ;
You can’t perform that action at this time.
0 commit comments