Queue::assertPushed() not working

Published 1 week ago by Nospoon

I have a job that's being dispatched with SendFax::dispatchNow($fax), i can confirm it being dispatched by running dd() from inside the job, however when I try to test it with Queue:fake() and then \Queue::assertPushed(SendFax::class), it claims it didn't push, the test fails with The expected [App\Jobs\SendFax] job was not pushed. I tried changing dispatchNow() to dispatch() also but that didn't help. Any ideas what could be wrong?


Mmh this should work just fine according to my tests and the docs! What version of Laravel do you use? How does the surrounding code looks like? Are you sure the job is fired somewhere?

1 day ago (19,495 XP)

Sorry, can't post the surrounding code here, but it is irrelevant to the issue either way. I've actually stumbled across the same exact problem wit \Mail::fake() today, I can verify code inside a mailable is being executed but \Mail::assertSent claims it was sent 0 times.

Please sign in or create an account to participate in this conversation.