Replies: 2 comments
-
I don't see why you want to avoid calling One drawback of the old |
Beta Was this translation helpful? Give feedback.
-
Consider use Bus to fire dispatchNow. The dispatchNow() method executes the job synchronously without interacting with any queues. ref 1 2
Or just call your job like a normal class. ref 1
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I encountered an issue while writing a test for a Job. I attempted to dispatch the job using the
Job::dispatchSync()
function, but thehandle
method of the Job was not being executed. Upon investigation, I discovered thatdispatchSync
dispatches the job on a sync queue. While I'm unsure of the reasoning behind this implementation, I need a way to manually dispatch the job from unit tests.Unfortunately, I cannot use
dispatchNow
on the Job as it is not available in theDispatchable
trait. While I could manually call thehandle
function on the Job class, I would prefer to avoid this approach.Are there any alternative methods for testing the logic of Job classes?
Edit: I'm seeking to understand why jobs dispatched with dispatchSync are placed on a sync queue instead of using dispatchNow.
Beta Was this translation helpful? Give feedback.
All reactions