minor #38078 [FrameworkBundle] Fix Tests on PHPUnit 9.3 (derrabus)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Fix Tests on PHPUnit 9.3

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #37564
| License       | MIT
| Doc PR        | N/A

When joining two constraints with a `LogicalAnd`, PHPUnit will generate a failure message where the message omitted by the first constraint will be wrapped in parenthesis. I'm using a regular expression now, so we can support both variants.

Commits
-------

8bc36d7420 [FrameworkBundle] Fix Tests on PHPUnit 9.3.
This commit is contained in:
Fabien Potencier 2020-09-07 07:09:25 +02:00
commit 043e7c34de

View File

@ -70,7 +70,7 @@ class WebTestCaseTest extends TestCase
{
$this->getResponseTester(new Response('', 302, ['Location' => 'https://example.com/']))->assertResponseRedirects('https://example.com/', 302);
$this->expectException(AssertionFailedError::class);
$this->expectExceptionMessage('is redirected and has header "Location" with value "https://example.com/" and status code is 301.');
$this->expectExceptionMessageMatches('#(:?\( )?is redirected and has header "Location" with value "https://example\.com/" (:?\) )?and status code is 301\.#');
$this->getResponseTester(new Response('', 302))->assertResponseRedirects('https://example.com/', 301);
}