ExceptionHandlerFake
class ExceptionHandlerFake implements ExceptionHandler, Fake mixin Handler
Traits
Properties
| protected Throwable> | $reported | All of the exceptions that have been reported. |
|
| protected bool | $throwOnReport | If the fake should throw exceptions when they are reported. |
Methods
Forward a method call to the given object.
Forward a method call to the given object, returning $this if the forwarded call returned itself.
Throw a bad method call exception for the given method.
Get the class name of the first parameter of the given Closure.
Get the class names of the first parameter of the given Closure, including union types.
Get the class names / types of the parameters of the given Closure.
Get the class names / types of the return type of the given Closure.
Get the underlying handler implementation.
Assert if an exception of the given type has been reported.
Assert the number of exceptions that have been reported.
Assert if an exception of the given type has not been reported.
Assert nothing has been reported.
Determine if the handler is running without exception handling.
Register a callback to be called after an HTTP error response is rendered.
Throw exceptions when they are reported.
Throw the first reported exception.
Get the exceptions that have been reported.
Handle dynamic method calls to the handler.
Details
in
ForwardsCalls at line 22
protected mixed
forwardCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object.
in
ForwardsCalls at line 52
protected mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)
Forward a method call to the given object, returning $this if the forwarded call returned itself.
in
ForwardsCalls at line 66
static protected never
throwBadMethodCallException(string $method)
Throw a bad method call exception for the given method.
in
ReflectsClosures at line 25
protected string
firstClosureParameterType(Closure $closure)
Get the class name of the first parameter of the given Closure.
in
ReflectsClosures at line 48
protected array
firstClosureParameterTypes(Closure $closure)
Get the class names of the first parameter of the given Closure, including union types.
in
ReflectsClosures at line 74
protected array
closureParameterTypes(Closure $closure)
Get the class names / types of the parameters of the given Closure.
in
ReflectsClosures at line 94
protected array
closureReturnTypes(Closure $closure)
Get the class names / types of the return type of the given Closure.
at line 45
__construct(ExceptionHandler $handler, array $exceptions = [])
Create a new exception handler fake.
at line 54
ExceptionHandler
handler()
Get the underlying handler implementation.
at line 64
void
assertReported(Closure|string $exception)
Assert if an exception of the given type has been reported.
at line 92
void
assertReportedCount(int $count)
Assert the number of exceptions that have been reported.
at line 108
void
assertNotReported(Closure|string $exception)
Assert if an exception of the given type has not been reported.
at line 125
void
assertNothingReported()
Assert nothing has been reported.
at line 139
void
report(Throwable $e)
Report or log an exception.
at line 161
protected bool
isFakedException(Throwable $e)
Determine if the given exception is faked.
at line 169
bool
shouldReport(Throwable $e)
Determine if the exception should be reported.
at line 177
protected bool
runningWithoutExceptionHandling()
Determine if the handler is running without exception handling.
at line 185
Response
render(Request $request, Throwable $e)
Render an exception into an HTTP response.
at line 193
void
renderForConsole(OutputInterface $output, Throwable $e)
Render an exception to the console.
at line 201
void
afterResponse(callable $callback)
Register a callback to be called after an HTTP error response is rendered.
at line 209
ExceptionHandlerFake
throwOnReport()
Throw exceptions when they are reported.
at line 221
ExceptionHandlerFake
throwFirstReported()
Throw the first reported exception.
at line 235
array
reported()
Get the exceptions that have been reported.
at line 243
ExceptionHandlerFake
setHandler(ExceptionHandler $handler)
Set the "original" handler that should be used by the fake.
at line 255
mixed
__call(string $method, array $parameters)
Handle dynamic method calls to the handler.