Fixing issue where divide by 0 errors would crop up on empty files.

This commit is contained in:
Mark Story mark@mark-story.com 2011-09-01 20:33:09 +01:00
parent 957a8d5c00
commit 6f8869631f

View file

@ -84,7 +84,10 @@ HTML;
$diff[] = $this->_paintLine($line, $lineno, $class, $coveringTests);
}
$percentCovered = round(100 * $covered / $total, 2);
$percentCovered = 100;
if ($total > 0) {
$percentCovered = round(100 * $covered / $total, 2);
}
$output .= $this->coverageHeader($filename, $percentCovered);
$output .= implode("", $diff);
$output .= $this->coverageFooter();