diff --git a/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php b/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
index eb8d4d753..5cc24a5d2 100644
--- a/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
+++ b/lib/Cake/TestSuite/Coverage/HtmlCoverageReport.php
@@ -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();