Skip to content

Commit 6c58902

Browse files
authored
Merge pull request laravel#757 from stevenwadejr/fix/dispatch-missing-from-test-event-mock
Add `dispatch` method as a mock to the Event Dispatcher in `TestCase`
2 parents 0e9ba16 + 52a6bba commit 6c58902

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Testing/TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function expectsEvents($events)
186186

187187
$mock = Mockery::spy('Illuminate\Contracts\Events\Dispatcher');
188188

189-
$mock->shouldReceive('fire')->andReturnUsing(function ($called) use (&$events) {
189+
$mock->shouldReceive('fire', 'dispatch')->andReturnUsing(function ($called) use (&$events) {
190190
foreach ($events as $key => $event) {
191191
if ((is_string($called) && $called === $event) ||
192192
(is_string($called) && is_subclass_of($called, $event)) ||
@@ -218,7 +218,7 @@ protected function withoutEvents()
218218
{
219219
$mock = Mockery::mock('Illuminate\Contracts\Events\Dispatcher');
220220

221-
$mock->shouldReceive('fire');
221+
$mock->shouldReceive('fire', 'dispatch');
222222

223223
$this->app->instance('events', $mock);
224224

0 commit comments

Comments
 (0)