@@ -65,6 +65,47 @@ public function testMultiMethod()
6565 }
6666
6767
68+ public function testCaseInsensitive ()
69+ {
70+ $ router = Router::create ($ this ->router ->config );
71+ $ router ->config ->case_insensitive = false ;
72+ $ router ->load ($ this ->routes );
73+
74+ // Good.
75+ $ action = $ router ->find ('GET ' , '/get/123 ' );
76+ $ this ->assertNotNull ($ action );
77+ $ this ->assertEquals ('get route ' , $ action ->target );
78+
79+ // Bad.
80+ $ action = $ router ->find ('GET ' , '/GET/123 ' );
81+ $ this ->assertNull ($ action );
82+
83+ // Methods are not case sensitive.
84+ $ action = $ router ->find ('get ' , '/get/123 ' );
85+ $ this ->assertNotNull ($ action );
86+ $ this ->assertEquals ('get route ' , $ action ->target );
87+
88+ $ router = Router::create ($ router ->config );
89+ $ router ->config ->case_insensitive = true ;
90+ $ router ->load ($ this ->routes );
91+
92+ // Still good.
93+ $ action = $ router ->find ('GET ' , '/get/123 ' );
94+ $ this ->assertNotNull ($ action );
95+ $ this ->assertEquals ('get route ' , $ action ->target );
96+
97+ // Now this works.
98+ $ action = $ router ->find ('GET ' , '/GET/123 ' );
99+ $ this ->assertNotNull ($ action );
100+ $ this ->assertEquals ('get route ' , $ action ->target );
101+
102+ // Also still good.
103+ $ action = $ router ->find ('get ' , '/GeT/123 ' );
104+ $ this ->assertNotNull ($ action );
105+ $ this ->assertEquals ('get route ' , $ action ->target );
106+ }
107+
108+
68109 public function testVariables ()
69110 {
70111 $ action = $ this ->router ->find ('GET ' , '/abc/12345 ' );
0 commit comments