@@ -126,18 +126,20 @@ private function getFailedTestList()
126
126
$ testList = $ this ->readFailedTestFile (self ::TESTS_FAILED_FILE );
127
127
128
128
foreach ($ testList as $ test ) {
129
- $ this ->writeFailedTestToFile ($ test , self ::TESTS_RERUN_FILE );
130
- $ testInfo = explode (DIRECTORY_SEPARATOR , $ test );
131
- $ testName = explode (": " , $ testInfo [count ($ testInfo ) - 1 ])[1 ];
132
- $ suiteName = $ testInfo [count ($ testInfo ) - 2 ];
133
-
134
- if ($ suiteName == self ::DEFAULT_TEST_GROUP ) {
135
- array_push ($ failedTestDetails ['tests ' ], $ testName );
136
- } else {
137
- $ failedTestDetails ['suites ' ] = array_merge_recursive (
138
- $ failedTestDetails ['suites ' ],
139
- [$ suiteName => [$ testName ]]
140
- );
129
+ if (!empty ($ test )) {
130
+ $ this ->writeFailedTestToFile ($ test , self ::TESTS_RERUN_FILE );
131
+ $ testInfo = explode (DIRECTORY_SEPARATOR , $ test );
132
+ $ testName = explode (": " , $ testInfo [count ($ testInfo ) - 1 ])[1 ];
133
+ $ suiteName = $ testInfo [count ($ testInfo ) - 2 ];
134
+
135
+ if ($ suiteName == self ::DEFAULT_TEST_GROUP ) {
136
+ array_push ($ failedTestDetails ['tests ' ], $ testName );
137
+ } else {
138
+ $ failedTestDetails ['suites ' ] = array_merge_recursive (
139
+ $ failedTestDetails ['suites ' ],
140
+ [$ suiteName => [$ testName ]]
141
+ );
142
+ }
141
143
}
142
144
}
143
145
}
@@ -183,7 +185,7 @@ private function readFailedTestFile($filePath)
183
185
*/
184
186
private function writeFailedTestToFile ($ test , $ filePath )
185
187
{
186
- if (realpath ($ filePath )) {
188
+ if (file_exists ($ filePath )) {
187
189
if (strpos (file_get_contents ($ filePath ), $ test ) === false ) {
188
190
file_put_contents ($ filePath , "\n" . $ test , FILE_APPEND );
189
191
}
0 commit comments