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 testGreedyParametersInRoutes() { $router = new Routing\Router(); $router->connect('/fruits/{fruitid}/{blah:greedy}', 'fruit'); $this->_assertRoute($router, '/fruits/5/this/is/a/test', 'fruit', array('fruitid' => 5, 'blah' => 'this/is/a/test')); $this->_assertNoRoute($router, '/blargh'); }