diff --git a/src/Testify/framework/reporting/CoverageReporter.php b/src/Testify/framework/reporting/CoverageReporter.php index 5e4c312..91b29cc 100644 --- a/src/Testify/framework/reporting/CoverageReporter.php +++ b/src/Testify/framework/reporting/CoverageReporter.php @@ -28,13 +28,12 @@ 'cloc' => 0 ) ); + foreach ($data as $line => $unitsCovered) { $loc = 1; $dloc = ($unitsCovered === self::DEAD) ? 1 : 0; $cloc = ($unitsCovered > 0) ? 1 : 0; - - //find the class this line resides in, if any $class = null; foreach ($refClasses as $refClass) { @@ -109,7 +108,7 @@ fwrite(STDOUT, "Totals:\n"); fwrite(STDOUT, " Covered: $totcloc\n"); fwrite(STDOUT, " Dead: $totdloc\n"); - fwrite(STDOUT, " Executable: " . ($totloc - $totdloc) . " (" . round($totcloc / ($totloc - $dloc) * 100, 2) . "%)\n"); + fwrite(STDOUT, " Executable: " . ($totloc - $totdloc) . " (" . round($totcloc / ($totloc - $totdloc) * 100, 2) . "%)\n"); } public static function createHtmlReport($coverageDir, array $coverageData, $renderer = null) { @@ -150,14 +149,13 @@ private static function writeHtmlFile($sourceFile, $baseDir, $coverageDir, array $classData, array $coverageData, $renderer) { //summary view - $fileCoverage = ''; + $fileCoverage = ''; $classCoverage = ''; - $tloc = 0; - $tdloc = 0; - $tcloc = 0; + $tloc = 0; + $tdloc = 0; + $tcloc = 0; foreach ($classData['classes'] as $class => $methods) { - $classCoverage = ''; $classLoc = 0; $classDloc = 0; $classCloc = 0; @@ -177,7 +175,7 @@ $percentageData = self::getPercentage($methodData['cloc'], $methodData['loc'] - $methodData['dloc']); - $methodCoverage .= "