new GroupDefinition(new Group(new Router(), null)); it('initializes') ->expect(fn () => $make()) ->toBeInstanceOf(GroupDefinition::class); it('creates group with prefix') ->expect(fn () => $make()->prefix('/test')) ->toBeInstanceOf(Group::class) ->getPrefix()->toBe('/test'); 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); }); it('returns RouteDefinition when making :dataset route') ->with('http-methods') ->expect(fn (HttpMethod $m) => (new GroupDefinition((new Group(new Router(), null))->prefix('/test'))) ->{$m->value}('/hello', fn () => null) ) ->toBeInstanceOf(RouteDefinition::class);