lookup() public method

Looks up a route match based on a url path
public lookup ( string $path ) : RouteMatch
$path string
return RouteMatch
Example #1
0
 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');
 }
Example #2
0
 public function testRouteLookupFailsWithEmptyTemplateVars()
 {
     $router = new Routing\Router();
     foreach ($this->_exampleRoutes as $template => $name) {
         $router->connect($template, $name);
     }
     $this->setExpectedException('\\Ergo\\Routing\\LookupException');
     $router->lookup('/fruits//flavours/');
 }