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'])) {
|
if (isset($_GET['code_coverage'])) {
|
||||||
$this->params['codeCoverage'] = true;
|
$this->params['codeCoverage'] = true;
|
||||||
$this->_checkXdebug();
|
$this->_checkXdebug();
|
||||||
require_once CAKE_TESTS_LIB . 'code_coverage_manager.php';
|
|
||||||
}
|
}
|
||||||
$this->params['baseUrl'] = $this->_baseUrl;
|
$this->params['baseUrl'] = $this->_baseUrl;
|
||||||
$this->params['baseDir'] = $this->_baseDir;
|
$this->params['baseDir'] = $this->_baseDir;
|
||||||
|
@ -250,9 +249,6 @@ class CakeTestSuiteDispatcher {
|
||||||
*/
|
*/
|
||||||
function _runGroupTest() {
|
function _runGroupTest() {
|
||||||
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
||||||
if ($this->params['codeCoverage']) {
|
|
||||||
CodeCoverageManager::init($this->params['group'], $Reporter);
|
|
||||||
}
|
|
||||||
if ('all' == $this->params['group']) {
|
if ('all' == $this->params['group']) {
|
||||||
$this->Manager->runAllTests($Reporter);
|
$this->Manager->runAllTests($Reporter);
|
||||||
} else {
|
} else {
|
||||||
|
@ -267,9 +263,6 @@ class CakeTestSuiteDispatcher {
|
||||||
*/
|
*/
|
||||||
function _runTestCase() {
|
function _runTestCase() {
|
||||||
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
$Reporter = CakeTestSuiteDispatcher::getReporter();
|
||||||
if ($this->params['codeCoverage']) {
|
|
||||||
CodeCoverageManager::init($this->params['case'], $Reporter);
|
|
||||||
}
|
|
||||||
$this->Manager->runTestCase($this->params['case'], $Reporter, $this->params['codeCoverage']);
|
$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 $this->_paintLinks();
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
if (
|
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
|
||||||
isset($this->params['codeCoverage']) &&
|
$coverage = $result->getCodeCoverageInformation();
|
||||||
$this->params['codeCoverage'] &&
|
echo $this->paintCoverage($coverage);
|
||||||
class_exists('CodeCoverageManager')
|
|
||||||
) {
|
|
||||||
//CodeCoverageManager::report();
|
|
||||||
}
|
}
|
||||||
$this->paintDocumentEnd();
|
$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.
|
* 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')) {
|
if (function_exists('memory_get_peak_usage')) {
|
||||||
echo 'Peak memory use: (in bytes): ' . number_format(memory_get_peak_usage()) . "\n";
|
echo 'Peak memory use: (in bytes): ' . number_format(memory_get_peak_usage()) . "\n";
|
||||||
}
|
}
|
||||||
if (
|
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
|
||||||
isset($this->params['codeCoverage']) &&
|
$coverage = $result->getCodeCoverageInformation();
|
||||||
$this->params['codeCoverage'] &&
|
echo $this->paintCoverage($coverage);
|
||||||
class_exists('CodeCoverageManager')
|
|
||||||
) {
|
|
||||||
CodeCoverageManager::report();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,9 +167,6 @@ class TestManager {
|
||||||
$reporter->paintHeader();
|
$reporter->paintHeader();
|
||||||
$this->getTestSuite()->run($result);
|
$this->getTestSuite()->run($result);
|
||||||
$reporter->paintResult($result);
|
$reporter->paintResult($result);
|
||||||
// echo '<pre>';
|
|
||||||
// var_dump($result->getCodeCoverageInformation());
|
|
||||||
// echo '</pre>';
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue