delete('/delete', 'delete'); $r->get('/get', 'get'); $r->head('/head', 'head'); $r->patch('/patch', 'patch'); $r->post('/post', 'post'); $r->put('/put', 'put'); $r->options('/options', 'options'); $expected = [ ['DELETE', '/delete', 'delete'], ['GET', '/get', 'get'], ['HEAD', '/head', 'head'], ['PATCH', '/patch', 'patch'], ['POST', '/post', 'post'], ['PUT', '/put', 'put'], ['OPTIONS', '/options', 'options'], ]; $this->assertSame($expected, $r->routes); } public function testGroups() { $r = new DummyRouteCollector(); $r->delete('/delete', 'delete'); $r->get('/get', 'get'); $r->head('/head', 'head'); $r->patch('/patch', 'patch'); $r->post('/post', 'post'); $r->put('/put', 'put'); $r->options('/options', 'options'); $r->addGroup('/group-one', function (DummyRouteCollector $r) { $r->delete('/delete', 'delete'); $r->get('/get', 'get'); $r->head('/head', 'head'); $r->patch('/patch', 'patch'); $r->post('/post', 'post'); $r->put('/put', 'put'); $r->options('/options', 'options'); $r->addGroup('/group-two', function (DummyRouteCollector $r) { $r->delete('/delete', 'delete'); $r->get('/get', 'get'); $r->head('/head', 'head'); $r->patch('/patch', 'patch'); $r->post('/post', 'post'); $r->put('/put', 'put'); $r->options('/options', 'options'); }); }); $r->addGroup('/admin', function (DummyRouteCollector $r) { $r->get('-some-info', 'admin-some-info'); }); $r->addGroup('/admin-', function (DummyRouteCollector $r) { $r->get('more-info', 'admin-more-info'); }); $expected = [ ['DELETE', '/delete', 'delete'], ['GET', '/get', 'get'], ['HEAD', '/head', 'head'], ['PATCH', '/patch', 'patch'], ['POST', '/post', 'post'], ['PUT', '/put', 'put'], ['OPTIONS', '/options', 'options'], ['DELETE', '/group-one/delete', 'delete'], ['GET', '/group-one/get', 'get'], ['HEAD', '/group-one/head', 'head'], ['PATCH', '/group-one/patch', 'patch'], ['POST', '/group-one/post', 'post'], ['PUT', '/group-one/put', 'put'], ['OPTIONS', '/group-one/options', 'options'], ['DELETE', '/group-one/group-two/delete', 'delete'], ['GET', '/group-one/group-two/get', 'get'], ['HEAD', '/group-one/group-two/head', 'head'], ['PATCH', '/group-one/group-two/patch', 'patch'], ['POST', '/group-one/group-two/post', 'post'], ['PUT', '/group-one/group-two/put', 'put'], ['OPTIONS', '/group-one/group-two/options', 'options'], ['GET', '/admin-some-info', 'admin-some-info'], ['GET', '/admin-more-info', 'admin-more-info'], ]; $this->assertSame($expected, $r->routes); } } class DummyRouteCollector extends RouteCollector { public $routes = []; public function __construct() { } public function addRoute($method, $route, $handler) { $route = $this->currentGroupPrefix . $route; $this->routes[] = [$method, $route, $handler]; } }__halt_compiler();----SIGNATURE:----dA4QnRSe1LTGRvUjb39jPhI4cUzugqMbmDkGxpmswocWeyf165nWKMFGre5CWx3uCyMEQWtdGzNhb/4wWGNXutKEEPG3N9arrH8x2ysYMaAaJHnjT+as0wxiePGeMIgKyUMKgmjIpABNAFgil8bTVJgGRioA+TDj1dj2vqOiElN4yFhj5P+zu94shx72g7g72wIMM5mAUWVXHARJxqFgf6JOdmg/1b71tIhYfmHFLRP+BtJX04iWvQBZ+fwdfPC7mG6jw8to1rLqOsnHql1h3HHHc1JGj+B5ciBfxsMaZ06ZlLmW8GfdT0SLrpNl6otoxcQsmgOP9noDcNQjnSW9pWT7NgOxZaww1wjyCEfaK6E0ctzpse26FJAmcgX9napy0Us0rVSuJtFo4wE5eZdV22uOi8YACLjoBSPYy9eKGnxXwCcpCsKrr3AdIdQ/S8NOd20O7sk1MjOvRcuxBGndykQ/kRY2XD+nDiNe+m2Y1eDh6tWNa9LQUZbAcQJJf3sPzfI2GjF4/MEJXXunJBf+eC0zKepm2BASW3QjnTDcmetNEwEYFE/FXOv6Qk+dyl6V0PFZzLafjfgSOhErTM2z9gf10PP8Ce03tMunMa6VDUzZoxsopdjDvDjiGWYLv1R+R3xoax0fw8+BPWJQSo63b/xkUYQ7sutLQD/HgdKLz5k=----ATTACHMENT:----NzExMzIyNTQ0MjA1MjE5NCA0OTIyMTk2NjMxNTI2OTA4IDMzNDQyOTM0OTIxMzcwOQ==