diff --git a/system/Test/ControllerTestTrait.php b/system/Test/ControllerTestTrait.php index 64cbcbe175c0..184fdf1f5680 100644 --- a/system/Test/ControllerTestTrait.php +++ b/system/Test/ControllerTestTrait.php @@ -100,7 +100,8 @@ protected function setUpControllerTestTrait(): void } if (! $this->uri instanceof URI) { - $this->uri = Services::uri($this->appConfig->baseURL ?? 'http://example.com/', false); + $factory = Services::siteurifactory($_SERVER, $this->appConfig, false); + $this->uri = $factory->createFromGlobals(); } if (empty($this->request)) {