| @@ 204-221 (lines=18) @@ | ||
| 201 | $this->assertFalse($this->router->match('/users/1/create', 'GET')); |
|
| 202 | } |
|
| 203 | ||
| 204 | public function testMatchWithServerVars() |
|
| 205 | { |
|
| 206 | $this->router->map('GET', '/foo/[:controller]/[:action]', 'foo_action', 'foo_route'); |
|
| 207 | ||
| 208 | $this->router->setServer([ |
|
| 209 | 'REQUEST_URI' => '/foo/test/do', |
|
| 210 | 'REQUEST_METHOD' => 'GET' |
|
| 211 | ]); |
|
| 212 | ||
| 213 | $this->assertEquals(array( |
|
| 214 | 'target' => 'foo_action', |
|
| 215 | 'params' => array( |
|
| 216 | 'controller' => 'test', |
|
| 217 | 'action' => 'do' |
|
| 218 | ), |
|
| 219 | 'name' => 'foo_route' |
|
| 220 | ), $this->router->match()); |
|
| 221 | } |
|
| 222 | ||
| 223 | public function testMatchWithOptionalUrlParts() |
|
| 224 | { |
|
| @@ 223-236 (lines=14) @@ | ||
| 220 | ), $this->router->match()); |
|
| 221 | } |
|
| 222 | ||
| 223 | public function testMatchWithOptionalUrlParts() |
|
| 224 | { |
|
| 225 | $this->router->map('GET', '/bar/[:controller]/[:action].[:type]?', 'bar_action', 'bar_route'); |
|
| 226 | ||
| 227 | $this->assertEquals(array( |
|
| 228 | 'target' => 'bar_action', |
|
| 229 | 'params' => array( |
|
| 230 | 'controller' => 'test', |
|
| 231 | 'action' => 'do', |
|
| 232 | 'type' => 'json' |
|
| 233 | ), |
|
| 234 | 'name' => 'bar_route' |
|
| 235 | ), $this->router->match('/bar/test/do.json', 'GET')); |
|
| 236 | } |
|
| 237 | ||
| 238 | public function testMatchWithWildcard() |
|
| 239 | { |
|