/** * Test the construction of an i18nRoute with an explicit lang named param * * @return void * @access public */ public function testConstructionExplicitLang() { $initalRouteCount = count(Router::$routes); $route = new I18nRoute('/:controller/:action/:id/:lang', array(), array('id' => '[0-9]+')); $this->assertEquals($route->template, '/:controller/:action/:id/:lang'); $this->assertEquals($route->defaults, array()); $this->assertEquals($route->options, array('id' => '[0-9]+', 'lang' => 'eng|fre|spa')); $this->assertFalse($route->compiled()); $routeCount = count(Router::$routes); $this->assertEquals($routeCount, $initalRouteCount); }
/** * Test the construction of an i18nRoute with an explicit lang named param * * @return void * @access public */ public function testConstructionExplicitLang() { $Router = Router::getInstance(); $initalRouteCount = count($Router->routes); $route = new I18nRoute('/:controller/:action/:id/:lang', array(), array('id' => '[0-9]+')); $this->assertEqual($route->template, '/:controller/:action/:id/:lang'); $this->assertEqual($route->defaults, array()); $this->assertEqual($route->options, array('id' => '[0-9]+', 'lang' => 'eng|fre|spa')); $this->assertFalse($route->compiled()); $routeCount = count($Router->routes); $this->assertEqual($routeCount, $initalRouteCount + 1); $defaultRoute = array_pop($Router->routes); $this->assertEqual($defaultRoute->template, '/:controller/:action/:id'); $this->assertEqual($defaultRoute->defaults, array( 'lang' => $this->__defaultLang, 'action' => 'index', 'plugin' => null)); $this->assertEqual($defaultRoute->options, array('id' => '[0-9]+')); $this->assertFalse($defaultRoute->compiled()); }