2323 */
2424final class SiteURIFactoryDetectRoutePathTest extends CIUnitTestCase
2525{
26+ protected function setUp (): void
27+ {
28+ parent ::setUp ();
29+
30+ $ _GET = $ _SERVER = [];
31+ }
32+
2633 private function createSiteURIFactory (array $ server , ?App $ appConfig = null ): SiteURIFactory
2734 {
2835 $ appConfig ??= new App ();
@@ -32,8 +39,6 @@ private function createSiteURIFactory(array $server, ?App $appConfig = null): Si
3239
3340 public function testDefault ()
3441 {
35- $ _GET = $ _SERVER = [];
36-
3742 // /index.php/woot?code=good#pos
3843 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot ' ;
3944 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
@@ -46,8 +51,6 @@ public function testDefault()
4651
4752 public function testDefaultEmpty ()
4853 {
49- $ _GET = $ _SERVER = [];
50-
5154 // /
5255 $ _SERVER ['REQUEST_URI ' ] = '/ ' ;
5356 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
@@ -60,8 +63,6 @@ public function testDefaultEmpty()
6063
6164 public function testRequestURI ()
6265 {
63- $ _GET = $ _SERVER = [];
64-
6566 // /index.php/woot?code=good#pos
6667 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot ' ;
6768 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
@@ -74,8 +75,6 @@ public function testRequestURI()
7475
7576 public function testRequestURINested ()
7677 {
77- $ _GET = $ _SERVER = [];
78-
7978 // I'm not sure but this is a case of Apache config making such SERVER
8079 // values?
8180 // The current implementation doesn't use the value of the URI object.
@@ -96,8 +95,6 @@ public function testRequestURINested()
9695
9796 public function testRequestURISubfolder ()
9897 {
99- $ _GET = $ _SERVER = [];
100-
10198 // /ci/index.php/popcorn/woot?code=good#pos
10299 $ _SERVER ['REQUEST_URI ' ] = '/ci/index.php/popcorn/woot ' ;
103100 $ _SERVER ['SCRIPT_NAME ' ] = '/ci/index.php ' ;
@@ -110,8 +107,6 @@ public function testRequestURISubfolder()
110107
111108 public function testRequestURINoIndex ()
112109 {
113- $ _GET = $ _SERVER = [];
114-
115110 // /sub/example
116111 $ _SERVER ['REQUEST_URI ' ] = '/sub/example ' ;
117112 $ _SERVER ['SCRIPT_NAME ' ] = '/sub/index.php ' ;
@@ -124,8 +119,6 @@ public function testRequestURINoIndex()
124119
125120 public function testRequestURINginx ()
126121 {
127- $ _GET = $ _SERVER = [];
128-
129122 // /ci/index.php/woot?code=good#pos
130123 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot?code=good ' ;
131124 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
@@ -138,8 +131,6 @@ public function testRequestURINginx()
138131
139132 public function testRequestURINginxRedirecting ()
140133 {
141- $ _GET = $ _SERVER = [];
142-
143134 // /?/ci/index.php/woot
144135 $ _SERVER ['REQUEST_URI ' ] = '/?/ci/woot ' ;
145136 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
@@ -152,8 +143,6 @@ public function testRequestURINginxRedirecting()
152143
153144 public function testRequestURISuppressed ()
154145 {
155- $ _GET = $ _SERVER = [];
156-
157146 // /woot?code=good#pos
158147 $ _SERVER ['REQUEST_URI ' ] = '/woot ' ;
159148 $ _SERVER ['SCRIPT_NAME ' ] = '/ ' ;
@@ -166,8 +155,6 @@ public function testRequestURISuppressed()
166155
167156 public function testQueryString ()
168157 {
169- $ _GET = $ _SERVER = [];
170-
171158 // /index.php?/ci/woot
172159 $ _SERVER ['REQUEST_URI ' ] = '/index.php?/ci/woot ' ;
173160 $ _SERVER ['QUERY_STRING ' ] = '/ci/woot ' ;
@@ -183,8 +170,6 @@ public function testQueryString()
183170
184171 public function testQueryStringWithQueryString ()
185172 {
186- $ _GET = $ _SERVER = [];
187-
188173 // /index.php?/ci/woot?code=good#pos
189174 $ _SERVER ['REQUEST_URI ' ] = '/index.php?/ci/woot?code=good ' ;
190175 $ _SERVER ['QUERY_STRING ' ] = '/ci/woot?code=good ' ;
@@ -202,8 +187,6 @@ public function testQueryStringWithQueryString()
202187
203188 public function testQueryStringEmpty ()
204189 {
205- $ _GET = $ _SERVER = [];
206-
207190 // /index.php?
208191 $ _SERVER ['REQUEST_URI ' ] = '/index.php? ' ;
209192 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
@@ -216,8 +199,6 @@ public function testQueryStringEmpty()
216199
217200 public function testPathInfoUnset ()
218201 {
219- $ _GET = $ _SERVER = [];
220-
221202 // /index.php/woot?code=good#pos
222203 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot ' ;
223204 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
@@ -230,8 +211,6 @@ public function testPathInfoUnset()
230211
231212 public function testPathInfoSubfolder ()
232213 {
233- $ _GET = $ _SERVER = [];
234-
235214 $ appConfig = new App ();
236215 $ appConfig ->baseURL = 'http://localhost:8888/ci431/public/ ' ;
237216
0 commit comments