diff --git a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php index 42a929a51388..eb699b3e967e 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php +++ b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithTestCaseLifecycle.php @@ -25,6 +25,7 @@ use Illuminate\View\Component; use Mockery; use Mockery\Exception\InvalidCountException; +use Throwable; trait InteractsWithTestCaseLifecycle { @@ -145,8 +146,13 @@ protected function tearDownTheTestEnvironment(): void $this->afterApplicationCreatedCallbacks = []; $this->beforeApplicationDestroyedCallbacks = []; - $this->originalExceptionHandler = null; - $this->originalDeprecationHandler = null; + if (property_exists($this, 'originalExceptionHandler')) { + $this->originalExceptionHandler = null; + } + + if (property_exists($this, 'originalDeprecationHandler')) { + $this->originalDeprecationHandler = null; + } AboutCommand::flushState(); Artisan::forgetBootstrappers();