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.php12
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);
+});