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