trait Illuminate / Foundation / Testing / Concerns / InteractsWithExceptionHandling

InteractsWithExceptionHandling

Properties

protected

$originalExceptionHandler ExceptionHandler |null

The original exception handler.

Default: null

Methods

protected

withExceptionHandling ( ) : $this

Restore exception handling.

protected

handleExceptions ( array $exceptions ) : $this

Only handle the given exceptions via the exception handler.

Parameters

  • $exceptions array
protected

handleValidationExceptions ( ) : $this

Only handle validation exceptions via the exception handler.

protected

withoutExceptionHandling ( array $except ) : $this

Disable exception handling for the test.

Parameters

  • $except array
protected

assertThrows ( Closure $test , string $expectedClass , string $expectedMessage ) : $this

Assert that the given callback throws an exception with the given message when invoked.

Parameters

  • $test Closure
  • $expectedClass class-string<\Throwable>
  • $expectedMessage string|null