public function lookup($path)
{
if ($match = $this->_getRouteMatch($path, $this->_routes)) {
return $match;
}
if ($match = $this->_getRouteMatch($path, $this->_customRoutes)) {
return $match;
}
throw new LookupException("No route matches path '{$path}'");
}
public function testCustomRoute() { $urlPath = '/user/24'; $mockRoute = \Mockery::mock('Erg\\Routing\\Route'); $mockRoute->shouldReceive('getMatch')->with($urlPath, array())->once()->andReturn(new \Ergo\Routing\RouteMatch('user', array()))->shouldReceive('getName')->andReturn('user'); $router = new Router(); $router->connect($mockRoute, 'Custom.view'); $this->assertEquals($router->lookup($urlPath)->getName(), 'user'); }