function setUp() { $this->empty = new EmptyObject($this); $this->renderOutput = null; Router::resetRoutes(); Router::addRoutes(array("security/login/password" => "login.php", "security/login/:key" => "login-:key.php", "security/register/:key" => "register-:key.php?argument=:key", "security/multi/:key1/:key2" => "register-:key1-:key2.php?argument=:key1&argument2=:key2", "api/v1/currencies" => $this->empty, "/api/v1/currenciesAbsolute" => $this->empty, "api/v1/currency/:code" => $this->empty, "/api/v2/currencies" => "currencies2.php", "api/v3/currencies" => "currencies3.php", "api/v4/currencies[.json]" => "currencies4.php", "api/v5/:key[.json]" => "currencies5.php?argument=:key", "help/:key" => "../pages/kb.php?q=:key")); }
function testWildcardCheck() { Router::resetRoutes(); Router::addRoutes(array("foo" => "foo.php")); Router::addRoutes(array(":anything" => "bar.php?key=:anything")); try { // because things are added in reverse order, this rule can never fire due to // the wildcard above Router::addRoutes(array("ignored" => "ignored.php")); $this->fail("Should have thrown an exception"); } catch (\Openclerk\RouterException $e) { // expected } }