File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -87,4 +87,45 @@ public function testCollect()
8787 ];
8888 $ this ->assertSame ($ expected , $ definedRoutes );
8989 }
90+
91+ /**
92+ * @see https://github.com/codeigniter4/CodeIgniter4/issues/8039
93+ */
94+ public function testCollectSameFromWithDifferentVerb ()
95+ {
96+ $ routes = $ this ->createRouteCollection ();
97+ $ routes ->get ('login ' , 'AuthController::showLogin ' , ['as ' => 'loginShow ' ]);
98+ $ routes ->post ('login ' , 'AuthController::login ' , ['as ' => 'login ' ]);
99+ $ routes ->get ('logout ' , 'AuthController::logout ' , ['as ' => 'logout ' ]);
100+
101+ $ collector = new DefinedRouteCollector ($ routes );
102+
103+ $ definedRoutes = [];
104+
105+ foreach ($ collector ->collect () as $ route ) {
106+ $ definedRoutes [] = $ route ;
107+ }
108+
109+ $ expected = [
110+ [
111+ 'method ' => 'get ' ,
112+ 'route ' => 'login ' ,
113+ 'name ' => 'loginShow ' ,
114+ 'handler ' => '\\App \\Controllers \\AuthController::showLogin ' ,
115+ ],
116+ [
117+ 'method ' => 'get ' ,
118+ 'route ' => 'logout ' ,
119+ 'name ' => 'logout ' ,
120+ 'handler ' => '\\App \\Controllers \\AuthController::logout ' ,
121+ ],
122+ [
123+ 'method ' => 'post ' ,
124+ 'route ' => 'login ' ,
125+ 'name ' => 'login ' ,
126+ 'handler ' => '\\App \\Controllers \\AuthController::login ' ,
127+ ],
128+ ];
129+ $ this ->assertSame ($ expected , $ definedRoutes );
130+ }
90131}
You can’t perform that action at this time.
0 commit comments