Skip to content

Commit 117f1f2

Browse files
minor #57732 [HttpFoundation] Add tests for MethodRequestMatcher and SchemeRequestMatcher (alexandre-daubois)
This PR was merged into the 6.4 branch. Discussion ---------- [HttpFoundation] Add tests for `MethodRequestMatcher` and `SchemeRequestMatcher` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Following symfony/symfony#57714 after rebasing on 5.4 Commits ------- 5a3c2a63c7 [HttpFoundation] Add tests for `MethodRequestMatcher` and `SchemeRequestMatcher`
2 parents c3fa5c0 + 0ff17bf commit 117f1f2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Tests/RequestMatcher/MethodRequestMatcherTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ public function test(string $requestMethod, array|string $matcherMethod, bool $i
2727
$this->assertSame($isMatch, $matcher->matches($request));
2828
}
2929

30+
public function testAlwaysMatchesOnEmptyMethod()
31+
{
32+
$matcher = new MethodRequestMatcher([]);
33+
$request = Request::create('https://example.com', 'POST');
34+
$this->assertTrue($matcher->matches($request));
35+
}
36+
3037
public static function getData()
3138
{
3239
return [

Tests/RequestMatcher/SchemeRequestMatcherTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ public function test(string $requestScheme, array|string $matcherScheme, bool $i
4242
}
4343
}
4444

45+
public function testAlwaysMatchesOnParamsHeaders()
46+
{
47+
$matcher = new SchemeRequestMatcher([]);
48+
$request = Request::create('sftp://example.com');
49+
$this->assertTrue($matcher->matches($request));
50+
}
51+
4552
public static function getData()
4653
{
4754
return [

0 commit comments

Comments
 (0)