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 @@ -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 ' ;
You can’t perform that action at this time.
0 commit comments