vendredi 9 mars 2018

How Test laravel successive jobs?

I'm using Laravel 5.6 and should create feature test for some functionality. How I can test dispatching of 2 jobs, in case if the second job executed from first, under certain conditions.

it looks like this:

class FirstJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;


    public function handle()
    {
        dispatch(new SecondJob());
    }
}

sequential asserting can't see the second job.

Queue::assertPushed(FirstJob::class); // asserted

Queue::assertPushed(SecondJob::class); // not asserted

Aucun commentaire:

Enregistrer un commentaire