Skip to content

Commit 5ba993a

Browse files
committed
MQE-1703: Implicit Suite Generation for Tests
fixing unit tests
1 parent 315616f commit 5ba993a

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/Magento/FunctionalTestingFramework/Console/BaseGenerateCommand.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,9 @@ protected function getTestAndSuiteConfiguration(array $tests)
9191
}
9292

9393
foreach ($suiteGroup as $test => $suites) {
94-
9594
foreach ($suites as $suite) {
9695
$testConfiguration['suites'][$suite][] = $test;
9796
}
98-
9997
}
10098
return $testConfiguration;
10199
}

src/Magento/FunctionalTestingFramework/Console/RunTestCommand.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8181
$codeceptionCommand = realpath(PROJECT_ROOT . '/vendor/bin/codecept') . ' run functional ';
8282
$testsDirectory = TESTS_MODULE_PATH . DIRECTORY_SEPARATOR . TestGenerator::GENERATED_DIR . DIRECTORY_SEPARATOR;
8383
//execute only tests specified as arguments in run command
84-
foreach ($resolvedTests as $test){
84+
foreach ($resolvedTests as $test) {
8585
// for tests in suite, set directory as suite name
86-
if (strpos($test, ':' )) {
86+
if (strpos($test, ':')) {
8787
list($suite, $testName) = explode(":", $test);
8888
}
8989
// for standalone tests set directory as "default"
@@ -114,22 +114,23 @@ function ($type, $buffer) use ($output) {
114114

115115
/** Get an array of tests with resolved suite references from $testConfiguration
116116
* eg: if test is referenced in a suite, it'll be stored in format "SuiteName:Testname";
117-
* if not it'll be stored as is.
118-
* @param $testConfiguration
117+
* @param array $testConfiguration
119118
* @return array
120119
*/
121-
private function getResolvedTests($testConfiguration)
120+
private function getResolvedTests(array $testConfiguration)
122121
{
123122
$testsArray = $testConfiguration['tests'] ?? [];
124123
$suitesArray = $testConfiguration['suites'] ?? [];
125124
$testArrayBuilder = [];
125+
126126
foreach ($suitesArray as $suite => $tests) {
127-
$testArrayBuilder = array_merge($testArrayBuilder,
128-
array_map(function($test) use ($suite)
129-
{ return $suite . ':' . $test ; }, $tests));
127+
$testArrayBuilder = array_merge(
128+
$testArrayBuilder,
129+
array_map(function ($test) use ($suite) {
130+
return $suite . ':' . $test;
131+
}, $tests)
132+
);
130133
}
131134
return array_merge($testArrayBuilder, $testsArray);
132-
133-
134135
}
135136
}

0 commit comments

Comments
 (0)