Skip to content

Commit 41c14d4

Browse files
committed
MQE-2669: Seprated a run:failed command to generate:failed and run:failed
- fix a bug
1 parent dd29a86 commit 41c14d4

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/Magento/FunctionalTestingFramework/Console/RunTestFailedCommand.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ function ($type, $buffer) use ($output) {
109109
/**
110110
* Returns a list of tests/suites which should have an additional run.
111111
*
112-
* @param string $failedTests
112+
* @param array $failedTests
113113
* @return array
114114
*/
115-
private function filterTestsForExecution(string $failedTests): array
115+
private function filterTestsForExecution(array $failedTests): array
116116
{
117117
$testsOrGroupsToRerun = [];
118118

@@ -126,7 +126,10 @@ private function filterTestsForExecution(string $failedTests): array
126126
if ($suiteName === self::DEFAULT_TEST_GROUP) {
127127
$testsOrGroupsToRerun[] = $testPath;
128128
} else {
129-
$testsOrGroupsToRerun[] = "-g " . $suiteName;
129+
$group = "-g " . $suiteName;
130+
if (!in_array($group, $testsOrGroupsToRerun)) {
131+
$testsOrGroupsToRerun[] = $group;
132+
}
130133
}
131134
}
132135
}
@@ -138,11 +141,16 @@ private function filterTestsForExecution(string $failedTests): array
138141
* Returns an array of tests read from the failed test file in _output
139142
*
140143
* @param string $filePath
141-
* @return array|boolean
144+
* @return array
142145
*/
143-
private function readFailedTestFile($filePath)
146+
private function readFailedTestFile(string $filePath): array
144147
{
145-
return file($filePath, FILE_IGNORE_NEW_LINES);
148+
$data = [];
149+
if (file_exists($filePath)) {
150+
$file = file($filePath, FILE_IGNORE_NEW_LINES);
151+
$data = $file === false ? [] : $file;
152+
}
153+
return $data;
146154
}
147155

148156
/**

0 commit comments

Comments
 (0)