added totals to console coverage report

This commit is contained in:
tmont 2009-06-28 01:43:48 +00:00
parent 9f77bdb0b6
commit a57c690dc5

View File

@ -9,8 +9,11 @@
public static function createConsoleReport(array $coverageData) { public static function createConsoleReport(array $coverageData) {
$coverageData = CoverageFilter::filter($coverageData); $coverageData = CoverageFilter::filter($coverageData);
echo "\nCode coverage information:\n\n"; fwrite(STDOUT, "\nCode coverage information:\n\n");
//print_r($coverageData);
$totloc = 0;
$totdloc = 0;
$totcloc = 0;
foreach ($coverageData as $file => $data) { foreach ($coverageData as $file => $data) {
fwrite(STDOUT, $file . "\n"); fwrite(STDOUT, $file . "\n");
$loc = 0; $loc = 0;
@ -29,7 +32,17 @@
fwrite(STDOUT, " Covered: $cloc\n"); fwrite(STDOUT, " Covered: $cloc\n");
fwrite(STDOUT, " Dead: $dloc\n"); fwrite(STDOUT, " Dead: $dloc\n");
fwrite(STDOUT, " Executable: $loc (" . round($cloc / $loc * 100, 2) . "%)\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) { public static function createXmlReport($file, array $coverageData) {
@ -42,6 +55,14 @@
} }
$coverageData = CoverageFilter::filter($coverageData);
foreach ($coverageData as $file => $data) {
foreach ($data as $unitsCovered) {
}
}
} }
} }