-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Create documentation about testing #74
base: master
Are you sure you want to change the base?
Conversation
Getting started with testing. Related to tenancy/multi-tenant#627.
Looking extremely good, but next time don't post in the issues, you can link to them from here and the PR will be shown automatically. As to the contents of the page, I see some code that we could potentially move over to the framework to make it widely available. Would you be up to attempt a PR at the hyn/multi-tenant codebase? |
Sorry about the issues reference missing. I am currently really overloaded so I don't think I get any time to PR something clean any time soon. I guess that should more or less consist in making that driver + the base test class available and provide some ways to customize a few things such as the hostname, etc. Regards |
It is good news! There are still some points to check :
Thanks. |
Hi, Feel free to amend the PR, this should get most people started with little work. Just noticed the namespace could me made more standard: Make sure you get all the proper env variable names correct in your .env and phpunit.xml files. This setup is intended to maximize speed. Hence we specifically target the |
Small addition here for the record. I was struggling with testing jobs: even though everything was running properly in production, in our tests, the models could not be restored as the tables were not found. After digging in the package, it appears that the SQLite driver clears the DB fully when asked to purge + reconnect. This is happening every time we are switching tenants. And Jobs switch tenants when they get restored to be executed (even with the Sync queue driver). The workaround is to replace the Basically we have to override the Here is the class:
We then need to register this in the container before the package providers. Hence we cannot do that within the
|
Just what I needed, thank you very much! Now all my tests are green again :) |
Hi @vpratfr is there any chance of getting an updated version for this? Pitty this was never accepted into the documentation because im currently struggling testing with the tenantAware testcase |
Hi, sorry, I am not using this library anymore. Switched to the one from spatie which is lighter and fits my use-case. |
Getting started with testing. Related to tenancy/multi-tenant#627.