Fixes for 2 code quality findings in RouterMatcherTest (#3930)

* Apply suggested fix to tests/Unit/FOSSBilling/RouteMatcherTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/RouteMatcherTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
This commit is contained in:
Adam DaleyandCopilot Autofix powered by AI authored and GitHub committed 2026-07-07 06:00:42 +01:00
1 parent d6c21c4b4a
commit e2e9ff1125
1 file changed
+13
@@ -11,6 +11,12 @@ test('route matcher matches exact routes for the same HTTP method', function ():
->and($match->params)->toBe([]);
});
test('route matcher rejects non-matching paths for the same HTTP method', function (): void {
$match = (new RouteMatcher())->match('get', '/invoice', [], '/invoices', 'GET');
expect($match->matched)->toBeFalse();
});
test('route matcher rejects different HTTP methods', function (): void {
$match = (new RouteMatcher())->match('post', '/invoice', [], '/invoice', 'GET');
@@ -48,6 +54,13 @@ test('route matcher accepts null conditions for routes without constrained param
expect($match->matched)->toBeTrue();
});
test('route matcher uses default parameter pattern when conditions are null', function (): void {
$match = (new RouteMatcher())->match('get', '/item/:id', null, '/item/42', 'GET');
expect($match->matched)->toBeTrue()
->and($match->params)->toBe(['id' => '42']);
});
test('route matcher extracts full placeholder names', function (): void {
$match = (new RouteMatcher())->match('get', '/item/:item_id', ['item_id' => '[0-9]+'], '/item/42', 'GET');