Skip to content

Commit 53629a0

Browse files
committed
MQE-893: Add flag to robo generate: tests which accepts a specific set of tests to execute
- add json error when invalid json is passed in
1 parent 74c98cf commit 53629a0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

dev/tests/acceptance/RoboFile.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,24 @@ function generateTests(array $tests, $opts = [
123123
])
124124
{
125125
$GLOBALS['GENERATE_TESTS'] = true;
126+
$GLOBALS['FORCE_PHP_GENERATE'] = $opts['force'];
126127
require 'tests'. DIRECTORY_SEPARATOR . 'functional' . DIRECTORY_SEPARATOR . '_bootstrap.php';
128+
127129
$testObjects = [];
128130
$suitesReferences = [];
129131

130-
if ($opts['force'])
131-
{
132-
$GLOBALS['FORCE_PHP_GENERATE'] = true;
133-
}
134-
135-
if ($opts['tests']) {
132+
if ($opts['tests'] != null) {
136133
$testConfigArray = json_decode($opts['tests'],true);
137134
$tests = $testConfigArray['tests'] ?? [];
138135
$suitesReferences = $testConfigArray['suites'] ?? [];
139136
}
140137

138+
// stop execution if we have failed to properly parse any json
139+
if (json_last_error() != JSON_ERROR_NONE) {
140+
$this->say("JSON could not be parsed: " . json_last_error_msg());
141+
return;
142+
}
143+
141144
if (!empty($tests))
142145
{
143146
foreach ($tests as $test)

0 commit comments

Comments
 (0)