-
Notifications
You must be signed in to change notification settings - Fork 9.4k
2.2.4 : Magento 2 integration tests enables all modules #15196
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
Comments
As a (hopefully temporary) workaround for this I came up with a solution where I created a wrapper around the bootstrap (call it a "bootwrap" if you may). So in my
And
Basically, the only thing it does, is copy your |
This issue actually leads to a bigger issue. Within the Once this fix is included in Magento, you can create a new file My bootstrap bootstrap="./etc/custom-bootstrap.php" The bootstrap file itself looks like this: <?php
$defaultConfig = include __DIR__ . '/config-global.php.dist';
$actualConfig = include __DIR__ . '/../../../../app/etc/config.php';
$newConfig = array_merge($defaultConfig, $actualConfig);
$code = var_export($newConfig, true);
$code = "<?php\n return " . preg_replace('/stdClass::__set_state/', '(object)', $code) . ';';
file_put_contents(__DIR__ . '/config-global.php', $code);
include_once __DIR__ . '/../framework/bootstrap.php'; |
PR created: #16361 |
It turns out my little trick no longer works (perhaps the 2.2.5 update caused it to stop working). Isn't there any way to disable certain modules for running integration tests on a local development setup? Anyone? Already spent way too much time on this one. @magento-engcom-team : perhaps add an extra flag to edit: I checked my Git log and indeed: my little trick stopped working since the 2.2.5 update |
So I seem to have "fixed" it once again with yet another dirty hack. Instead of having to copy/paste the original So I copied the original
Original:
My version:
I had to use an anonymous class because the Also, I had to override the So this way the integration tests on our CI server will run on an installation that reflects our production setup. |
Hi @kanduvisla. Thank you for your report.
The fix will be available with the upcoming 2.2.8 release. |
Hi @kanduvisla. Thank you for your report.
The fix will be available with the upcoming 2.3.1 release. |
@mage2pratik's patch seems to be somewhat broken. It copies the config file successfully, but the Environment: |
I had the same thing with Magento 2.3.2. What i've done is:
Then change the
When |
Hi @Tjitse-E , I have confirmed that |
Confirmed as well:In
This is the method that returns However, we found a different solution:In
|
@schmengler Haha, we should bundle these resources. Because I've been using |
@jissereitsma Nice, would you share it here? I guess it reads |
@schmengler Argh, just looked it up but I threw it out. I'm currently relying on composer replace, combined with MySQL in tmpfs, combined with ReachDigitals framework. Anyway, the function simply did an include of the original |
This issue still exists in Magento 2.4.1. Why is this closed? |
If I understand the issue correctly, it is still there (2.4.2) - I am unable to use custom |
Come here to disable modules during integration tests too.
|
@PascalBrouwers As As I'm strongly disappointed with the approach (and I lock some configurations, to make sure Client won't cut their hands playing with the configuration), I created a Composer Patch to diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php
--- a/dev/tests/integration/framework/Magento/TestFramework/Application.php
+++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php
@@ -293,8 +293,12 @@
*/
public function isInstalled()
{
// phpcs:ignore Magento2.Functions.DiscouragedFunction
- return is_file($this->getLocalConfig());
+ $envFile = $this->_configDir . '/env.php';
+ if (is_file($envFile)) {
+ $envConfig = include $envFile;
+ return $envConfig['install']['date'] ?? false;
+ }
}
/**
@@ -547,7 +547,7 @@
private function copyAppConfigFiles()
{
$globalConfigFiles = Glob::glob(
- $this->_globalConfigDir . '/{di.xml,*/di.xml,db_schema.xml,vendor_path.php}',
+ $this->_globalConfigDir . '/{di.xml,*/di.xml,db_schema.xml,vendor_path.php,config.php}',
Glob::GLOB_BRACE
);
foreach ($globalConfigFiles as $file) { So, if you have disabled a module in |
By default, I disable a lot of modules in my Magento setup, simply because I don't need them and I wish to spare my resources for the modules that I do need.
But I am currently in the situation where my integration test suite always runs with all modules enabled, whereas I want the suite to run again the same configuration is my store (so with a bunch of modules disabled).
A simple example: I don't use the
Vertex_Tax
-module so I have disabled it, but now my integration test suite is failing because some interceptors of this module expect some data to be populated:Preconditions
Steps to reproduce
Expected result
The integration test suite should respect the enabled / disabled module status.
Actual result
The integration test suite enables all modules.
The text was updated successfully, but these errors were encountered: