function testAddCustomRoute() { Route::addRoute('get', '/test_routes', function ($val) { return $val; }); $this->assertEquals(sizeof(Route::getRoutes()), 1); $this->assertEquals(Route::getRoutes()[0]['path'], '/test_routes'); $callback = Route::getRoutes()[0]['callback']; $this->assertEquals($callback(42), 42); }
private function addCustomRoutes() { foreach (Route::getRoutes() as $route) { $this->_router->respond($route['method'], $route['path'], $route['callback']); } }
<?php /* * This is where you add your own custom routes */ use Cymbaline\Route; Route::addRoute('get', '/hello/[:id]', function ($request) { $controller = new UserController(); $controller->test_custom_route($request->id); });