Skip to content

Commit

Permalink
[8.x] Adds withoutExceptionHandling and `withoutDeprecationHandling…
Browse files Browse the repository at this point in the history
…` docs (#7375)

* Adds `withoutExceptionHandling` and `withoutDeprecationHandling` documentation

* Typo

* formatting

Co-authored-by: Taylor Otwell <taylorotwell@gmail.com>
  • Loading branch information
nunomaduro and taylorotwell authored Oct 20, 2021
1 parent 56538c4 commit 292b092
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions http-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Cookies](#cookies)
- [Session / Authentication](#session-and-authentication)
- [Debugging Responses](#debugging-responses)
- [Exception Handling](#exception-handling)
- [Testing JSON APIs](#testing-json-apis)
- [Fluent JSON Testing](#fluent-json-testing)
- [Testing File Uploads](#testing-file-uploads)
Expand Down Expand Up @@ -207,6 +208,17 @@ After making a test request to your application, the `dump`, `dumpHeaders`, and
}
}

<a name="exception-handling"></a>
### Exception Handling

Sometimes you may want to test that your application is throwing a specific exception. To ensure that the exception does not get caught by Laravel's exception handler and returned as an HTTP response, you may invoke the `withoutExceptionHandling` method before making your request:

$response = $this->withoutExceptionHandling()->get('/');

In addition, if you would like to ensure that your application is not utilizing features that have been deprecated by the PHP language or the libraries your application is using, you may invoke the `withoutDeprecationHandling` method before making your request. When deprecation handling is disabled, deprecation warnings will be converted to exceptions, thus causing your test to fail:

$response = $this->withoutDeprecationHandling()->get('/');

<a name="testing-json-apis"></a>
## Testing JSON APIs

Expand Down

0 comments on commit 292b092

Please sign in to comment.