diff --git a/src/Codeception/Lib/Connector/Laravel.php b/src/Codeception/Lib/Connector/Laravel.php index ff6499c..ab07df3 100644 --- a/src/Codeception/Lib/Connector/Laravel.php +++ b/src/Codeception/Lib/Connector/Laravel.php @@ -6,7 +6,6 @@ use Closure; use Codeception\Lib\Connector\Laravel\ExceptionHandlerDecorator as LaravelExceptionHandlerDecorator; -use Codeception\Lib\Connector\Laravel6\ExceptionHandlerDecorator as Laravel6ExceptionHandlerDecorator; use Codeception\Module\Laravel as LaravelModule; use Codeception\Stub; use Dotenv\Dotenv; @@ -154,14 +153,7 @@ private function initialize(SymfonyRequest $request = null): void $this->getEvents()->listen('*', $listener); - // Replace the Laravel exception handler with our decorated exception handler, - // so exceptions can be intercepted for the disable_exception_handling functionality. - if (version_compare(Application::VERSION, '7.0.0', '<')) { - $decorator = new Laravel6ExceptionHandlerDecorator($this->getExceptionHandler()); - } else { - $decorator = new LaravelExceptionHandlerDecorator($this->getExceptionHandler()); - } - + $decorator = new LaravelExceptionHandlerDecorator($this->getExceptionHandler()); $decorator->exceptionHandlingDisabled($this->exceptionHandlingDisabled); $this->app->instance(ExceptionHandler::class, $decorator); diff --git a/src/Codeception/Lib/Connector/Laravel6/ExceptionHandlerDecorator.php b/src/Codeception/Lib/Connector/Laravel6/ExceptionHandlerDecorator.php deleted file mode 100644 index 2bca70c..0000000 --- a/src/Codeception/Lib/Connector/Laravel6/ExceptionHandlerDecorator.php +++ /dev/null @@ -1,94 +0,0 @@ -laravelExceptionHandler = $exceptionHandler; - } - - public function exceptionHandlingDisabled(bool $exceptionHandlingDisabled): void - { - $this->exceptionHandlingDisabled = $exceptionHandlingDisabled; - } - - /** - * Report or log an exception. - * - * @throws Exception - */ - public function report(Exception $e): void - { - $this->laravelExceptionHandler->report($e); - } - - /** - * Determine if the exception should be reported. - */ - public function shouldReport(Exception $e): bool - { - return $this->exceptionHandlingDisabled; - } - - /** - * Render an exception into an HTTP response. - * - * @param Request $request - * @throws Exception - */ - public function render($request, Exception $e): Response - { - $response = $this->laravelExceptionHandler->render($request, $e); - - if ($this->exceptionHandlingDisabled && $this->isSymfonyExceptionHandlerOutput($response->getContent())) { - // If content was generated by the \Symfony\Component\Debug\ExceptionHandler class - // the Laravel application could not handle the exception, - // so re-throw this exception if the Codeception user disabled Laravel exception handling. - throw $e; - } - - return $response; - } - - /** - * Check if the response content is HTML output of the Symfony exception handler class. - */ - private function isSymfonyExceptionHandlerOutput(string $content): bool - { - return strpos($content, '
') !== false || - strpos($content, '
') !== false; - } - - /** - * Render an exception to the console. - * - * @param OutputInterface $output - */ - public function renderForConsole($output, Exception $e): void - { - $this->laravelExceptionHandler->renderForConsole($output, $e); - } - - /** - * @param string|callable $method - */ - public function __call($method, array $args) - { - return call_user_func_array([$this->laravelExceptionHandler, $method], $args); - } -} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy