production
production copied to clipboard
TestBootstrap.php not using bootEnv
PHP Version
8.1
Shopware Version
6.4.7.0
Expected behaviour
TestBootstrap.php to use bootEnv as all other files do, similar to Symfony's own bootstrap.php
Even better also move it to the tests
folder as it has nothing to do with src
.
Actual behaviour
Uses .env.test
directly.
How to reproduce
Create a test case and not use APP_ENV=test but a custom test APP_ENV.
I guess that file can be completly deleted as https://github.com/shopware/platform/blob/trunk/src/Core/TestBootstrapper.php should be used
@shyim OK. But from what I can see that one also uses loadEnv
instead of bootEnv
.
ooof . I forgot to change it there 😅
@shyim Should testbootstrap not actually be changed completely to use the TestBootstrapper?
Yes
Didn't I changed it already 🤔
https://github.com/shopware/platform/commit/e11ac0c230fa99b17d186b874883b0731a5a9b5f
@shyim Yes, but this file still exists: https://github.com/shopware/production/blob/6.4/src/TestBootstrap.php and does not use the TestBootstrapper. I think it might be good to keep a test bootstrap in the template but I would moved it to tests/bootstrap.php (as symfony default has) and use TestBootstrapper there too? or just include the platform TestBootstrap.php file?
Especially as the phpunit.xml.dist still points to it https://github.com/shopware/production/blob/6.4/phpunit.xml.dist
Feel free to make a PR :) reopend need a coffee 😅
@shyim just wondering but is this file https://github.com/shopware/production/blob/6.4/config/services/defaults_test.xml still needed? because if I see it correctly the test bootstrapper nor just uses the same key (which I think is fine, there should be no need to differentiate).
I am not sure. I would remove it and look if the test suite still passes 🙈 . Maybe @pweyck can say more
We removed that file from the new template for now. I will look into adding a new flex package which adds this config back as I guess most of the users didn't event used that