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

Recommend to load fixtures in function _before() and set cleanup: false? #35

Open
ThomasLandauer opened this issue Nov 30, 2024 · 0 comments

Comments

@ThomasLandauer
Copy link
Member

I'm observing that with cleanup: true, running external commands with $I->runShellCommand('php bin/console ...'); isn't working. I'm guessing this is due to the transaction, which prevents external processes to "see" the database contents created/modified by the test. Can you confirm this?

If so, I would suggest to change the recommendation at https://codeception.com/docs/modules/Doctrine to cleanup: false, and show people how to load their fixtures in function _before():

$I->runShellCommand('php bin/console doctrine:fixtures:load --no-interaction --env=test');

IMO the currently recommended way to cleanup after each test doesn't work out, since for some tests it's necessary to disable the transaction (see above) - which ultimately leads to a mess.
So I'm figuring the best approach would be to just reload the fixtures before each test.

What do you think? How do you handle that?

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

1 participant