mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Removing references to non phpunit code coverage parsing.
Adding stub of new code coverage report generator. Updating related files.
This commit is contained in:
parent
507c3b2d94
commit
fd073809d0
5 changed files with 53 additions and 22 deletions
|
@ -236,7 +236,6 @@ class CakeTestSuiteDispatcher {
|
|||
if (isset($_GET['code_coverage'])) {
|
||||
$this->params['codeCoverage'] = true;
|
||||
$this->_checkXdebug();
|
||||
require_once CAKE_TESTS_LIB . 'code_coverage_manager.php';
|
||||
}
|
||||
$this->params['baseUrl'] = $this->_baseUrl;
|
||||
$this->params['baseDir'] = $this->_baseDir;
|
||||
|
@ -250,9 +249,6 @@ class CakeTestSuiteDispatcher {
|
|||
*/
|
||||
function _runGroupTest() {
|
||||
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
||||
if ($this->params['codeCoverage']) {
|
||||
CodeCoverageManager::init($this->params['group'], $Reporter);
|
||||
}
|
||||
if ('all' == $this->params['group']) {
|
||||
$this->Manager->runAllTests($Reporter);
|
||||
} else {
|
||||
|
@ -267,9 +263,6 @@ class CakeTestSuiteDispatcher {
|
|||
*/
|
||||
function _runTestCase() {
|
||||
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
||||
if ($this->params['codeCoverage']) {
|
||||
CodeCoverageManager::init($this->params['case'], $Reporter);
|
||||
}
|
||||
$this->Manager->runTestCase($this->params['case'], $Reporter, $this->params['codeCoverage']);
|
||||
}
|
||||
}
|
||||
|
|
35
cake/tests/lib/coverage/html_coverage_report.php
Normal file
35
cake/tests/lib/coverage/html_coverage_report.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Generates an HTML coverage report from data provided by PHPUnit.
|
||||
*
|
||||
* @package default
|
||||
* @author Mark Story
|
||||
*/
|
||||
class HtmlCoverageReport {
|
||||
/**
|
||||
* coverage data
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_coverage;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $coverage Array of coverage data from PHPUnit_Test_Result
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($coverage) {
|
||||
$this->_coverage = $coverage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates report html to display.
|
||||
*
|
||||
* @return string compiled html report.
|
||||
*/
|
||||
public function report() {
|
||||
|
||||
}
|
||||
}
|
|
@ -175,16 +175,25 @@ class CakeHtmlReporter extends CakeBaseReporter implements PHPUnit_Framework_Tes
|
|||
}
|
||||
echo $this->_paintLinks();
|
||||
echo '</div>';
|
||||
if (
|
||||
isset($this->params['codeCoverage']) &&
|
||||
$this->params['codeCoverage'] &&
|
||||
class_exists('CodeCoverageManager')
|
||||
) {
|
||||
//CodeCoverageManager::report();
|
||||
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
|
||||
$coverage = $result->getCodeCoverageInformation();
|
||||
echo $this->paintCoverage($coverage);
|
||||
}
|
||||
$this->paintDocumentEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints a code coverage report.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function paintCoverage($coverage) {
|
||||
$file = dirname(dirname(__FILE__)) . '/coverage/html_coverage_report.php';
|
||||
include $file;
|
||||
$reporter = new HtmlCoverageReport($coverage);
|
||||
echo $reporter->report();
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the links that for accessing things in the test suite.
|
||||
*
|
||||
|
|
|
@ -61,12 +61,9 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
if (function_exists('memory_get_peak_usage')) {
|
||||
echo 'Peak memory use: (in bytes): ' . number_format(memory_get_peak_usage()) . "\n";
|
||||
}
|
||||
if (
|
||||
isset($this->params['codeCoverage']) &&
|
||||
$this->params['codeCoverage'] &&
|
||||
class_exists('CodeCoverageManager')
|
||||
) {
|
||||
CodeCoverageManager::report();
|
||||
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
|
||||
$coverage = $result->getCodeCoverageInformation();
|
||||
echo $this->paintCoverage($coverage);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -167,9 +167,6 @@ class TestManager {
|
|||
$reporter->paintHeader();
|
||||
$this->getTestSuite()->run($result);
|
||||
$reporter->paintResult($result);
|
||||
// echo '<pre>';
|
||||
// var_dump($result->getCodeCoverageInformation());
|
||||
// echo '</pre>';
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue