svn: /pear2/Pyrus_Developer/trunk/ src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php www/CoverageAnalyzer/templates/Summary.tpl.php
[email protected] (Brett Bieber) Mon, 06 Sep 2010 14:43:32 +0000
| Newsgroups | php.pear.cvs,php.pear.core |
|---|---|
| Message-ID | <[email protected]> |
saltybeagle Mon, 06 Sep 2010 14:43:32 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=303079
Log:
* Change coverage summary report to a table instead of unordered list.
* Add column with uncovered percentage of total, which helps prioritize which files to write tests for to increase project coverage.
Changed paths:
U pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php
U pear2/Pyrus_Developer/trunk/www/CoverageAnalyzer/templates/Summary.tpl.php
Modified: pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php
===================================================================
--- pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php 2010-09-06 14:41:35 UTC (rev 303078)
+++ pear2/Pyrus_Developer/trunk/src/Pyrus/Developer/CoverageAnalyzer/SourceFile.php 2010-09-06 14:43:32 UTC (rev 303079)
@@ -67,6 +67,11 @@
return $this->aggregator->coveragePercentage($this->path);
}
+ /**
+ * Get all the coverage info for this file
+ *
+ * @return array(covered, total, dead)
+ */
function coverageInfo()
{
return $this->aggregator->coverageInfo($this->path);
Modified: pear2/Pyrus_Developer/trunk/www/CoverageAnalyzer/templates/Summary.tpl.php
===================================================================
--- pear2/Pyrus_Developer/trunk/www/CoverageAnalyzer/templates/Summary.tpl.php 2010-09-06 14:41:35 UTC (rev 303078)
+++ pear2/Pyrus_Developer/trunk/www/CoverageAnalyzer/templates/Summary.tpl.php 2010-09-06 14:43:32 UTC (rev 303079)
@@ -25,14 +25,26 @@
?>
<p class="<?php echo getClass($percent); ?>"><?php echo $percent; ?>% code coverage</p>
<p>
- <a href="/workspace/PEAR2/Pyrus_Developer/www/CoverageAnalyzer/?test=TOC">Code Coverage per PHPT test</a>
+ <a href="<?php echo $parent->context->getRootLink(); ?>?test=TOC">Code Coverage per PHPT test</a>
</p>
- <ul>
- <?php foreach ($context as $sourceFile): ?>
- <li>
- <div class="<?php echo getClass($sourceFile->coveragePercentage()); ?>"><?php echo ' Coverage: ' . str_pad($sourceFile->coveragePercentage() . '%', 4, ' ', STR_PAD_LEFT); ?></div>
- <a href="<?php echo $parent->context->getFileLink($sourceFile->name()); ?>"><?php echo $sourceFile->shortName(); ?></a>
- </li>
+ <table>
+ <thead>
+ <tr>
+ <th>Coverage %</th>
+ <th>Source File</th>
+ <th>Uncovered % of total uncovered</th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($context as $sourceFile):
+ list($sourceCovered, $sourceTotal, $sourceDead) = $sourceFile->coverageInfo();
+ ?>
+ <tr>
+ <td class="<?php echo getClass($sourceFile->coveragePercentage()); ?>"><?php echo $sourceFile->coveragePercentage() . '%'; ?></td>
+ <td><a href="<?php echo $parent->context->getFileLink($sourceFile->name()); ?>"><?php echo $sourceFile->shortName(); ?></a></td>
+ <td><?php echo round(($sourceTotal - $sourceCovered)/($total - $covered)*100, 2); ?>%</td>
+ </tr>
<?php endforeach; ?>
- </ul>
+ </tbody>
+ </table>