Changeset View
Changeset View
Standalone View
Standalone View
src/unit/parser/ArcanistPhpunitTestResultParser.php
| Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | final class ArcanistPhpunitTestResultParser extends ArcanistTestResultParser { | ||||
| * valid. | * valid. | ||||
| * | * | ||||
| * @param string $json String containing JSON report | * @param string $json String containing JSON report | ||||
| * @return array JSON decoded array | * @return array JSON decoded array | ||||
| */ | */ | ||||
| private function getJsonReport($json) { | private function getJsonReport($json) { | ||||
| if (empty($json)) { | if (empty($json)) { | ||||
| throw new Exception('JSON report file is empty, '. | throw new Exception( | ||||
| 'it probably means that phpunit failed to run tests. '. | pht( | ||||
| 'Try running arc unit with --trace option and then run '. | 'JSON report file is empty, it probably means that phpunit '. | ||||
| 'generated phpunit command yourself, you might get the '. | 'failed to run tests. Try running %s with %s option and then run '. | ||||
| 'answer.' | 'generated phpunit command yourself, you might get the answer.', | ||||
| ); | 'arc unit', | ||||
| '--trace')); | |||||
| } | } | ||||
| $json = preg_replace('/}{\s*"/', '},{"', $json); | $json = preg_replace('/}{\s*"/', '},{"', $json); | ||||
| $json = '['.$json.']'; | $json = '['.$json.']'; | ||||
| return phutil_json_decode($json); | return phutil_json_decode($json); | ||||
| } | } | ||||
| } | } | ||||