anam's avatar
Level 3

Is there any way to test delay() in jobs?

How to test a job with delayed dispatching?

dispatch(ProcessPodcast::class)
                ->delay(now()->addMinutes(10));

I have tried the following but not working.

$this->expectsJobs(ProcessPodcast::class);
0 likes
2 replies
adrian.nuernberger's avatar
$podcast = []; //should be your your model

$this->expectsEvents(ProcessPodcast::class);

ProcessPodcast::dispatch($podcast);

Thats the only way you can test events (out of the box)

Please or to participate in this conversation.