Nerfing coverage generation with PHPUnit3.6 for now.

PHPUnit3.6 totally changed how coverage data can be accessed, its going
to take some time to update things.  This is a quick work around until
more time can be dedicated to fixing it.
This commit is contained in:
mark_story 2011-11-05 17:46:32 -04:00
parent ad237ec681
commit c2eae6caf8
2 changed files with 15 additions and 3 deletions

View file

@ -66,8 +66,13 @@ class CakeTestRunner extends PHPUnit_TextUI_TestRunner {
protected function createTestResult() {
$result = new PHPUnit_Framework_TestResult;
if (!empty($this->_params['codeCoverage'])) {
if (method_exists($result, 'collectCodeCoverageInformation')) {
$result->collectCodeCoverageInformation(true);
}
if (method_exists($result, 'setCodeCoverage')) {
$result->setCodeCoverage(new PHP_CodeCoverage());
}
}
return $result;
}

View file

@ -141,8 +141,15 @@ class CakeHtmlReporter extends CakeBaseReporter {
echo $this->_paintLinks();
echo '</div>';
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
$coverage = $result->getCodeCoverage()->getSummary();
echo $this->paintCoverage($coverage);
$coverage = $result->getCodeCoverage();
if (method_exists($coverage, 'getSummary')) {
$report = $coverage->getSummary();
echo $this->paintCoverage($report);
}
if (method_exists($coverage, 'getData')) {
$report = $coverage->getData();
echo '<div class="cake-error">' . __('Coverage generation is not supported with PHPUnit 3.6 at this time.') . '</div>';
}
}
$this->paintDocumentEnd();
}