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'); }
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/'); }