lithium\tests\cases\net\http\RouterTest::testTypeBasedRouting PHP Method

testTypeBasedRouting() public method

Tests routing based on content type extensions, with HTML being the default when types are not defined.
    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->assertIdentical('/posts', $url);
        $url = Router::match(array('controller' => 'posts', 'type' => 'json'));
        $this->assertIdentical('/posts.json', $url);
    }
RouterTest