16
16
use CodeIgniter \Config \Factories ;
17
17
use CodeIgniter \Config \Services ;
18
18
use CodeIgniter \Exceptions \PageNotFoundException ;
19
+ use CodeIgniter \HTTP \Method ;
19
20
use CodeIgniter \Router \Controllers \Dash_folder \Dash_controller ;
20
21
use CodeIgniter \Router \Controllers \Dash_folder \Home ;
21
22
use CodeIgniter \Router \Controllers \Index ;
@@ -60,7 +61,7 @@ public function testAutoRouteFindsDefaultControllerAndMethodGet(): void
60
61
$ router = $ this ->createNewAutoRouter ();
61
62
62
63
[$ directory , $ controller , $ method , $ params ]
63
- = $ router ->getRoute ('/ ' , ' GET ' );
64
+ = $ router ->getRoute ('/ ' , Method:: GET );
64
65
65
66
$ this ->assertNull ($ directory );
66
67
$ this ->assertSame ('\\' . Index::class, $ controller );
@@ -86,7 +87,7 @@ public function testAutoRouteFindsModuleDefaultControllerAndMethodGet()
86
87
$ router = $ this ->createNewAutoRouter ('App/Controllers ' );
87
88
88
89
[$ directory , $ controller , $ method , $ params ]
89
- = $ router ->getRoute ('test ' , ' GET ' );
90
+ = $ router ->getRoute ('test ' , Method:: GET );
90
91
91
92
$ this ->assertNull ($ directory );
92
93
$ this ->assertSame ('\\' . Index::class, $ controller );
@@ -101,7 +102,7 @@ public function testAutoRouteFindsDefaultControllerAndMethodPost(): void
101
102
$ router = $ this ->createNewAutoRouter ();
102
103
103
104
[$ directory , $ controller , $ method , $ params ]
104
- = $ router ->getRoute ('/ ' , ' POST ' );
105
+ = $ router ->getRoute ('/ ' , Method:: POST );
105
106
106
107
$ this ->assertNull ($ directory );
107
108
$ this ->assertSame ('\\' . Index::class, $ controller );
@@ -114,7 +115,7 @@ public function testAutoRouteFindsControllerWithFileAndMethod(): void
114
115
$ router = $ this ->createNewAutoRouter ();
115
116
116
117
[$ directory , $ controller , $ method , $ params ]
117
- = $ router ->getRoute ('mycontroller/somemethod ' , ' GET ' );
118
+ = $ router ->getRoute ('mycontroller/somemethod ' , Method:: GET );
118
119
119
120
$ this ->assertNull ($ directory );
120
121
$ this ->assertSame ('\\' . Mycontroller::class, $ controller );
@@ -132,7 +133,7 @@ public function testFindsControllerAndMethodAndParam(): void
132
133
$ router = $ this ->createNewAutoRouter ();
133
134
134
135
[$ directory , $ controller , $ method , $ params ]
135
- = $ router ->getRoute ('mycontroller/somemethod/a ' , ' GET ' );
136
+ = $ router ->getRoute ('mycontroller/somemethod/a ' , Method:: GET );
136
137
137
138
$ this ->assertNull ($ directory );
138
139
$ this ->assertSame ('\\' . Mycontroller::class, $ controller );
@@ -154,15 +155,15 @@ public function testUriParamCountIsGreaterThanMethodParams(): void
154
155
155
156
$ router = $ this ->createNewAutoRouter ();
156
157
157
- $ router ->getRoute ('mycontroller/somemethod/a/b ' , ' GET ' );
158
+ $ router ->getRoute ('mycontroller/somemethod/a/b ' , Method:: GET );
158
159
}
159
160
160
161
public function testAutoRouteFindsControllerWithFile (): void
161
162
{
162
163
$ router = $ this ->createNewAutoRouter ();
163
164
164
165
[$ directory , $ controller , $ method , $ params ]
165
- = $ router ->getRoute ('mycontroller ' , ' GET ' );
166
+ = $ router ->getRoute ('mycontroller ' , Method:: GET );
166
167
167
168
$ this ->assertNull ($ directory );
168
169
$ this ->assertSame ('\\' . Mycontroller::class, $ controller );
@@ -175,7 +176,7 @@ public function testAutoRouteFindsControllerWithSubfolder(): void
175
176
$ router = $ this ->createNewAutoRouter ();
176
177
177
178
[$ directory , $ controller , $ method , $ params ]
178
- = $ router ->getRoute ('subfolder/mycontroller/somemethod ' , ' GET ' );
179
+ = $ router ->getRoute ('subfolder/mycontroller/somemethod ' , Method:: GET );
179
180
180
181
$ this ->assertSame ('Subfolder/ ' , $ directory );
181
182
$ this ->assertSame ('\\' . \CodeIgniter \Router \Controllers \Subfolder \Mycontroller::class, $ controller );
@@ -193,7 +194,7 @@ public function testAutoRouteFindsControllerWithSubSubfolder()
193
194
$ router = $ this ->createNewAutoRouter ();
194
195
195
196
[$ directory , $ controller , $ method , $ params ]
196
- = $ router ->getRoute ('subfolder/sub/mycontroller/somemethod ' , ' GET ' );
197
+ = $ router ->getRoute ('subfolder/sub/mycontroller/somemethod ' , Method:: GET );
197
198
198
199
$ this ->assertSame ('Subfolder/Sub/ ' , $ directory );
199
200
$ this ->assertSame ('\\' . \CodeIgniter \Router \Controllers \Subfolder \Sub \Mycontroller::class, $ controller );
@@ -206,7 +207,7 @@ public function testAutoRouteFindsDashedSubfolder(): void
206
207
$ router = $ this ->createNewAutoRouter ();
207
208
208
209
[$ directory , $ controller , $ method , $ params ]
209
- = $ router ->getRoute ('dash-folder/mycontroller/somemethod ' , ' GET ' );
210
+ = $ router ->getRoute ('dash-folder/mycontroller/somemethod ' , Method:: GET );
210
211
211
212
$ this ->assertSame ('Dash_folder/ ' , $ directory );
212
213
$ this ->assertSame (
@@ -222,7 +223,7 @@ public function testAutoRouteFindsDashedController(): void
222
223
$ router = $ this ->createNewAutoRouter ();
223
224
224
225
[$ directory , $ controller , $ method , $ params ]
225
- = $ router ->getRoute ('dash-folder/dash-controller/somemethod ' , ' GET ' );
226
+ = $ router ->getRoute ('dash-folder/dash-controller/somemethod ' , Method:: GET );
226
227
227
228
$ this ->assertSame ('Dash_folder/ ' , $ directory );
228
229
$ this ->assertSame ('\\' . Dash_controller::class, $ controller );
@@ -235,7 +236,7 @@ public function testAutoRouteFindsDashedMethod(): void
235
236
$ router = $ this ->createNewAutoRouter ();
236
237
237
238
[$ directory , $ controller , $ method , $ params ]
238
- = $ router ->getRoute ('dash-folder/dash-controller/dash-method ' , ' GET ' );
239
+ = $ router ->getRoute ('dash-folder/dash-controller/dash-method ' , Method:: GET );
239
240
240
241
$ this ->assertSame ('Dash_folder/ ' , $ directory );
241
242
$ this ->assertSame ('\\' . Dash_controller::class, $ controller );
@@ -248,7 +249,7 @@ public function testAutoRouteFindsDefaultDashFolder(): void
248
249
$ router = $ this ->createNewAutoRouter ();
249
250
250
251
[$ directory , $ controller , $ method , $ params ]
251
- = $ router ->getRoute ('dash-folder ' , ' GET ' );
252
+ = $ router ->getRoute ('dash-folder ' , Method:: GET );
252
253
253
254
$ this ->assertSame ('Dash_folder/ ' , $ directory );
254
255
$ this ->assertSame ('\\' . Home::class, $ controller );
@@ -261,7 +262,7 @@ public function testAutoRouteFallbackToDefaultMethod()
261
262
$ router = $ this ->createNewAutoRouter ();
262
263
263
264
[$ directory , $ controller , $ method , $ params ]
264
- = $ router ->getRoute ('index/15 ' , ' GET ' );
265
+ = $ router ->getRoute ('index/15 ' , Method:: GET );
265
266
266
267
$ this ->assertNull ($ directory );
267
268
$ this ->assertSame ('\\' . Index::class, $ controller );
@@ -279,7 +280,7 @@ public function testAutoRouteFallbackToDefaultControllerOneParam()
279
280
$ router = $ this ->createNewAutoRouter ();
280
281
281
282
[$ directory , $ controller , $ method , $ params ]
282
- = $ router ->getRoute ('subfolder/15 ' , ' GET ' );
283
+ = $ router ->getRoute ('subfolder/15 ' , Method:: GET );
283
284
284
285
$ this ->assertSame ('Subfolder/ ' , $ directory );
285
286
$ this ->assertSame ('\\' . \CodeIgniter \Router \Controllers \Subfolder \Home::class, $ controller );
@@ -297,7 +298,7 @@ public function testAutoRouteFallbackToDefaultControllerTwoParams()
297
298
$ router = $ this ->createNewAutoRouter ();
298
299
299
300
[$ directory , $ controller , $ method , $ params ]
300
- = $ router ->getRoute ('subfolder/15/20 ' , ' GET ' );
301
+ = $ router ->getRoute ('subfolder/15/20 ' , Method:: GET );
301
302
302
303
$ this ->assertSame ('Subfolder/ ' , $ directory );
303
304
$ this ->assertSame ('\\' . \CodeIgniter \Router \Controllers \Subfolder \Home::class, $ controller );
@@ -315,7 +316,7 @@ public function testAutoRouteFallbackToDefaultControllerNoParams()
315
316
$ router = $ this ->createNewAutoRouter ();
316
317
317
318
[$ directory , $ controller , $ method , $ params ]
318
- = $ router ->getRoute ('subfolder ' , ' GET ' );
319
+ = $ router ->getRoute ('subfolder ' , Method:: GET );
319
320
320
321
$ this ->assertSame ('Subfolder/ ' , $ directory );
321
322
$ this ->assertSame ('\\' . \CodeIgniter \Router \Controllers \Subfolder \Home::class, $ controller );
@@ -334,7 +335,7 @@ public function testAutoRouteRejectsSingleDot(): void
334
335
335
336
$ router = $ this ->createNewAutoRouter ();
336
337
337
- $ router ->getRoute ('. ' , ' GET ' );
338
+ $ router ->getRoute ('. ' , Method:: GET );
338
339
}
339
340
340
341
public function testAutoRouteRejectsDoubleDot (): void
@@ -343,7 +344,7 @@ public function testAutoRouteRejectsDoubleDot(): void
343
344
344
345
$ router = $ this ->createNewAutoRouter ();
345
346
346
- $ router ->getRoute ('.. ' , ' GET ' );
347
+ $ router ->getRoute ('.. ' , Method:: GET );
347
348
}
348
349
349
350
public function testAutoRouteRejectsMidDot (): void
@@ -352,7 +353,7 @@ public function testAutoRouteRejectsMidDot(): void
352
353
353
354
$ router = $ this ->createNewAutoRouter ();
354
355
355
- $ router ->getRoute ('foo.bar ' , ' GET ' );
356
+ $ router ->getRoute ('foo.bar ' , Method:: GET );
356
357
}
357
358
358
359
public function testRejectsDefaultControllerPath (): void
@@ -361,7 +362,7 @@ public function testRejectsDefaultControllerPath(): void
361
362
362
363
$ router = $ this ->createNewAutoRouter ();
363
364
364
- $ router ->getRoute ('home ' , ' GET ' );
365
+ $ router ->getRoute ('home ' , Method:: GET );
365
366
}
366
367
367
368
public function testRejectsDefaultControllerAndDefaultMethodPath (): void
@@ -370,7 +371,7 @@ public function testRejectsDefaultControllerAndDefaultMethodPath(): void
370
371
371
372
$ router = $ this ->createNewAutoRouter ();
372
373
373
- $ router ->getRoute ('home/index ' , ' GET ' );
374
+ $ router ->getRoute ('home/index ' , Method:: GET );
374
375
}
375
376
376
377
public function testRejectsDefaultMethodPath (): void
@@ -379,7 +380,7 @@ public function testRejectsDefaultMethodPath(): void
379
380
380
381
$ router = $ this ->createNewAutoRouter ();
381
382
382
- $ router ->getRoute ('mycontroller/index ' , ' GET ' );
383
+ $ router ->getRoute ('mycontroller/index ' , Method:: GET );
383
384
}
384
385
385
386
public function testRejectsControllerWithRemapMethod (): void
@@ -391,7 +392,7 @@ public function testRejectsControllerWithRemapMethod(): void
391
392
392
393
$ router = $ this ->createNewAutoRouter ();
393
394
394
- $ router ->getRoute ('remap/test ' , ' GET ' );
395
+ $ router ->getRoute ('remap/test ' , Method:: GET );
395
396
}
396
397
397
398
public function testRejectsURIWithUnderscoreFolder ()
@@ -403,7 +404,7 @@ public function testRejectsURIWithUnderscoreFolder()
403
404
404
405
$ router = $ this ->createNewAutoRouter ();
405
406
406
- $ router ->getRoute ('dash_folder ' , ' GET ' );
407
+ $ router ->getRoute ('dash_folder ' , Method:: GET );
407
408
}
408
409
409
410
public function testRejectsURIWithUnderscoreController ()
@@ -415,7 +416,7 @@ public function testRejectsURIWithUnderscoreController()
415
416
416
417
$ router = $ this ->createNewAutoRouter ();
417
418
418
- $ router ->getRoute ('dash-folder/dash_controller/dash-method ' , ' GET ' );
419
+ $ router ->getRoute ('dash-folder/dash_controller/dash-method ' , Method:: GET );
419
420
}
420
421
421
422
public function testRejectsURIWithUnderscoreMethod ()
@@ -427,15 +428,15 @@ public function testRejectsURIWithUnderscoreMethod()
427
428
428
429
$ router = $ this ->createNewAutoRouter ();
429
430
430
- $ router ->getRoute ('dash-folder/dash-controller/dash_method ' , ' GET ' );
431
+ $ router ->getRoute ('dash-folder/dash-controller/dash_method ' , Method:: GET );
431
432
}
432
433
433
434
public function testPermitsURIWithUnderscoreParam ()
434
435
{
435
436
$ router = $ this ->createNewAutoRouter ();
436
437
437
438
[$ directory , $ controller , $ method , $ params ]
438
- = $ router ->getRoute ('mycontroller/somemethod/a_b ' , ' GET ' );
439
+ = $ router ->getRoute ('mycontroller/somemethod/a_b ' , Method:: GET );
439
440
440
441
$ this ->assertNull ($ directory );
441
442
$ this ->assertSame ('\\' . Mycontroller::class, $ controller );
@@ -448,7 +449,7 @@ public function testDoesNotTranslateDashInParam()
448
449
$ router = $ this ->createNewAutoRouter ();
449
450
450
451
[$ directory , $ controller , $ method , $ params ]
451
- = $ router ->getRoute ('mycontroller/somemethod/a-b ' , ' GET ' );
452
+ = $ router ->getRoute ('mycontroller/somemethod/a-b ' , Method:: GET );
452
453
453
454
$ this ->assertNull ($ directory );
454
455
$ this ->assertSame ('\\' . Mycontroller::class, $ controller );
0 commit comments