Skip to content

Commit 912153a

Browse files
committed
test: add test
1 parent f9d09b9 commit 912153a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/system/Helpers/URLHelper/SiteUrlTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,28 @@ public function testSiteURLWithAllowedHostname()
333333
);
334334
}
335335

336+
public function testSiteURLWithAltConfig()
337+
{
338+
$_SERVER['HTTP_HOST'] = 'www.example.jp';
339+
$_SERVER['REQUEST_URI'] = '/public';
340+
$_SERVER['SCRIPT_NAME'] = '/public/index.php';
341+
342+
$this->config->baseURL = 'http://example.com/public/';
343+
$this->config->allowedHostnames = ['www.example.jp'];
344+
345+
// URI object are updated in IncomingRequest constructor.
346+
$request = Services::incomingrequest($this->config);
347+
Services::injectMock('request', $request);
348+
349+
$altConfig = clone $this->config;
350+
$altConfig->baseURL = 'http://alt.example.com/public/';
351+
352+
$this->assertSame(
353+
'http://alt.example.com/public/index.php/controller/method',
354+
site_url('controller/method', null, $altConfig)
355+
);
356+
}
357+
336358
public function testBaseURLWithAllowedHostname()
337359
{
338360
$_SERVER['HTTP_HOST'] = 'www.example.jp';

0 commit comments

Comments
 (0)