Michiel Gerritsen shows us how to test jobs in Laravel.

laravel testing jobs

Recently someone in a Slack channel i’m a member of asked the following:

I want to test if job A fires job B, but how do you test something like that?

Niek ten Hoopen Especially when the queue is set up to be run asychronus this seems impossible to test. The normal flow would be something like this:

Controller -> job A -> job B Now how do you test this? The answer is pretty simple: You test job A separate from your controller and job B