File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
src/Illuminate/Support/Testing/Fakes
tests/Integration/Support Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,16 @@ public function throwFirstReported()
248
248
return $ this ;
249
249
}
250
250
251
+ /**
252
+ * Get the exceptions that have been reported.
253
+ *
254
+ * @return list<\Throwable>
255
+ */
256
+ public function reported ()
257
+ {
258
+ return $ this ->reported ;
259
+ }
260
+
251
261
/**
252
262
* Set the "original" handler that should be used by the fake.
253
263
*
Original file line number Diff line number Diff line change @@ -23,13 +23,17 @@ public function testFakeAssertReported()
23
23
{
24
24
Exceptions::fake ();
25
25
26
- Exceptions::report (new RuntimeException ('test 1 ' ));
26
+ Exceptions::report ($ thrownException = new RuntimeException ('test 1 ' ));
27
27
report (new RuntimeException ('test 2 ' ));
28
28
29
29
Exceptions::assertReported (RuntimeException::class);
30
30
Exceptions::assertReported (fn (RuntimeException $ e ) => $ e ->getMessage () === 'test 1 ' );
31
31
Exceptions::assertReported (fn (RuntimeException $ e ) => $ e ->getMessage () === 'test 2 ' );
32
32
Exceptions::assertReportedCount (2 );
33
+
34
+ $ reported = Exceptions::reported ();
35
+ $ this ->assertCount (2 , $ reported );
36
+ $ this ->assertSame ($ thrownException , $ reported [0 ]);
33
37
}
34
38
35
39
public function testFakeAssertReportedCount ()
You can’t perform that action at this time.
0 commit comments