diff options
| author | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
|---|---|---|
| committer | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
| commit | 968662ee16a1efc7cb7c176a42af91f36eecc9ca (patch) | |
| tree | b700510f895c8e059f17d8fcabbb8b8d5471824f /tests/Unit/GroupDefinitionTest.php | |
| parent | 25780fef281782ce7e88c27cb23cb3d9e9d6bd03 (diff) | |
Create a group route and name it
Diffstat (limited to 'tests/Unit/GroupDefinitionTest.php')
| -rw-r--r-- | tests/Unit/GroupDefinitionTest.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/Unit/GroupDefinitionTest.php b/tests/Unit/GroupDefinitionTest.php index 59a8d3d..b8e8063 100644 --- a/tests/Unit/GroupDefinitionTest.php +++ b/tests/Unit/GroupDefinitionTest.php @@ -2,8 +2,10 @@ declare(strict_types=1); +use Lightscale\Router\Enums\HttpMethod; use Lightscale\Router\Group; use Lightscale\Router\GroupDefinition; +use Lightscale\Router\PathSegmentMatch; use Lightscale\Router\Router; $make = fn () => new GroupDefinition(new Group(new Router(), null)); @@ -21,3 +23,13 @@ it('creates group with name') ->expect(fn () => $make()->name('name')) ->toBeInstanceOf(Group::class) ->getName()->toBe('name'); + +it('can make a route', function () { + $router = new Router; + $group = (new Group($router, null))->prefix('/test'); + $groupDef = new GroupDefinition($group); + $groupDef->make(HttpMethod::Get, '/hello/world', fn () => null); + + expect($router->findSegment('/test/hello/world')) + ->toBeInstanceOf(PathSegmentMatch::class); +}); |
