Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/ArcanistXUnitTestResultParser.php
| Show All 18 Lines | if (!strlen($test_results)) { | ||||
| 'test_results argument to parseTestResults must not be empty'); | 'test_results argument to parseTestResults must not be empty'); | ||||
| } | } | ||||
| // xunit xsd: https://gist.github.com/959290 | // xunit xsd: https://gist.github.com/959290 | ||||
| $xunit_dom = new DOMDocument(); | $xunit_dom = new DOMDocument(); | ||||
| $load_success = @$xunit_dom->loadXML($test_results); | $load_success = @$xunit_dom->loadXML($test_results); | ||||
| if (!$load_success) { | if (!$load_success) { | ||||
| $input_start = phutil_utf8_shorten($test_results, 150); | $input_start = id(new PhutilUTF8StringTruncator()) | ||||
| ->setMaximumGlyphs(150) | |||||
| ->truncateString($test_results); | |||||
| throw new Exception( | throw new Exception( | ||||
| "Failed to load XUnit report; Input starts with:\n\n {$input_start}"); | "Failed to load XUnit report; Input starts with:\n\n {$input_start}"); | ||||
| } | } | ||||
| $results = array(); | $results = array(); | ||||
| $testcases = $xunit_dom->getElementsByTagName('testcase'); | $testcases = $xunit_dom->getElementsByTagName('testcase'); | ||||
| foreach ($testcases as $testcase) { | foreach ($testcases as $testcase) { | ||||
| $classname = $testcase->getAttribute('classname'); | $classname = $testcase->getAttribute('classname'); | ||||
| ▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines | |||||