Skip to content

Commit 1a2dc67

Browse files
committed
MQE-1703: Implicit Suite Generation for Tests
fixing unit tests
1 parent 79ff347 commit 1a2dc67

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,26 @@ protected function getTestAndSuiteConfiguration(array $tests)
8080
{
8181
$testConfiguration['tests'] = [];
8282
$testConfiguration['suites'] = [];
83-
$allSuiteTests = SuiteObjectHandler::getInstance()->getAllTestReferences();
84-
$suiteGroup = [];
83+
$testsReferencedInSuites = SuiteObjectHandler::getInstance()->getAllTestReferences();
84+
$resolvedTests = [];
8585

8686
foreach($tests as $test) {
87-
if (array_key_exists($test, $allSuiteTests)) {
88-
$suiteGroup[$test] = $allSuiteTests[$test];
87+
if (array_key_exists($test, $testsReferencedInSuites)) {
88+
$suites = $testsReferencedInSuites[$test];
89+
$resolvedTests = array_merge(
90+
$resolvedTests,
91+
array_map(function ($value) use ($test) {
92+
return $value . ':' . $test;
93+
}, $suites)
94+
);
8995
}
96+
// configuration for tests
9097
else $testConfiguration['tests'][] = $test;
9198
}
92-
93-
foreach ($suiteGroup as $test => $suites) {
94-
foreach ($suites as $suite) {
95-
$testConfiguration['suites'][$suite][] = $test;
96-
}
99+
// configuration for suites
100+
foreach ($resolvedTests as $test) {
101+
list($suite, $test) = explode(":", $test);
102+
$testConfiguration['suites'][$suite][] = $test;
97103
}
98104
return $testConfiguration;
99105
}

0 commit comments

Comments
 (0)