diff --git a/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php b/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php index c1fa076f2167..3a65ae9368da 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php +++ b/src/Illuminate/Foundation/Testing/Concerns/MocksApplicationServices.php @@ -98,8 +98,6 @@ public function doesntExpectEvents($events) */ protected function withoutEvents() { - $this->withoutModelEvents(); - $mock = Mockery::mock('Illuminate\Contracts\Events\Dispatcher'); $mock->shouldReceive('fire')->andReturnUsing(function ($called) { diff --git a/tests/Foundation/FoundationExpectsModelEventsTest.php b/tests/Foundation/FoundationExpectsModelEventsTest.php index 3411c1c0f355..e6959d074b4e 100644 --- a/tests/Foundation/FoundationExpectsModelEventsTest.php +++ b/tests/Foundation/FoundationExpectsModelEventsTest.php @@ -105,6 +105,18 @@ public function expects_model_events_can_take_a_string_as_the_event_name() EloquentTestModel::create(['field' => 1]); } + /** @test */ + public function expects_events_fires_on_model_events() + { + EloquentTestModel::created(function () { + event(ExampleEvent::class); + }); + + $this->expectsEvents(ExampleEvent::class); + + EloquentTestModel::create(['field' => 1]); + } + /** @test */ public function unfired_events_can_be_checked_for() {