summaryrefslogtreecommitdiff
path: root/tests/Unit/Enums/PathSegmentTypeTest.php
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
committerSam Light <sam@lightscale.co.uk>2026-06-10 19:00:32 +0100
commitac836311005458a10dded324420be92f44976332 (patch)
treef456556ceac141aaaeeb0093c4438a44b99e7148 /tests/Unit/Enums/PathSegmentTypeTest.php
parentc762531c8679dbb800346174913bfa21917ac0b5 (diff)
generating routes with parameters and tests
Diffstat (limited to 'tests/Unit/Enums/PathSegmentTypeTest.php')
-rw-r--r--tests/Unit/Enums/PathSegmentTypeTest.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Unit/Enums/PathSegmentTypeTest.php b/tests/Unit/Enums/PathSegmentTypeTest.php
index f2fda0a..a0a638d 100644
--- a/tests/Unit/Enums/PathSegmentTypeTest.php
+++ b/tests/Unit/Enums/PathSegmentTypeTest.php
@@ -15,3 +15,17 @@ it('has no routeMatchRegex for Root')
it('has routeMatchRegex for Parameter')
->expect(fn () => PathSegmentType::Parameter->routeMatchRegex())
->toBeString();
+
+it('matches from route string :dataset', function (string $v, PathSegmentType $type) {
+ $match = PathSegmentType::matchRouteString($v);
+ expect($match->type)->toBe($type);
+})->with([
+ $v = '{test-test}' => [$v, PathSegmentType::Parameter],
+ $v = '{test_test}' => [$v, PathSegmentType::Parameter],
+ $v = '{testTest}' => [$v, PathSegmentType::Parameter],
+ $v = '{TestTest}' => [$v, PathSegmentType::Parameter],
+ $v = '{testTest912}' => [$v, PathSegmentType::Parameter],
+ $v = 'hello-hello' => [$v, PathSegmentType::Raw],
+ $v = 'hellohello123' => [$v, PathSegmentType::Raw],
+ $v = 'hello_hello' => [$v, PathSegmentType::Raw],
+]);