Upgrade CakePHP from 2.2.5 to 2.9.5

This commit is contained in:
Brm Ko 2017-02-26 15:29:44 +01:00
parent 5a580df460
commit 235a541597
793 changed files with 60746 additions and 23753 deletions

View file

@ -2,19 +2,19 @@
/**
* CakeHtmlReporter
*
* PHP 5
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice
*
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
App::uses('CakeBaseReporter', 'TestSuite/Reporter');
/**
@ -95,11 +95,11 @@ class CakeHtmlReporter extends CakeBaseReporter {
$urlExtra = '&plugin=' . $plugin;
}
if (1 > count($testCases)) {
if (count($testCases) < 1) {
$buffer .= "<strong>EMPTY</strong>";
}
foreach ($testCases as $testCaseFile => $testCase) {
foreach ($testCases as $testCase) {
$title = explode(DS, str_replace('.test.php', '', $testCase));
$title[count($title) - 1] = Inflector::camelize($title[count($title) - 1]);
$title = implode(' / ', $title);
@ -169,6 +169,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
/**
* Paints a code coverage report.
*
* @param array $coverage The coverage data
* @return void
*/
public function paintCoverage(array $coverage) {
@ -198,12 +199,12 @@ class CakeHtmlReporter extends CakeBaseReporter {
if (!empty($this->params['case'])) {
$query['case'] = $this->params['case'];
}
$show = $this->_queryString($show);
$query = $this->_queryString($query);
list($show, $query) = $this->_getQueryLink();
echo "<p><a href='" . $this->baseUrl() . $show . "'>Run more tests</a> | <a href='" . $this->baseUrl() . $query . "&amp;show_passes=1'>Show Passes</a> | \n";
echo "<a href='" . $this->baseUrl() . $query . "&amp;debug=1'>Enable Debug Output</a> | \n";
echo "<a href='" . $this->baseUrl() . $query . "&amp;code_coverage=true'>Analyze Code Coverage</a></p>\n";
echo "<a href='" . $this->baseUrl() . $query . "&amp;code_coverage=true'>Analyze Code Coverage</a> | \n";
echo "<a href='" . $this->baseUrl() . $query . "&amp;code_coverage=true&amp;show_passes=1&amp;debug=1'>All options enabled</a></p>\n";
}
/**
@ -242,17 +243,21 @@ class CakeHtmlReporter extends CakeBaseReporter {
*
* @param PHPUnit_Framework_AssertionFailedError $message Failure object displayed in
* the context of the other tests.
* @param mixed $test The test case to paint a failure for.
* @return void
*/
public function paintFail($message, $test) {
$trace = $this->_getStackTrace($message);
$testName = get_class($test) . '(' . $test->getName() . ')';
$className = get_class($test);
$testName = $className . '::' . $test->getName() . '()';
$actualMsg = $expectedMsg = null;
$failure = $message->getComparisonFailure();
if (is_object($failure)) {
$actualMsg = $message->getComparisonFailure()->getActualAsString();
$expectedMsg = $message->getComparisonFailure()->getExpectedAsString();
if (method_exists($message, 'getComparisonFailure')) {
$failure = $message->getComparisonFailure();
if (is_object($failure)) {
$actualMsg = $failure->getActualAsString();
$expectedMsg = $failure->getExpectedAsString();
}
}
echo "<li class='fail'>\n";
@ -260,11 +265,15 @@ class CakeHtmlReporter extends CakeBaseReporter {
echo "<div class='msg'><pre>" . $this->_htmlEntities($message->toString());
if ((is_string($actualMsg) && is_string($expectedMsg)) || (is_array($actualMsg) && is_array($expectedMsg))) {
echo "<br />" . PHPUnit_Util_Diff::diff($expectedMsg, $actualMsg);
echo "<br />" . $this->_htmlEntities(PHPUnit_Util_Diff::diff($expectedMsg, $actualMsg));
}
echo "</pre></div>\n";
echo "<div class='msg'>" . __d('cake_dev', 'Test case: %s', $testName) . "</div>\n";
if (strpos($className, "PHPUnit_") === false) {
list($show, $query) = $this->_getQueryLink();
echo "<div class='msg'><a href='" . $this->baseUrl() . $query . "&amp;filter=" . $test->getName() . "'>" . __d('cake_dev', 'Rerun only this test: %s', $testName) . "</a></div>\n";
}
echo "<div class='msg'>" . __d('cake_dev', 'Stack trace:') . '<br />' . $trace . "</div>\n";
echo "</li>\n";
}
@ -274,7 +283,7 @@ class CakeHtmlReporter extends CakeBaseReporter {
* trail of the nesting test suites below the
* top level test.
*
* @param PHPUnit_Framework_Test test method that just passed
* @param PHPUnit_Framework_Test $test Test method that just passed
* @param float $time time spent to run the test method
* @return void
*/
@ -291,7 +300,8 @@ class CakeHtmlReporter extends CakeBaseReporter {
/**
* Paints a PHP exception.
*
* @param Exception $exception Exception to display.
* @param Exception $message Exception to display.
* @param mixed $test The test that failed.
* @return void
*/
public function paintException($message, $test) {
@ -365,7 +375,8 @@ class CakeHtmlReporter extends CakeBaseReporter {
/**
* A test suite started.
*
* @param PHPUnit_Framework_TestSuite $suite
* @param PHPUnit_Framework_TestSuite $suite The test suite to start.
* @return void
*/
public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
if (!$this->_headerSent) {
@ -374,4 +385,32 @@ class CakeHtmlReporter extends CakeBaseReporter {
echo '<h2>' . __d('cake_dev', 'Running %s', $suite->getName()) . '</h2>';
}
/**
* Returns the query string formatted for ouput in links
*
* @return string
*/
protected function _getQueryLink() {
$show = $query = array();
if (!empty($this->params['case'])) {
$show['show'] = 'cases';
}
if (!empty($this->params['core'])) {
$show['core'] = $query['core'] = 'true';
}
if (!empty($this->params['plugin'])) {
$show['plugin'] = $query['plugin'] = $this->params['plugin'];
}
if (!empty($this->params['case'])) {
$query['case'] = $this->params['case'];
}
if (!empty($this->params['filter'])) {
$query['filter'] = $this->params['filter'];
}
$show = $this->_queryString($show);
$query = $this->_queryString($query);
return array($show, $query);
}
}