Courses

Advanced Laravel Testing

Testing Job Dispatching with Bus::fake()

Previous: Testing File Uploads with Storage::fake()
avatar

Hello Povilas,

I found that in order to test the code inside the job(for example you created a record in db inside the job, and assert), I supposed to change set the QUEUE_CONNECTION to sync in .env.testing file, otherwise the testcase fails, is that the correct way of testing the code inside the job ?

👍 1
avatar

Yes, from what I remember, for testing the queues should be disabled, like you're saying here.

avatar
You can use Markdown
avatar
You can use Markdown