summaryrefslogtreecommitdiff
path: root/tests/Unit/GroupDefinitionTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/GroupDefinitionTest.php')
-rw-r--r--tests/Unit/GroupDefinitionTest.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/Unit/GroupDefinitionTest.php b/tests/Unit/GroupDefinitionTest.php
index b8e8063..f11cb87 100644
--- a/tests/Unit/GroupDefinitionTest.php
+++ b/tests/Unit/GroupDefinitionTest.php
@@ -6,6 +6,7 @@ use Lightscale\Router\Enums\HttpMethod;
use Lightscale\Router\Group;
use Lightscale\Router\GroupDefinition;
use Lightscale\Router\PathSegmentMatch;
+use Lightscale\Router\RouteDefinition;
use Lightscale\Router\Router;
$make = fn () => new GroupDefinition(new Group(new Router(), null));
@@ -25,7 +26,7 @@ it('creates group with name')
->getName()->toBe('name');
it('can make a route', function () {
- $router = new Router;
+ $router = new Router();
$group = (new Group($router, null))->prefix('/test');
$groupDef = new GroupDefinition($group);
$groupDef->make(HttpMethod::Get, '/hello/world', fn () => null);
@@ -33,3 +34,10 @@ it('can make a route', function () {
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);