File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -192,4 +192,9 @@ public function toResponse($request = null): Response
192
192
193
193
return $ response ;
194
194
}
195
+
196
+ public function getInnerException (): ?Throwable
197
+ {
198
+ return $ this ->originalException ;
199
+ }
195
200
}
Original file line number Diff line number Diff line change 18
18
use Flat3 \Lodata \Tests \TestCase ;
19
19
use Flat3 \Lodata \Type ;
20
20
use Generator ;
21
+ use Illuminate \Foundation \Exceptions \Handler ;
22
+ use Illuminate \Support \Facades \Log ;
21
23
use Illuminate \Testing \TestResponse ;
22
24
23
25
class ErrorReportingTest extends TestCase
@@ -90,11 +92,20 @@ public function test_get_original_exception()
90
92
->path ('/divzero() ' )
91
93
);
92
94
95
+ $ innerException = $ testResponse ->exception ->getOriginalException ();
96
+
93
97
if (PHP_VERSION_ID > 80000 ) {
94
- $ this ->assertInstanceOf (DivisionByZeroError::class, $ testResponse -> exception -> getOriginalException () );
98
+ $ this ->assertInstanceOf (DivisionByZeroError::class, $ innerException );
95
99
} else {
96
- $ this ->assertInstanceOf (ErrorException::class, $ testResponse -> exception -> getOriginalException () );
100
+ $ this ->assertInstanceOf (ErrorException::class, $ innerException );
97
101
}
102
+
103
+ $ spy = Log::spy ();
104
+ $ handler = app (Handler::class);
105
+ $ handler ->report ($ testResponse ->exception );
106
+ $ spy ->shouldHaveReceived ('error ' , function ($ message , $ context ) use ($ innerException ) {
107
+ return $ message === $ innerException ->getMessage () && $ context ['exception ' ] instanceof DivisionByZeroError;
108
+ });
98
109
}
99
110
100
111
public function test_stream_error ()
You can’t perform that action at this time.
0 commit comments