From 546ab8e90396cd5059877578a32303e01a953a2c Mon Sep 17 00:00:00 2001 From: mychidarko Date: Wed, 26 Apr 2023 00:54:12 +0000 Subject: [PATCH] test: add tests for nested groups --- tests/groups.test.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/groups.test.php b/tests/groups.test.php index a939ae6..77929cd 100644 --- a/tests/groups.test.php +++ b/tests/groups.test.php @@ -82,3 +82,23 @@ class TGroup 'App\\\\Controllers\\\\ExampleController' ))->toBeTruthy(); }); + +test('route groups support nested groups', function () { + $_SERVER['REQUEST_URI'] = '/group/nested/route'; + + $rx = new Router; + + TGroup::$val = true; + + $rx->mount('/group', function () use ($rx) { + $rx->mount('/nested', function () use ($rx) { + $rx->get('/route', function () use ($rx) { + TGroup::$val = false; + }); + }); + }); + + $rx->run(); + + expect(TGroup::$val)->toBe(false); +});