mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-23 07:12:40 +01:00
PHPUnit test name handling improvements
Summary: Better test name handling for tests with data sets. Instead of showing test name with full data set, show it's id/name, e.g. `testConstructor with data set #1` Test Plan: - Try running tests with data sets Reviewers: epriestley Reviewed By: epriestley CC: aran, Koolvin Differential Revision: https://secure.phabricator.com/D2535
This commit is contained in:
parent
4f739014ae
commit
6e87de7304
1 changed files with 14 additions and 2 deletions
|
@ -188,7 +188,14 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pos = strpos($event->suite, '::');
|
||||||
|
if ($pos === false) {
|
||||||
$name = substr($event->test, strlen($event->suite) + 2);
|
$name = substr($event->test, strlen($event->suite) + 2);
|
||||||
|
} else {
|
||||||
|
$name = substr($event->test, $pos + 2);
|
||||||
|
$name = preg_replace('/ \(array\(.*\)\)/', '', $name);
|
||||||
|
}
|
||||||
|
|
||||||
$result = new ArcanistUnitTestResult();
|
$result = new ArcanistUnitTestResult();
|
||||||
$result->setName($name);
|
$result->setName($name);
|
||||||
$result->setResult($status);
|
$result->setResult($status);
|
||||||
|
@ -212,7 +219,12 @@ final class PhpunitTestEngine extends ArcanistBaseUnitTestEngine {
|
||||||
private function readCoverage($path) {
|
private function readCoverage($path) {
|
||||||
$test_results = Filesystem::readFile($path);
|
$test_results = Filesystem::readFile($path);
|
||||||
if (empty($test_results)) {
|
if (empty($test_results)) {
|
||||||
throw new Exception('Clover coverage XML report file is empty');
|
throw new Exception('Clover coverage XML report file is empty, '
|
||||||
|
. 'it probably means that phpunit failed to run tests. '
|
||||||
|
. 'Try running arc unit with --trace option and then run '
|
||||||
|
. 'generated phpunit command yourself, you might get the '
|
||||||
|
. 'answer.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$coverage_dom = new DOMDocument();
|
$coverage_dom = new DOMDocument();
|
||||||
|
|
Loading…
Reference in a new issue