Extends
lithium\test\Unit
Tests that routes can be composed of manual regular expressions.
Source
public function testManualRouteDefinition() {
$route = new Route(array(
'template' => '/{:controller}',
'pattern' => '/(?P<controller>[A-Za-z0-9_-]+)/',
'keys' => array('controller' => 'controller'),
'match' => array('action' => 'index'),
'options' => array('wrap' => false, 'compile' => false)
));
$request = new Request();
$request->url = '/posts';
$result = $route->parse($request);
$expected = array('controller' => 'posts', 'action' => 'index');
$this->assertEqual($expected, $result->params);
$result = $route->match(array('controller' => 'posts', 'action' => 'index'));
$expected = '/posts';
$this->assertEqual($expected, $result);
}