public function testCase011() { $this->request->setRequestUri('/subdir/ap/1.2/name/value'); $this->request->setBaseUri('/subdir'); $route = new Yaf_Route_Rewrite("/subdir/:name/:version", array("action" => "version")); $this->router->addRoute("subdir", $route)->addRoute("ap", new Yaf_Route_Rewrite("/ap/:version/*", array("action" => 'ap')))->route($this->request); $this->assertEquals('ap', $this->router->getCurrentRoute()); $this->assertEquals('1.2', $this->request->getParam('version')); $this->assertEquals('ap', $this->request->getActionName()); $this->assertEquals(null, $this->request->getControllerName()); $this->assertEquals('value', $this->request->getParam('name')); }
/** * @runInSeparateProcess */ public function testCase008() { $router = new Yaf_Router(); $route = new Yaf_Route_Simple('m', 'c', 'a'); $sroute = new Yaf_Route_Supervar('r'); $router->addRoute("simple", $route)->addRoute("super", $sroute); $routes = $router->getRoutes(); $this->assertEquals(3, count($routes)); $this->assertSame($route, $routes['simple']); $this->assertSame($sroute, $routes['super']); $this->assertNull($router->getCurrentRoute()); $this->assertSame($route, $router->getRoute('simple')); $this->assertNull($router->getRoute('noexists')); }