Skip to content

Commit f9a4470

Browse files
committed
[Routing] Add tests for Requirement::UUID_V7 & UuidV8
Add tests for Requirement::UUID_V7 & Requirement::UUID_V8
1 parent bb29d35 commit f9a4470

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Tests/Requirement/RequirementTest.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,4 +464,62 @@ public function testUuidV6KO(string $uuid)
464464
'/'.$uuid,
465465
);
466466
}
467+
468+
/**
469+
* @testWith ["00000000-0000-7000-8000-000000000000"]
470+
* ["ffffffff-ffff-7fff-bfff-ffffffffffff"]
471+
* ["01910577-4898-7c47-966e-68d127dde2ac"]
472+
*/
473+
public function testUuidV7OK(string $uuid)
474+
{
475+
$this->assertMatchesRegularExpression(
476+
(new Route('/{uuid}', [], ['uuid' => Requirement::UUID_V7]))->compile()->getRegex(),
477+
'/'.$uuid,
478+
);
479+
}
480+
481+
/**
482+
* @testWith [""]
483+
* ["foo"]
484+
* ["15baaab2-f310-11d2-9ecf-53afc49918d1"]
485+
* ["acd44dc8-d2cc-326c-9e3a-80a3305a25e8"]
486+
* ["7fc2705f-a8a4-5b31-99a8-890686d64189"]
487+
* ["1ecbc991-3552-6920-998e-efad54178a98"]
488+
*/
489+
public function testUuidV7KO(string $uuid)
490+
{
491+
$this->assertDoesNotMatchRegularExpression(
492+
(new Route('/{uuid}', [], ['uuid' => Requirement::UUID_V7]))->compile()->getRegex(),
493+
'/'.$uuid,
494+
);
495+
}
496+
497+
/**
498+
* @testWith ["00000000-0000-8000-8000-000000000000"]
499+
* ["ffffffff-ffff-8fff-bfff-ffffffffffff"]
500+
* ["01910577-4898-8c47-966e-68d127dde2ac"]
501+
*/
502+
public function testUuidV8OK(string $uuid)
503+
{
504+
$this->assertMatchesRegularExpression(
505+
(new Route('/{uuid}', [], ['uuid' => Requirement::UUID_V8]))->compile()->getRegex(),
506+
'/'.$uuid,
507+
);
508+
}
509+
510+
/**
511+
* @testWith [""]
512+
* ["foo"]
513+
* ["15baaab2-f310-11d2-9ecf-53afc49918d1"]
514+
* ["acd44dc8-d2cc-326c-9e3a-80a3305a25e8"]
515+
* ["7fc2705f-a8a4-5b31-99a8-890686d64189"]
516+
* ["1ecbc991-3552-6920-998e-efad54178a98"]
517+
*/
518+
public function testUuidV8KO(string $uuid)
519+
{
520+
$this->assertDoesNotMatchRegularExpression(
521+
(new Route('/{uuid}', [], ['uuid' => Requirement::UUID_V8]))->compile()->getRegex(),
522+
'/'.$uuid,
523+
);
524+
}
467525
}

0 commit comments

Comments
 (0)