mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-27 01:02:41 +01:00
(stable) Promote 2016 Week 9
This commit is contained in:
commit
92a93ab8f4
1 changed files with 19 additions and 20 deletions
|
@ -129,35 +129,34 @@ final class ArcanistPhpunitTestResultParser extends ArcanistTestResultParser {
|
||||||
$line_count = count(file($class_path));
|
$line_count = count(file($class_path));
|
||||||
|
|
||||||
$coverage = '';
|
$coverage = '';
|
||||||
|
$any_line_covered = false;
|
||||||
$start_line = 1;
|
$start_line = 1;
|
||||||
$lines = $file->getElementsByTagName('line');
|
$lines = $file->getElementsByTagName('line');
|
||||||
for ($ii = 0; $ii < $lines->length; $ii++) {
|
|
||||||
$line = $lines->item($ii);
|
|
||||||
for (; $start_line < $line->getAttribute('num'); $start_line++) {
|
|
||||||
$coverage .= 'N';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$coverage = str_repeat('N', $line_count);
|
||||||
|
foreach ($lines as $line) {
|
||||||
if ($line->getAttribute('type') != 'stmt') {
|
if ($line->getAttribute('type') != 'stmt') {
|
||||||
$coverage .= 'N';
|
continue;
|
||||||
|
}
|
||||||
|
if ((int)$line->getAttribute('count') > 0) {
|
||||||
|
$is_covered = 'C';
|
||||||
|
$any_line_covered = true;
|
||||||
} else {
|
} else {
|
||||||
if ((int)$line->getAttribute('count') == 0) {
|
$is_covered = 'U';
|
||||||
$coverage .= 'U';
|
|
||||||
} else if ((int)$line->getAttribute('count') > 0) {
|
|
||||||
$coverage .= 'C';
|
|
||||||
}
|
}
|
||||||
|
$line_no = (int)$line->getAttribute('num');
|
||||||
|
$coverage[$line_no - 1] = $is_covered;
|
||||||
}
|
}
|
||||||
|
|
||||||
$start_line++;
|
// Sometimes the Clover coverage gives false positives on uncovered lines
|
||||||
}
|
// when the file wasn't actually part of the test. This filters out files
|
||||||
|
// with no coverage which helps give more accurate overall results.
|
||||||
for (; $start_line <= $line_count; $start_line++) {
|
if ($any_line_covered) {
|
||||||
$coverage .= 'N';
|
|
||||||
}
|
|
||||||
|
|
||||||
$len = strlen($this->projectRoot.DIRECTORY_SEPARATOR);
|
$len = strlen($this->projectRoot.DIRECTORY_SEPARATOR);
|
||||||
$class_path = substr($class_path, $len);
|
$class_path = substr($class_path, $len);
|
||||||
$reports[$class_path] = $coverage;
|
$reports[$class_path] = $coverage;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $reports;
|
return $reports;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue