-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Allow usage of config-global.php when running Integration Tests #16361
Allow usage of config-global.php when running Integration Tests #16361
Conversation
Hi @jissereitsma. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
Hi @sidolov, thank you for the review. |
Hi @jissereitsma. Thank you for your contribution. Please, consider to port this solution to 2.3 release line. |
@jissereitsma I know this PR is old. In current Magento 2.4.7 the Now, I do not find a way to adjust the default config. |
@stollr The same problem here, have you found any solutiuon? |
No, I changed something else, so that I do not need it anymore... |
The entire workings of this PR has gone cold a bit. But since this, I'm actually using myself a custom-made librari Yireo IntegrationTestHelper that gives you an OOP-syntax to return the setup variables used by the TestFramework. And this includes an advanced way to include and exclude exactly those modules that you want. https://github.com/yireo/Yireo_IntegrationTestHelper Specifically, this is the thing I'm referring to: $disableModules = (new DisableModules())
->disableAll()
->enableMagento()
->disableByPattern('Sample')
->disableMagentoInventory()
->disableGraphQl()
->enableByName('Yireo_GoogleTagManager2')
->toString();
return (new InstallConfig())
->setDisableModules($disableModules)
->get(); In other words, this scans for all existing modules in your instance, then only enables the Magento core modules, but then disabling MSI, GraphQL and sample data. Usually, this means that the modules are skinned down to 100 modules or less - which also saves a lot of time during the setup. Sorry for the self-promotion, but I guess this is useful to others. |
When running Integration Tests (
bin/magento dev:tests:run integration
), you will need to customize a couple of files to properly setup the testing environment. Part of this procedure is customizing thephpunit.xml
which also defines a fileTESTS_GLOBAL_CONFIG_FILE
(pointing to eitheretc/config-global.php
oretc/config-global.php.dist
). However, configuration files defined in thisTESTS_GLOBAL_CONFIG_FILE
never end up in the sandbox environment. This issue was also encountered in another issue #15196With this PR, the
TESTS_GLOBAL_CONFIG_FILE
is actually put to use. TheTESTS_GLOBAL_CONFIG_FILE
is picked up properly by the existing bootstrap and then passed on to the constructor of the testing application class. Next, theinstall()
method of the application class is run. This is where the bug occurs. The internal variable$this->globalConfigFile
is never used. This PR adds the actual usage of this variable.Fixed Issues
Manual testing scenarios
dev/tests/integration/tmp/sandbox-*
. Theetc/config.php
file in this sandbox should include the entries from eitheretc/config-global.php
oretc/config-global.php.dist
. However, it does not.etc/config.local.php
file in the sandbox now should include the entries from theetc/config-global.php
file. And this is merged together with theetc/config.php
, containing all of the modules added through the Magento setup procedure.Contribution checklist