Laravel - Mocking - Scoped Event Fakes
If you only want to fake event listeners for a portion of your test, you may use the fakeFor
method:
create();
Event::assertDispatched(OrderCreated::class);
return $order;
});
// Events are dispatched as normal and observers will run ...
$order->update([...]);
}
}