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

testRouteMatchingWithDefaultParameters() public method

    public function testRouteMatchingWithDefaultParameters()
    {
        Router::connect('/{:controller}/{:action}', array('action' => 'view'));
        $expected = array('controller' => 'Posts', 'action' => 'view');
        foreach (array('/posts/view', '/posts', 'posts', 'posts/view', 'posts/view/') as $url) {
            $this->request->url = $url;
            $result = Router::parse($this->request);
            $this->assertEqual($expected, $result->params);
            $this->assertEqual(array('controller'), $result->persist);
        }
        $expected['action'] = 'index';
        foreach (array('/posts/index', 'posts/index', 'posts/index/') as $url) {
            $this->request->url = $url;
            $result = Router::parse($this->request);
            $this->assertEqual($expected, $result->params);
        }
        $this->request->url = '/posts/view/1';
        $this->assertNull(Router::parse($this->request));
    }
RouterTest