module-yii2
module-yii2 copied to clipboard
seeQueue() helper
It would be nice to test if there is a job that was enqueued to check that event driven systems are working properly.
What about configuring the sync queue handler?
By default you can configure it in your test env so that tasks are handled synchronously, this makes e2e testing easier.
If we'd want to support it we could do something with handling the events emitted by the queue and making them available for inspection.
Could you give an example about configuring the sync queue handler? Do you mean using the Yii2 Synchronous queue driver just in the testing environment?
Could you give an example about configuring the sync queue handler?
Seems like something you can figure out for yourself..
Do you mean using the Yii2 Synchronous queue driver just in the testing environment?
Yes
Could you give an example about configuring the sync queue handler?
Seems like something you can figure out for yourself..
I'm not asking for a technical solution. I am just not sure what a sync queue handler is... unless it means synchronous?
Having an acceptance test run to make sure events are emitted would satisfy the testing needs.
I'm not asking for a technical solution. I am just not sure what a sync queue handler is... unless it means synchronous?
Yes, https://www.yiiframework.com/extension/yiisoft/yii2-queue/doc/guide/2.1/en/driver-sync
Having an acceptance test run to make sure events are emitted would satisfy the testing needs.
For this you could use events as I mentioned in the initial response. We could support that from this module, if you'd be willing to make a PR.
I imagine something like using Yii's class level events to listen for job submissions and storing a reference to the job.