@@ -31,127 +31,139 @@ protected function setUp(): void
3131
3232 $ _POST = $ _GET = $ _SERVER = $ _REQUEST = $ _ENV = $ _COOKIE = $ _SESSION = [];
3333
34- $ origin = ' http://www.example.com/index.php/woot?code=good#pos ' ;
35-
34+ // The URI object is not used in detectPath().
35+ $ origin = ' http://www.example.com/index.php/woot?code=good#pos ' ;
3636 $ this ->request = new IncomingRequest (new App (), new URI ($ origin ), null , new UserAgent ());
3737 }
3838
3939 public function testPathDefault ()
4040 {
41- $ this -> request -> uri = ' /index.php/woot?code=good#pos ' ;
41+ // /index.php/woot?code=good#pos
4242 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot ' ;
4343 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
44- $ expected = 'woot ' ;
44+
45+ $ expected = 'woot ' ;
4546 $ this ->assertSame ($ expected , $ this ->request ->detectPath ());
4647 }
4748
4849 public function testPathEmpty ()
4950 {
50- $ this -> request -> uri = ' / ' ;
51+ // /
5152 $ _SERVER ['REQUEST_URI ' ] = '/ ' ;
5253 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
53- $ expected = '/ ' ;
54+
55+ $ expected = '/ ' ;
5456 $ this ->assertSame ($ expected , $ this ->request ->detectPath ());
5557 }
5658
5759 public function testPathRequestURI ()
5860 {
59- $ this -> request -> uri = ' /index.php/woot?code=good#pos ' ;
61+ // /index.php/woot?code=good#pos
6062 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot ' ;
6163 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
62- $ expected = 'woot ' ;
64+
65+ $ expected = 'woot ' ;
6366 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('REQUEST_URI ' ));
6467 }
6568
6669 public function testPathRequestURINested ()
6770 {
68- $ this -> request -> uri = ' /ci/index.php/woot?code=good#pos ' ;
71+ // /ci/index.php/woot?code=good#pos
6972 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot ' ;
7073 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
71- $ expected = 'woot ' ;
74+
75+ $ expected = 'woot ' ;
7276 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('REQUEST_URI ' ));
7377 }
7478
7579 public function testPathRequestURISubfolder ()
7680 {
77- $ this -> request -> uri = ' /ci/index.php/popcorn/woot?code=good#pos ' ;
81+ // /ci/index.php/popcorn/woot?code=good#pos
7882 $ _SERVER ['REQUEST_URI ' ] = '/ci/index.php/popcorn/woot ' ;
7983 $ _SERVER ['SCRIPT_NAME ' ] = '/ci/index.php ' ;
80- $ expected = 'popcorn/woot ' ;
84+
85+ $ expected = 'popcorn/woot ' ;
8186 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('REQUEST_URI ' ));
8287 }
8388
8489 public function testPathRequestURINoIndex ()
8590 {
86- $ this -> request -> uri = ' /sub/example ' ;
91+ // /sub/example
8792 $ _SERVER ['REQUEST_URI ' ] = '/sub/example ' ;
8893 $ _SERVER ['SCRIPT_NAME ' ] = '/sub/index.php ' ;
89- $ expected = 'example ' ;
94+
95+ $ expected = 'example ' ;
9096 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('REQUEST_URI ' ));
9197 }
9298
9399 public function testPathRequestURINginx ()
94100 {
95- $ this -> request -> uri = ' /ci/index.php/woot?code=good#pos ' ;
101+ // /ci/index.php/woot?code=good#pos
96102 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot?code=good ' ;
97103 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
98- $ expected = 'woot ' ;
104+
105+ $ expected = 'woot ' ;
99106 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('REQUEST_URI ' ));
100107 }
101108
102109 public function testPathRequestURINginxRedirecting ()
103110 {
104- $ this -> request -> uri = ' /?/ci/index.php/woot ' ;
111+ // /?/ci/index.php/woot
105112 $ _SERVER ['REQUEST_URI ' ] = '/?/ci/woot ' ;
106113 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
107- $ expected = 'ci/woot ' ;
114+
115+ $ expected = 'ci/woot ' ;
108116 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('REQUEST_URI ' ));
109117 }
110118
111119 public function testPathRequestURISuppressed ()
112120 {
113- $ this -> request -> uri = ' /woot?code=good#pos ' ;
121+ // /woot?code=good#pos
114122 $ _SERVER ['REQUEST_URI ' ] = '/woot ' ;
115123 $ _SERVER ['SCRIPT_NAME ' ] = '/ ' ;
116- $ expected = 'woot ' ;
124+
125+ $ expected = 'woot ' ;
117126 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('REQUEST_URI ' ));
118127 }
119128
120129 public function testPathQueryString ()
121130 {
122- $ this -> request -> uri = ' /?/ci/index.php/woot ' ;
131+ // /?/ci/index.php/woot
123132 $ _SERVER ['REQUEST_URI ' ] = '/?/ci/woot ' ;
124133 $ _SERVER ['QUERY_STRING ' ] = '/ci/woot ' ;
125134 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
126- $ expected = 'ci/woot ' ;
135+
136+ $ expected = 'ci/woot ' ;
127137 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('QUERY_STRING ' ));
128138 }
129139
130140 public function testPathQueryStringEmpty ()
131141 {
132- $ this -> request -> uri = ' /?/ci/index.php/woot ' ;
142+ // /?/ci/index.php/woot
133143 $ _SERVER ['REQUEST_URI ' ] = '/?/ci/woot ' ;
134144 $ _SERVER ['QUERY_STRING ' ] = '' ;
135145 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
136- $ expected = '' ;
146+
147+ $ expected = '' ;
137148 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('QUERY_STRING ' ));
138149 }
139150
140151 public function testPathPathInfo ()
141152 {
142- $ this -> request -> uri = ' /index.php/woot?code=good#pos ' ;
153+ // /index.php/woot?code=good#pos
143154 $ this ->request ->setGlobal ('server ' , [
144155 'PATH_INFO ' => null ,
145156 ]);
146157 $ _SERVER ['REQUEST_URI ' ] = '/index.php/woot ' ;
147158 $ _SERVER ['SCRIPT_NAME ' ] = '/index.php ' ;
148- $ expected = 'woot ' ;
159+
160+ $ expected = 'woot ' ;
149161 $ this ->assertSame ($ expected , $ this ->request ->detectPath ('PATH_INFO ' ));
150162 }
151163
152164 public function testPathPathInfoGlobal ()
153165 {
154- $ this -> request -> uri = ' /index.php/woot?code=good#pos ' ;
166+ // /index.php/woot?code=good#pos
155167 $ this ->request ->setGlobal ('server ' , [
156168 'PATH_INFO ' => 'silliness ' ,
157169 ]);
0 commit comments