diff --git a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php index b9b764f4d1a9..3b7715049a5c 100644 --- a/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php +++ b/tests/system/HTTP/SiteURIFactoryDetectRoutePathTest.php @@ -23,6 +23,13 @@ */ final class SiteURIFactoryDetectRoutePathTest extends CIUnitTestCase { + protected function setUp(): void + { + parent::setUp(); + + $_GET = $_SERVER = []; + } + private function createSiteURIFactory(array $server, ?App $appConfig = null): SiteURIFactory { $appConfig ??= new App(); @@ -32,8 +39,6 @@ private function createSiteURIFactory(array $server, ?App $appConfig = null): Si public function testDefault() { - $_GET = $_SERVER = []; - // /index.php/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php/woot'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -46,8 +51,6 @@ public function testDefault() public function testDefaultEmpty() { - $_GET = $_SERVER = []; - // / $_SERVER['REQUEST_URI'] = '/'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -60,8 +63,6 @@ public function testDefaultEmpty() public function testRequestURI() { - $_GET = $_SERVER = []; - // /index.php/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php/woot'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -74,8 +75,6 @@ public function testRequestURI() public function testRequestURINested() { - $_GET = $_SERVER = []; - // I'm not sure but this is a case of Apache config making such SERVER // values? // The current implementation doesn't use the value of the URI object. @@ -96,8 +95,6 @@ public function testRequestURINested() public function testRequestURISubfolder() { - $_GET = $_SERVER = []; - // /ci/index.php/popcorn/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/ci/index.php/popcorn/woot'; $_SERVER['SCRIPT_NAME'] = '/ci/index.php'; @@ -110,8 +107,6 @@ public function testRequestURISubfolder() public function testRequestURINoIndex() { - $_GET = $_SERVER = []; - // /sub/example $_SERVER['REQUEST_URI'] = '/sub/example'; $_SERVER['SCRIPT_NAME'] = '/sub/index.php'; @@ -124,8 +119,6 @@ public function testRequestURINoIndex() public function testRequestURINginx() { - $_GET = $_SERVER = []; - // /ci/index.php/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php/woot?code=good'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -138,8 +131,6 @@ public function testRequestURINginx() public function testRequestURINginxRedirecting() { - $_GET = $_SERVER = []; - // /?/ci/index.php/woot $_SERVER['REQUEST_URI'] = '/?/ci/woot'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -152,8 +143,6 @@ public function testRequestURINginxRedirecting() public function testRequestURISuppressed() { - $_GET = $_SERVER = []; - // /woot?code=good#pos $_SERVER['REQUEST_URI'] = '/woot'; $_SERVER['SCRIPT_NAME'] = '/'; @@ -166,8 +155,6 @@ public function testRequestURISuppressed() public function testQueryString() { - $_GET = $_SERVER = []; - // /index.php?/ci/woot $_SERVER['REQUEST_URI'] = '/index.php?/ci/woot'; $_SERVER['QUERY_STRING'] = '/ci/woot'; @@ -183,8 +170,6 @@ public function testQueryString() public function testQueryStringWithQueryString() { - $_GET = $_SERVER = []; - // /index.php?/ci/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php?/ci/woot?code=good'; $_SERVER['QUERY_STRING'] = '/ci/woot?code=good'; @@ -202,8 +187,6 @@ public function testQueryStringWithQueryString() public function testQueryStringEmpty() { - $_GET = $_SERVER = []; - // /index.php? $_SERVER['REQUEST_URI'] = '/index.php?'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -216,8 +199,6 @@ public function testQueryStringEmpty() public function testPathInfoUnset() { - $_GET = $_SERVER = []; - // /index.php/woot?code=good#pos $_SERVER['REQUEST_URI'] = '/index.php/woot'; $_SERVER['SCRIPT_NAME'] = '/index.php'; @@ -230,8 +211,6 @@ public function testPathInfoUnset() public function testPathInfoSubfolder() { - $_GET = $_SERVER = []; - $appConfig = new App(); $appConfig->baseURL = 'http://localhost:8888/ci431/public/';