From eeb7fbbf1cbbe2ee98575e2ed284489a9885e608 Mon Sep 17 00:00:00 2001 From: Chris Lloyd Date: Thu, 21 Mar 2024 13:21:02 +0000 Subject: [PATCH] WIP --- tests/Protocol/ErrorReportingTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Protocol/ErrorReportingTest.php b/tests/Protocol/ErrorReportingTest.php index 45578ac3e..620c06e34 100644 --- a/tests/Protocol/ErrorReportingTest.php +++ b/tests/Protocol/ErrorReportingTest.php @@ -99,6 +99,27 @@ public function test_get_original_exception() } else { $this->assertInstanceOf(ErrorException::class, $innerException); } + } + + public function test_report_inner_exception() + { + if (version_compare(app()->version(), '9', '<')) { + $this->markTestSkipped(); + } + + $func = new Function_('divzero'); + $func->setCallable(function () { + /** @noinspection PhpDivisionByZeroInspection */ + $a = 4 / 0; + }); + Lodata::add($func); + + $testResponse = $this->assertInternalServerError( + (new Request) + ->path('/divzero()') + ); + + $innerException = $testResponse->exception->getOriginalException(); $spy = Log::spy(); $handler = app(Handler::class);