Commit: eeea9338ef4ed8f05dbd69f5e55711dbebecc9ae

Author: Michael Nitschinger | Date: 2011-04-05 16:07:17 +0200
adding 0 of 0 is 100 percent coverage, fixes #333
diff --git a/libraries/lithium/test/filter/Coverage.php b/libraries/lithium/test/filter/Coverage.php index 29fdc49..be382c1 100644 --- a/libraries/lithium/test/filter/Coverage.php +++ b/libraries/lithium/test/filter/Coverage.php @@ -9,8 +9,6 @@ namespace lithium\test\filter; use lithium\core\Libraries; -use lithium\util\String; -use lithium\util\Collection; use lithium\analysis\Inspector; /** @@ -83,7 +81,11 @@ class Coverage extends \lithium\test\Filter { $executable = $executableLines[$class]; $covered = array_intersect(array_keys($density), $executable); $uncovered = array_diff($executable, $covered); - $percentage = round(count($covered) / (count($executable) ?: 1), 4) * 100; + if (count($executable)) { + $percentage = round(count($covered) / (count($executable) ?: 1), 4) * 100; + } else { + $percentage = 100; + } $result[$class] = compact('class', 'executable', 'covered', 'uncovered', 'percentage'); }