Skip to content

Allow overriding constant values of integration test settings per ENV #40525

@stollr

Description

@stollr

Summary

This request is mainly about overriding the TESTS_CLEANUP constant value in integration tests. Currently this value can be changed in the phpunit.xml. But this is very static and cannot be overridden easily.

My use case:
In my local dev environment I usually want to run the integration tests without the cleanup, because it takes too long. But when there are new migration scripts or modules, I want the cleanup to be executed.

Currently this requires me to edit the phpunit.xml, which is quite annoying.

Therefore I suggest to make the integration test settings overridable per env variables.

Then I can run TESTS_CLEANUP=disable vendor/bin/phpunit -c dev/tests/integration/phpunit.xml

Examples

The patch would simply be

diff --git a/dev/tests/integration/framework/bootstrap.php b/dev/tests/integration/framework/bootstrap.php
index 09f599217ca..749f3394c1b 100644
--- a/dev/tests/integration/framework/bootstrap.php
+++ b/dev/tests/integration/framework/bootstrap.php
@@ -30,7 +30,10 @@ try {
     setCustomErrorHandler();
 
     /* Bootstrap the application */
-    $settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, get_defined_constants());
+    $settings = new \Magento\TestFramework\Bootstrap\Settings($testsBaseDir, array_replace(
+        get_defined_constants(),
+        getenv()
+    ));
 
     $testFrameworkDir = __DIR__;
     require_once 'deployTestModules.php';

Proposed solution

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Ready for Grooming

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions