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

testEmbeddedStringActions() public method

Tests that URLs specified as "Controller::action" and including additional parameters are interpreted properly.
    public function testEmbeddedStringActions()
    {
        Router::connect('/logout/{:id:[0-9]{5,6}}', array('controller' => 'sessions', 'action' => 'destroy', 'id' => null));
        Router::connect('/{:controller}/{:action}');
        Router::connect('/{:controller}/{:action}/{:id:[0-9]+}', array('id' => null));
        $result = Router::match("Sessions::create");
        $this->assertIdentical('/sessions/create', $result);
        $result = Router::match(array("Sessions::create"));
        $this->assertIdentical('/sessions/create', $result);
        $result = Router::match(array("Sessions::destroy", 'id' => '03815'));
        $this->assertIdentical('/logout/03815', $result);
        $result = Router::match("Posts::index");
        $this->assertIdentical('/posts', $result);
        $ex = "No parameter match found for URL ";
        $ex .= "`('controller' => 'Sessions', 'action' => 'create', 'id' => 'foo')`.";
        $this->assertException($ex, function () {
            Router::match(array("Sessions::create", 'id' => 'foo'));
        });
    }
RouterTest