Skip to content

Commit

Permalink
minor #57732 [HttpFoundation] Add tests for MethodRequestMatcher an…
Browse files Browse the repository at this point in the history
…d `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`
  • Loading branch information
nicolas-grekas committed Jul 26, 2024
2 parents c3fa5c0 + 0ff17bf commit 117f1f2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tests/RequestMatcher/MethodRequestMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public function test(string $requestMethod, array|string $matcherMethod, bool $i
$this->assertSame($isMatch, $matcher->matches($request));
}

public function testAlwaysMatchesOnEmptyMethod()
{
$matcher = new MethodRequestMatcher([]);
$request = Request::create('https://example.com', 'POST');
$this->assertTrue($matcher->matches($request));
}

public static function getData()
{
return [
Expand Down
7 changes: 7 additions & 0 deletions Tests/RequestMatcher/SchemeRequestMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ public function test(string $requestScheme, array|string $matcherScheme, bool $i
}
}

public function testAlwaysMatchesOnParamsHeaders()
{
$matcher = new SchemeRequestMatcher([]);
$request = Request::create('sftp://example.com');
$this->assertTrue($matcher->matches($request));
}

public static function getData()
{
return [
Expand Down

0 comments on commit 117f1f2

Please sign in to comment.