Changeset View
Changeset View
Standalone View
Standalone View
src/unit/parser/ArcanistPhpunitTestResultParser.php
Show All 12 Lines | final class ArcanistPhpunitTestResultParser extends ArcanistTestResultParser { | ||||
* | * | ||||
* @param string $path Path to test | * @param string $path Path to test | ||||
* @param string $test_results String containing phpunit json report | * @param string $test_results String containing phpunit json report | ||||
* | * | ||||
* @return array | * @return array | ||||
*/ | */ | ||||
public function parseTestResults($path, $test_results) { | public function parseTestResults($path, $test_results) { | ||||
if (!$test_results) { | if (!$test_results) { | ||||
$result = id(new ArcanistUnitTestResult()) | $result = (new ArcanistUnitTestResult()) | ||||
->setName($path) | ->setName($path) | ||||
->setUserData($this->stderr) | ->setUserData($this->stderr) | ||||
->setResult(ArcanistUnitTestResult::RESULT_BROKEN); | ->setResult(ArcanistUnitTestResult::RESULT_BROKEN); | ||||
return array($result); | return array($result); | ||||
} | } | ||||
$report = $this->getJsonReport($test_results); | $report = $this->getJsonReport($test_results); | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | foreach ($report as $event) { | ||||
$result->setCoverage($coverage); | $result->setCoverage($coverage); | ||||
$result->setUserData($user_data); | $result->setUserData($user_data); | ||||
$results[] = $result; | $results[] = $result; | ||||
$last_test_finished = true; | $last_test_finished = true; | ||||
} | } | ||||
if (!$last_test_finished) { | if (!$last_test_finished) { | ||||
$results[] = id(new ArcanistUnitTestResult()) | $results[] = (new ArcanistUnitTestResult()) | ||||
->setName(idx($event, 'test')) // use last event | ->setName(idx($event, 'test')) // use last event | ||||
->setUserData($this->stderr) | ->setUserData($this->stderr) | ||||
->setResult(ArcanistUnitTestResult::RESULT_BROKEN); | ->setResult(ArcanistUnitTestResult::RESULT_BROKEN); | ||||
} | } | ||||
return $results; | return $results; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0