Skip to content

Commit

Permalink
[8.x] Add Event::assertNothingDispatched to mocking.md (#6738)
Browse files Browse the repository at this point in the history
* Add Event::assertNothingDispatched to mocking.md

* Update mocking.md

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
danilopolani and taylorotwell committed Jan 12, 2021
1 parent f28876d commit 9d94d4b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mocking.md
Expand Up @@ -222,7 +222,7 @@ The `Bus` facade's `assertBatched` method may be used to assert that a [batch of
<a name="event-fake"></a>
## Event Fake

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:
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:

<?php

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

// Assert an event was not dispatched...
Event::assertNotDispatched(OrderFailedToShip::class);
// Assert that no events were dispatched...
Event::assertNothingDispatched();
}
}

Expand Down

0 comments on commit 9d94d4b

Please sign in to comment.