diff --git a/build.xml b/build.xml
index 74cc8c2..81f5962 100644
--- a/build.xml
+++ b/build.xml
@@ -39,13 +39,20 @@
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
diff --git a/properties/product.properties b/properties/product.properties
index b460012..71ea517 100644
--- a/properties/product.properties
+++ b/properties/product.properties
@@ -1,4 +1,5 @@
name=TUnit
version=0.5.0
author="Tommy Montgomery"
-website=http://tommymontgomery.com/
\ No newline at end of file
+website=http://tommymontgomery.com/
+ezc=1.0
\ No newline at end of file
diff --git a/src/TUnit/framework/reporting/CoverageReporter.php b/src/TUnit/framework/reporting/CoverageReporter.php
index feb5eb1..08f7575 100644
--- a/src/TUnit/framework/reporting/CoverageReporter.php
+++ b/src/TUnit/framework/reporting/CoverageReporter.php
@@ -13,7 +13,6 @@
$newData = array();
foreach ($coverageData as $file => $data) {
$classes = Util::getClassNamesFromFile($file);
- //print_r($classes);
$refClasses = array();
foreach ($classes as $class) {
@@ -167,9 +166,17 @@
$tcloc += $methodData['cloc'];
$methodStartLine = $refClass->getMethod($method)->getStartLine();
- $methodCoverage .= "
' . basename($subdir) . '';
- $info .= '
' . $subdata['cloc'] . ' / ' . ($subdata['loc'] - $subdata['dloc']) . ' | ';
- $info .= '
' . round($subdata['cloc'] / ($subdata['loc'] - $subdata['dloc']) * 100, 2) . '% | ';
+ $info .= '
' . $subdata['cloc'] . ' / ' . ($subdata['loc'] - $subdata['dloc']) . ' | ';
+ $info .= "
$percentageData[0]% | ";
$info .= "\n";
}
//regular files in current directory
foreach ($data['files'] as $file => $fileData) {
+ $percentageData = self::getPercentage($fileData['cloc'], $fileData['loc'] - $fileData['dloc']);
$info .= '
' . basename($file) . ' | ';
- $info .= '' . $fileData['cloc'] . ' / ' . ($fileData['loc'] - $fileData['dloc']) . ' | ';
- $info .= '' . round($fileData['cloc'] / ($fileData['loc'] - $fileData['dloc']) * 100, 2) . '% | ';
+ $info .= '' . $fileData['cloc'] . ' / ' . ($fileData['loc'] - $fileData['dloc']) . ' | ';
+ $info .= "$percentageData[0]% | ";
$info .= "
---|
\n";
}
@@ -342,7 +361,10 @@
'${product.name}',
'${product.version}',
'${product.website}',
- '${product.author}'
+ '${product.author}',
+ '${php.version}',
+ '${xdebug.version}',
+ '${ezc.version}'
),
array(
Product::NAME . ' - Coverage Report',
@@ -352,7 +374,10 @@
Product::NAME,
Product::VERSION,
Product::WEBSITE,
- Product::AUTHOR
+ Product::AUTHOR,
+ phpversion(),
+ phpversion('xdebug'),
+ Product::EZC_VERSION
),
$template
);
@@ -368,6 +393,7 @@
} else {
$link = '
' . $baseDir . '';
}
+
$dirs = preg_split('@\\' . DIRECTORY_SEPARATOR . '@', str_replace($baseDir, '', dirname($path) . DIRECTORY_SEPARATOR), -1, PREG_SPLIT_NO_EMPTY);
$path = '';
foreach ($dirs as $dir) {
@@ -376,6 +402,7 @@
} else {
$path = $path . '-' . $dir;
}
+
if ($oneLink) {
$link = $path;
} else {
@@ -394,6 +421,25 @@
return $old + (($new > 0) ? 1 : 0);
}
+ private static function getPercentage($numerator, $denominator) {
+ $percentage = ($denominator != 0) ? round($numerator / $denominator * 100, 2) : 0;
+ $percentage = number_format($percentage, 2);
+ return array(
+ str_repeat(' ', 6 - strlen($percentage)) . $percentage,
+ self::getCoverageColor($percentage)
+ );
+ }
+
+ private static function getCoverageColor($percentage) {
+ $color = '#';
+
+ $color .= str_pad(dechex(255 - round($percentage * 2.55)), 2, '0', STR_PAD_LEFT);
+ $color .= str_pad(dechex(round($percentage * 2.55)), 2, '0', STR_PAD_LEFT);
+ $color .= '33';
+
+ return $color;
+ }
+
}
?>
\ No newline at end of file
diff --git a/src/TUnit/framework/reporting/template/directory.html b/src/TUnit/framework/reporting/template/directory.html
index c7eb869..0e96584 100644
--- a/src/TUnit/framework/reporting/template/directory.html
+++ b/src/TUnit/framework/reporting/template/directory.html
@@ -13,18 +13,32 @@
+
+
+
+
+
+
+
+
${directory.coverage}