Extends
lithium\test\Unit
Tests routing based on content type extensions, with HTML being the default when types are
not defined.
Source
public function testTypeBasedRouting() {
Router::connect('/{:controller}/{:id:[0-9]+}', array(
'action' => 'index', 'type' => 'html', 'id' => null
));
Router::connect('/{:controller}/{:id:[0-9]+}.{:type}', array(
'action' => 'index', 'id' => null
));
Router::connect('/{:controller}/{:action}/{:id:[0-9]+}', array(
'type' => 'html', 'id' => null
));
Router::connect('/{:controller}/{:action}/{:id:[0-9]+}.{:type}', array('id' => null));
$url = Router::match(array('controller' => 'posts', 'type' => 'html'));
$this->assertEqual('/posts', $url);
$url = Router::match(array('controller' => 'posts', 'type' => 'json'));
$this->assertEqual('/posts.json', $url);
}