Skip to content

Commit 2e12124

Browse files
committed
Improved automated test results detection
1 parent 7253bd7 commit 2e12124

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

src/utilities.php

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,12 @@ function getAvailableLibraries(string $libFolder): array
2929
function runAutomatedTests(string $library): array
3030
{
3131
$cmd = sprintf(PHPUNIT_TEST_CMD, ucwords(str_replace('-', '_', $library)));
32-
$output = shell_exec($cmd);
33-
34-
if (($position = strpos($output, 'OK ')) !== false) {
35-
return [
36-
'status' => true,
37-
'output' => substr($output, $position)
38-
];
39-
}
40-
41-
if (($position = strpos($output, 'FAILURES!')) !== false) {
42-
return [
43-
'status' => false,
44-
'output' => substr($output, $position)
45-
];
46-
}
47-
48-
if (($position = strpos($output, 'ERRORS!')) !== false) {
49-
return [
50-
'status' => false,
51-
'output' => substr($output, $position)
52-
];
53-
}
32+
echo $cmd, PHP_EOL;
33+
exec($cmd, $output, $exitcode);
5434

5535
return [
56-
'status' => false,
57-
'output' => 'Unknown Failure'
36+
'status' => $exitcode === 0,
37+
'output' => end($output)
5838
];
5939
}
6040

0 commit comments

Comments
 (0)