Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit b0e065f

Browse files
committed
test: add test for nested dynamic groups
1 parent f6e899d commit b0e065f

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/groups.test.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,23 @@ class TGroup
124124
expect($rx2Routes[count($rx2Routes) - 2]['pattern'] ?? null)->toBe('/group/nested/route');
125125
expect($rx2Routes[count($rx2Routes) - 1]['pattern'] ?? null)->toBe('/group/nested2/route');
126126
});
127+
128+
test('dynamic nested route groups', function () {
129+
$_SERVER['REQUEST_URI'] = '/hiddenGroup/1/route';
130+
131+
$rx = new Router;
132+
133+
TGroup::$val = true;
134+
135+
$rx->mount('/hiddenGroup', function () use ($rx) {
136+
$rx->mount('/(\d+)', function () use ($rx) {
137+
$rx->get('/route', function () use ($rx) {
138+
TGroup::$val = 'Hidden response';
139+
});
140+
});
141+
});
142+
143+
$rx->run();
144+
145+
expect(TGroup::$val)->toBe('Hidden response');
146+
});

0 commit comments

Comments
 (0)