mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Using PHPUnit internals for more things.
Removing code that is also present in PHPUnit. Updating testsuite shell to use loader class.
This commit is contained in:
parent
e5c898a4d2
commit
39e05bce4a
4 changed files with 13 additions and 39 deletions
|
@ -167,6 +167,7 @@ class TestSuiteShell extends Shell {
|
|||
|
||||
$this->_dispatcher = new CakeTestSuiteDispatcher();
|
||||
$this->_dispatcher->loadTestFramework();
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_command.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -255,7 +256,6 @@ class TestSuiteShell extends Shell {
|
|||
* @return void
|
||||
*/
|
||||
protected function run($runnerArgs, $options = array()) {
|
||||
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cake_test_suite_command.php';
|
||||
|
||||
restore_error_handler();
|
||||
restore_error_handler();
|
||||
|
@ -271,7 +271,7 @@ class TestSuiteShell extends Shell {
|
|||
*/
|
||||
public function available() {
|
||||
$params = $this->parseArgs();
|
||||
$testCases = TestManager::getTestCaseList($params);
|
||||
$testCases = CakeTestLoader::generateTestList($params);
|
||||
$app = $params['app'];
|
||||
$plugin = $params['plugin'];
|
||||
|
||||
|
|
|
@ -28,29 +28,7 @@ PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
|
|||
*/
|
||||
class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
||||
|
||||
/**
|
||||
* Time the test runs started.
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_timeStart = 0;
|
||||
|
||||
/**
|
||||
* Time the test runs ended
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_timeEnd = 0;
|
||||
|
||||
/**
|
||||
* Duration of all test methods.
|
||||
*
|
||||
* @var integer
|
||||
* @access protected
|
||||
*/
|
||||
protected $_timeDuration = 0;
|
||||
protected $_headerSent = false;
|
||||
|
||||
/**
|
||||
* Array of request parameters. Usually parsed GET params.
|
||||
|
@ -71,6 +49,7 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
* The number of assertions done for a test suite
|
||||
*/
|
||||
protected $numAssertions = 0;
|
||||
|
||||
/**
|
||||
* Does nothing yet. The first output will
|
||||
* be sent on the first test start.
|
||||
|
@ -205,6 +184,9 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
* @param PHPUnit_Framework_TestSuite $suite
|
||||
*/
|
||||
public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
|
||||
if (!$this->_headerSent) {
|
||||
echo $this->paintHeader();
|
||||
}
|
||||
echo __('Running %s', $suite->getName()) . "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'DEFAULT');
|
|||
*/
|
||||
class CakeHtmlReporter extends CakeBaseReporter {
|
||||
|
||||
protected $_headerSent = false;
|
||||
|
||||
/**
|
||||
* Paints the top of the web page setting the
|
||||
* title to the name of the starting test.
|
||||
|
@ -142,10 +140,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
|
|||
echo "<strong>" . $result->errorCount() . "</strong> exceptions.";
|
||||
echo "</div>\n";
|
||||
echo '<div style="padding:0 0 5px;">';
|
||||
echo '<p><strong>Time taken by tests (in seconds):</strong> ' . $result->time() . '</p>';
|
||||
if (function_exists('memory_get_peak_usage')) {
|
||||
echo '<p><strong>Peak memory use: (in bytes):</strong> ' . number_format(memory_get_peak_usage()) . '</p>';
|
||||
}
|
||||
echo '<p><strong>' . PHP_Timer::resourceUsage() . '</strong>';
|
||||
echo $this->_paintLinks();
|
||||
echo '</div>';
|
||||
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
|
||||
|
|
|
@ -35,9 +35,9 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
* @return void
|
||||
*/
|
||||
public function paintDocumentStart() {
|
||||
if (!headers_sent()) {
|
||||
// if (!headers_sent()) {
|
||||
header('Content-type: text/plain');
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,10 +87,8 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
', Failures: ' . $result->failureCount() .
|
||||
', Exceptions: ' . $result->errorCount() . "\n";
|
||||
|
||||
echo 'Time taken by tests (in seconds): ' . $result->time() . "\n";
|
||||
if (function_exists('memory_get_peak_usage')) {
|
||||
echo 'Peak memory use: (in bytes): ' . number_format(memory_get_peak_usage()) . "\n";
|
||||
}
|
||||
echo PHP_Timer::resourceUsage();
|
||||
|
||||
if (isset($this->params['codeCoverage']) && $this->params['codeCoverage']) {
|
||||
$coverage = $result->getCodeCoverageInformation();
|
||||
echo $this->paintCoverage($coverage);
|
||||
|
@ -129,8 +127,7 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
* @return void
|
||||
*/
|
||||
public function paintSkip($message) {
|
||||
parent::paintSkip($message);
|
||||
echo "Skip: $message\n";
|
||||
printf("Skip: %s\n", $message->getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue