Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seeQueue() helper #108

Open
cgsmith opened this issue Oct 1, 2024 · 5 comments
Open

seeQueue() helper #108

cgsmith opened this issue Oct 1, 2024 · 5 comments

Comments

@cgsmith
Copy link

cgsmith commented Oct 1, 2024

It would be nice to test if there is a job that was enqueued to check that event driven systems are working properly.

@SamMousa
Copy link
Collaborator

SamMousa commented Oct 1, 2024

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.

@cgsmith
Copy link
Author

cgsmith commented Oct 1, 2024

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?

@SamMousa
Copy link
Collaborator

SamMousa commented Oct 1, 2024

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

@cgsmith
Copy link
Author

cgsmith commented Oct 1, 2024

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.

@SamMousa
Copy link
Collaborator

SamMousa commented Oct 1, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants