Skip to content

Commit 9d94d4b

Browse files
[8.x] Add Event::assertNothingDispatched to mocking.md (#6738)
* Add Event::assertNothingDispatched to mocking.md * Update mocking.md Co-authored-by: Taylor Otwell <[email protected]>
1 parent f28876d commit 9d94d4b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mocking.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ The `Bus` facade's `assertBatched` method may be used to assert that a [batch of
222222
<a name="event-fake"></a>
223223
## Event Fake
224224

225-
When testing code that dispatches events, you may wish to instruct Laravel to not actually execute the event's listeners. Using the `Event` facade's `fake` method, you may prevent listeners from executing, execute the code under test, and then assert which events were dispatched by your application using the `assertDispatched` and `assertNotDispatched` methods:
225+
When testing code that dispatches events, you may wish to instruct Laravel to not actually execute the event's listeners. Using the `Event` facade's `fake` method, you may prevent listeners from executing, execute the code under test, and then assert which events were dispatched by your application using the `assertDispatched`, `assertNotDispatched`, and `assertNothingDispatched` methods:
226226

227227
<?php
228228

@@ -254,6 +254,9 @@ When testing code that dispatches events, you may wish to instruct Laravel to no
254254

255255
// Assert an event was not dispatched...
256256
Event::assertNotDispatched(OrderFailedToShip::class);
257+
258+
// Assert that no events were dispatched...
259+
Event::assertNothingDispatched();
257260
}
258261
}
259262

0 commit comments

Comments
 (0)