Skip to content

Commit 4a519fe

Browse files
committed
MQE-1703: Implicit Suite Generation for Tests
Style fixes
1 parent f353afe commit 4a519fe

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,23 @@ protected function getTestAndSuiteConfiguration(array $tests)
8181
$testConfiguration['tests'] = null;
8282
$testConfiguration['suites'] = null;
8383
$testsReferencedInSuites = SuiteObjectHandler::getInstance()->getAllTestReferences();
84-
$resolvedTests = [];
84+
$suiteToTestPair = [];
8585

8686
foreach($tests as $test) {
8787
if (array_key_exists($test, $testsReferencedInSuites)) {
8888
$suites = $testsReferencedInSuites[$test];
89-
$resolvedTests = array_merge(
90-
$resolvedTests,
91-
array_map(function ($value) use ($test) {
92-
return $value . ':' . $test;
93-
}, $suites)
94-
);
89+
foreach ($suites as $suite) {
90+
$suiteToTestPair[] = "$suite:$test";
91+
}
9592
}
9693
// configuration for tests
97-
else $testConfiguration['tests'][] = $test;
94+
else {
95+
$testConfiguration['tests'][] = $test;
96+
}
9897
}
9998
// configuration for suites
100-
foreach ($resolvedTests as $test) {
101-
list($suite, $test) = explode(":", $test);
99+
foreach ($suiteToTestPair as $pair) {
100+
list($suite, $test) = explode(":", $pair);
102101
$testConfiguration['suites'][$suite][] = $test;
103102
}
104103
$testConfigurationJson = json_encode($testConfiguration);

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ function ($type, $buffer) use ($output) {
112112
return $returnCode;
113113
}
114114

115-
/** Get an array of tests with resolved suite references from $testConfiguration
115+
/**
116+
* Get an array of tests with resolved suite references from $testConfiguration
116117
* eg: if test is referenced in a suite, it'll be stored in format suite:test
117118
* @param string $testConfigurationJson
118119
* @return array
@@ -125,12 +126,9 @@ private function resolveSuiteReferences($testConfigurationJson)
125126
$testArrayBuilder = [];
126127

127128
foreach ($suitesArray as $suite => $tests) {
128-
$testArrayBuilder = array_merge(
129-
$testArrayBuilder,
130-
array_map(function ($test) use ($suite) {
131-
return $suite . ':' . $test;
132-
}, $tests)
133-
);
129+
foreach($tests as $test){
130+
$testArrayBuilder[] = "$suite:$test";
131+
}
134132
}
135133
return array_merge($testArrayBuilder, $testsArray);
136134
}

0 commit comments

Comments
 (0)