1212namespace CodeIgniter \Router ;
1313
1414use CodeIgniter \Config \Services ;
15+ use CodeIgniter \controller ;
1516use CodeIgniter \Exceptions \PageNotFoundException ;
1617use CodeIgniter \Test \CIUnitTestCase ;
1718use Config \Modules ;
@@ -88,7 +89,7 @@ public function testBasicAddCallableWithParamsString()
8889
8990 $ routes = $ routes ->getRoutes ();
9091 $ expects = [
91- 'product/([0-9] +)/([0-9] +) ' => '\Tests\Support\Controllers\Hello::index/$2/$1 ' ,
92+ 'product/(\d +)/(\d +) ' => '\Tests\Support\Controllers\Hello::index/$2/$1 ' ,
9293 ];
9394 $ this ->assertSame ($ expects , $ routes );
9495 }
@@ -101,7 +102,7 @@ public function testBasicAddCallableWithParamsWithoutString()
101102
102103 $ routes = $ routes ->getRoutes ();
103104 $ expects = [
104- 'product/([0-9] +)/([0-9] +) ' => '\Tests\Support\Controllers\Hello::index/$1/$2 ' ,
105+ 'product/(\d +)/(\d +) ' => '\Tests\Support\Controllers\Hello::index/$1/$2 ' ,
105106 ];
106107 $ this ->assertSame ($ expects , $ routes );
107108 }
@@ -237,7 +238,7 @@ public function testAddRecognizesCustomNamespaces()
237238 $ routes ->add ('home ' , 'controller ' );
238239
239240 $ expects = [
240- 'home ' => '\CodeIgniter\controller ' ,
241+ 'home ' => '\\' . controller::class ,
241242 ];
242243
243244 $ routes = $ routes ->getRoutes ();
@@ -615,10 +616,10 @@ public function testResourcesWithCustomPlaceholder()
615616 $ routes ->resource ('photos ' , ['placeholder ' => ':num ' ]);
616617
617618 $ expected = [
618- 'photos ' => '\Photos::index ' ,
619- 'photos/new ' => '\Photos::new ' ,
620- 'photos/([0-9] +)/edit ' => '\Photos::edit/$1 ' ,
621- 'photos/([0-9] +) ' => '\Photos::show/$1 ' ,
619+ 'photos ' => '\Photos::index ' ,
620+ 'photos/new ' => '\Photos::new ' ,
621+ 'photos/(\d +)/edit ' => '\Photos::edit/$1 ' ,
622+ 'photos/(\d +) ' => '\Photos::show/$1 ' ,
622623 ];
623624
624625 $ this ->assertSame ($ expected , $ routes ->getRoutes ());
@@ -633,10 +634,10 @@ public function testResourcesWithDefaultPlaceholder()
633634 $ routes ->resource ('photos ' );
634635
635636 $ expected = [
636- 'photos ' => '\Photos::index ' ,
637- 'photos/new ' => '\Photos::new ' ,
638- 'photos/([0-9] +)/edit ' => '\Photos::edit/$1 ' ,
639- 'photos/([0-9] +) ' => '\Photos::show/$1 ' ,
637+ 'photos ' => '\Photos::index ' ,
638+ 'photos/new ' => '\Photos::new ' ,
639+ 'photos/(\d +)/edit ' => '\Photos::edit/$1 ' ,
640+ 'photos/(\d +) ' => '\Photos::show/$1 ' ,
640641 ];
641642
642643 $ this ->assertSame ($ expected , $ routes ->getRoutes ());
@@ -1399,7 +1400,7 @@ public function testOffsetParameters()
13991400 $ routes = $ this ->getCollector ();
14001401
14011402 $ routes ->get ('users/(:num) ' , 'users/show/$1 ' , ['offset ' => 1 ]);
1402- $ expected = ['users/([0-9] +) ' => '\users/show/$2 ' ];
1403+ $ expected = ['users/(\d +) ' => '\users/show/$2 ' ];
14031404 $ this ->assertSame ($ expected , $ routes ->getRoutes ());
14041405 }
14051406
0 commit comments