diff --git a/tests/unit/Grav/Common/UriTest.php b/tests/unit/Grav/Common/UriTest.php index 3e52ef877b..c36ce52daf 100644 --- a/tests/unit/Grav/Common/UriTest.php +++ b/tests/unit/Grav/Common/UriTest.php @@ -1,6 +1,7 @@ [ 'scheme' => '', @@ -704,7 +708,7 @@ class UriTest extends \Codeception\TestCase\Test 'route' => '/localhost', 'paths' => ['localhost'], 'params' => '/script%3E:', - 'url' => '//localhost', + 'url' => '/localhost', 'environment' => 'unknown', 'basename' => 'localhost', 'base' => '', @@ -859,6 +863,7 @@ protected function _before(): void $grav = Fixtures::get('grav'); $this->grav = $grav(); $this->uri = $this->grav['uri']; + $this->config = $this->grav['config']; } protected function _after(): void @@ -1149,4 +1154,25 @@ public function testAddNonce(): void { $this->runTestSet($this->tests, 'addNonce'); } + + public function testCustomBase(): void + { + $current_base = $this->config->get('system.custom_base_url'); + $this->config->set('system.custom_base_url', '/test'); + $this->uri->initializeWithURL('https://mydomain.example.com:8090/test/korteles/kodai%20something?test=true#some-fragment')->init(); + + $this->assertSame([ + "scheme" => "https", + "host" => "mydomain.example.com", + "port" => 8090, + "user" => null, + "pass" => null, + "path" => "/korteles/kodai%20something", + "params" => [], + "query" => "test=true", + "fragment" => "some-fragment", + ], $this->uri->toArray()); + + $this->config->set('system.custom_base_url', $current_base); + } }