The app I am working on fires an event, when one of the Eloquent model attributes is updated.
The Eloquent model is called Job
and it is supposed to fire JobCustomerTotalAmountDueChanged
when the duration
attribute is updated. I have the following code in the JobObserver
:
public function saved(Job $job)
{
if ($job->isDirty('duration')) {
event(new JobCustomerTotalAmountDueChanged($job));
}
}
When I try to test it using Event::fake
, Eloquent events are not being fired, which means that the code in saved
method is never execured. From what I see the assertDispatched
and assertNotDispatched
methods are only available for faked events. Is there a way to assert that a particular event is/is not fired without Event::fake
?