diff --git a/src/TUnit/framework/reporting/CoverageReporter.php b/src/TUnit/framework/reporting/CoverageReporter.php index a522062..b3bd6db 100644 --- a/src/TUnit/framework/reporting/CoverageReporter.php +++ b/src/TUnit/framework/reporting/CoverageReporter.php @@ -9,8 +9,11 @@ public static function createConsoleReport(array $coverageData) { $coverageData = CoverageFilter::filter($coverageData); - echo "\nCode coverage information:\n\n"; - //print_r($coverageData); + fwrite(STDOUT, "\nCode coverage information:\n\n"); + + $totloc = 0; + $totdloc = 0; + $totcloc = 0; foreach ($coverageData as $file => $data) { fwrite(STDOUT, $file . "\n"); $loc = 0; @@ -29,7 +32,17 @@ fwrite(STDOUT, " Covered: $cloc\n"); fwrite(STDOUT, " Dead: $dloc\n"); fwrite(STDOUT, " Executable: $loc (" . round($cloc / $loc * 100, 2) . "%)\n"); + + $totloc += $loc; + $totdloc += $dloc; + $totcloc += $cloc; } + + fwrite(STDOUT, "\n\n"); + fwrite(STDOUT, "Totals:\n"); + fwrite(STDOUT, " Covered: $totcloc\n"); + fwrite(STDOUT, " Dead: $totdloc\n"); + fwrite(STDOUT, " Executable: $totloc (" . round($totcloc / $totloc * 100, 2) . "%)\n"); } public static function createXmlReport($file, array $coverageData) { @@ -42,6 +55,14 @@ } + + $coverageData = CoverageFilter::filter($coverageData); + foreach ($coverageData as $file => $data) { + foreach ($data as $unitsCovered) { + + } + } + } }