Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #36003 [ErrorHandler][FrameworkBundle] better error messages …
…in failing tests (guillbdx) This PR was squashed before being merged into the 5.1-dev branch. Discussion ---------- [ErrorHandler][FrameworkBundle] better error messages in failing tests | Q | A | ------------- | --- | Branch? | master for features | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #32752 | License | MIT | Doc PR | Purpose of this PR is to enhance tests by giving a way to report an exception that occured during the processing of the request. The ErrorHandler will add an X-Debug-Exception, and the assertThat() method of WebTestCase will throw an exception if this header exists and status code is 5xx. In practice, this adds the "Caused by" section in this example: ``` Time: 374 ms, Memory: 20.00 MB There was 1 failure: 1) App\Tests\Controller\HomeControllerTest::testC Failed asserting that the Response has header "Content-Type" with value "application/json". /srv/symfony/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php:132 /srv/symfony/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php:66 /srv/blog/tests/Controller/HomeControllerTest.php:29 Caused by Exception: This a test exception. in /the/file.php:139 Stack trace: [...] ``` Commits ------- 0da9469 [ErrorHandler][FrameworkBundle] better error messages in failing tests
- Loading branch information
Showing
6 changed files
with
61 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters