Skip to content

Commit 940c794

Browse files
committed
test: add test for CLI
1 parent e5d8549 commit 940c794

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

tests/system/Helpers/URLHelper/SiteUrlTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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';

0 commit comments

Comments
 (0)