/** * Get a route path by a given name * @param string $routeName * @param array $params (optional) * @return string */ public final function urlFor($routeName, array $params = array()) { if (null === $this->router) { return ''; } return $this->router->urlFor($routeName, $params); }
public function testUrlFor() { $this->assertEquals('/somewhere/{name}', $this->router->urlFor('index_name_not_same')); $this->assertEquals('/somewhere/foobar', $this->router->urlFor('index_name_not_same', array('name' => 'foobar'))); // next test covers the 'temp' stored urls. $this->assertEquals('/somewhere/foobar', $this->router->urlFor('index_name_not_same', array('name' => 'foobar'))); $this->assertEquals('missing_path', $this->router->urlFor('missing_path')); }