mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-10-30 07:43:59 +01:00
Upgrade CakePHP from 2.2.5 to 2.9.5
This commit is contained in:
parent
5a580df460
commit
235a541597
793 changed files with 60746 additions and 23753 deletions
|
|
@ -2,20 +2,22 @@
|
|||
/**
|
||||
* CakeBaseReporter contains common functionality to all cake test suite reporters.
|
||||
*
|
||||
* 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.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
require_once 'PHPUnit/TextUI/ResultPrinter.php';
|
||||
|
||||
if (!defined('__PHPUNIT_PHAR__')) {
|
||||
require_once 'PHPUnit/TextUI/ResultPrinter.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* CakeBaseReporter contains common reporting features used in the CakePHP Test suite
|
||||
|
|
@ -24,10 +26,15 @@ require_once 'PHPUnit/TextUI/ResultPrinter.php';
|
|||
*/
|
||||
class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
||||
|
||||
/**
|
||||
* Headers sent
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $_headerSent = false;
|
||||
|
||||
/**
|
||||
* Array of request parameters. Usually parsed GET params.
|
||||
* Array of request parameters. Usually parsed GET params.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -104,7 +111,7 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* Get the baseUrl if one is available.
|
||||
*
|
||||
* @return string The base url for the request.
|
||||
* @return string The base URL for the request.
|
||||
*/
|
||||
public function baseUrl() {
|
||||
if (!empty($_SERVER['PHP_SELF'])) {
|
||||
|
|
@ -113,10 +120,22 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Print result
|
||||
*
|
||||
* @param PHPUnit_Framework_TestResult $result The result object
|
||||
* @return void
|
||||
*/
|
||||
public function printResult(PHPUnit_Framework_TestResult $result) {
|
||||
$this->paintFooter($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paint result
|
||||
*
|
||||
* @param PHPUnit_Framework_TestResult $result The result object
|
||||
* @return void
|
||||
*/
|
||||
public function paintResult(PHPUnit_Framework_TestResult $result) {
|
||||
$this->paintFooter($result);
|
||||
}
|
||||
|
|
@ -124,9 +143,10 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* An error occurred.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param Exception $e
|
||||
* @param float $time
|
||||
* @param PHPUnit_Framework_Test $test The test to add an error for.
|
||||
* @param Exception $e The exception object to add.
|
||||
* @param float $time The current time.
|
||||
* @return void
|
||||
*/
|
||||
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) {
|
||||
$this->paintException($e, $test);
|
||||
|
|
@ -135,9 +155,10 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* A failure occurred.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param PHPUnit_Framework_AssertionFailedError $e
|
||||
* @param float $time
|
||||
* @param PHPUnit_Framework_Test $test The test that failed
|
||||
* @param PHPUnit_Framework_AssertionFailedError $e The assertion that failed.
|
||||
* @param float $time The current time.
|
||||
* @return void
|
||||
*/
|
||||
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time) {
|
||||
$this->paintFail($e, $test);
|
||||
|
|
@ -146,9 +167,10 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* Incomplete test.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param Exception $e
|
||||
* @param float $time
|
||||
* @param PHPUnit_Framework_Test $test The test that was incomplete.
|
||||
* @param Exception $e The incomplete exception
|
||||
* @param float $time The current time.
|
||||
* @return void
|
||||
*/
|
||||
public function addIncompleteTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
|
||||
$this->paintSkip($e, $test);
|
||||
|
|
@ -157,9 +179,10 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* Skipped test.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param Exception $e
|
||||
* @param float $time
|
||||
* @param PHPUnit_Framework_Test $test The test that failed.
|
||||
* @param Exception $e The skip object.
|
||||
* @param float $time The current time.
|
||||
* @return void
|
||||
*/
|
||||
public function addSkippedTest(PHPUnit_Framework_Test $test, Exception $e, $time) {
|
||||
$this->paintSkip($e, $test);
|
||||
|
|
@ -168,7 +191,8 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* A test suite started.
|
||||
*
|
||||
* @param PHPUnit_Framework_TestSuite $suite
|
||||
* @param PHPUnit_Framework_TestSuite $suite The suite to start
|
||||
* @return void
|
||||
*/
|
||||
public function startTestSuite(PHPUnit_Framework_TestSuite $suite) {
|
||||
if (!$this->_headerSent) {
|
||||
|
|
@ -180,7 +204,8 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* A test suite ended.
|
||||
*
|
||||
* @param PHPUnit_Framework_TestSuite $suite
|
||||
* @param PHPUnit_Framework_TestSuite $suite The suite that ended.
|
||||
* @return void
|
||||
*/
|
||||
public function endTestSuite(PHPUnit_Framework_TestSuite $suite) {
|
||||
}
|
||||
|
|
@ -188,7 +213,8 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* A test started.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param PHPUnit_Framework_Test $test The test that started.
|
||||
* @return void
|
||||
*/
|
||||
public function startTest(PHPUnit_Framework_Test $test) {
|
||||
}
|
||||
|
|
@ -196,8 +222,9 @@ class CakeBaseReporter extends PHPUnit_TextUI_ResultPrinter {
|
|||
/**
|
||||
* A test ended.
|
||||
*
|
||||
* @param PHPUnit_Framework_Test $test
|
||||
* @param float $time
|
||||
* @param PHPUnit_Framework_Test $test The test that ended
|
||||
* @param float $time The current time.
|
||||
* @return void
|
||||
*/
|
||||
public function endTest(PHPUnit_Framework_Test $test, $time) {
|
||||
$this->numAssertions += $test->getNumAssertions();
|
||||
|
|
|
|||
|
|
@ -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 . "&show_passes=1'>Show Passes</a> | \n";
|
||||
echo "<a href='" . $this->baseUrl() . $query . "&debug=1'>Enable Debug Output</a> | \n";
|
||||
echo "<a href='" . $this->baseUrl() . $query . "&code_coverage=true'>Analyze Code Coverage</a></p>\n";
|
||||
echo "<a href='" . $this->baseUrl() . $query . "&code_coverage=true'>Analyze Code Coverage</a> | \n";
|
||||
echo "<a href='" . $this->baseUrl() . $query . "&code_coverage=true&show_passes=1&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 . "&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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,19 +2,19 @@
|
|||
/**
|
||||
* CakeTextReporter contains reporting features used for plain text based output
|
||||
*
|
||||
* 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.3
|
||||
* @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');
|
||||
App::uses('TextCoverageReport', 'TestSuite/Coverage');
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
/**
|
||||
* Paints a failing test.
|
||||
*
|
||||
* @param $message PHPUnit_Framework_AssertionFailedError $message Failure object displayed in
|
||||
* @param PHPUnit_Framework_AssertionFailedError $message Failure object displayed in
|
||||
* the context of the other tests.
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -71,10 +71,10 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
* @return void
|
||||
*/
|
||||
public function paintFooter($result) {
|
||||
if ($result->failureCount() + $result->errorCount() == 0) {
|
||||
echo "\nOK\n";
|
||||
} else {
|
||||
if ($result->failureCount() + $result->errorCount()) {
|
||||
echo "FAILURES!!!\n";
|
||||
} else {
|
||||
echo "\nOK\n";
|
||||
}
|
||||
|
||||
echo "Test cases run: " . $result->count() .
|
||||
|
|
@ -95,7 +95,6 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
/**
|
||||
* Paints the title only.
|
||||
*
|
||||
* @param string $test_name Name class of test.
|
||||
* @return void
|
||||
*/
|
||||
public function paintHeader() {
|
||||
|
|
@ -140,7 +139,7 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
|
||||
/**
|
||||
* Generate a test case list in plain text.
|
||||
* Creates as series of url's for tests that can be run.
|
||||
* Creates as series of URLs for tests that can be run.
|
||||
* One case per line.
|
||||
*
|
||||
* @return void
|
||||
|
|
@ -151,21 +150,18 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
$plugin = $this->params['plugin'];
|
||||
|
||||
$buffer = "Core Test Cases:\n";
|
||||
$urlExtra = '';
|
||||
if ($app) {
|
||||
$buffer = "App Test Cases:\n";
|
||||
$urlExtra = '&app=true';
|
||||
} elseif ($plugin) {
|
||||
$buffer = Inflector::humanize($plugin) . " Test Cases:\n";
|
||||
$urlExtra = '&plugin=' . $plugin;
|
||||
}
|
||||
|
||||
if (1 > count($testCases)) {
|
||||
$buffer .= "EMPTY";
|
||||
if (count($testCases) < 1) {
|
||||
$buffer .= 'EMPTY';
|
||||
echo $buffer;
|
||||
}
|
||||
|
||||
foreach ($testCases as $testCaseFile => $testCase) {
|
||||
foreach ($testCases as $testCase) {
|
||||
$buffer .= $_SERVER['SERVER_NAME'] . $this->baseUrl() . "?case=" . $testCase . "&output=text\n";
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +173,7 @@ class CakeTextReporter extends CakeBaseReporter {
|
|||
* Generates a Text summary of the coverage data.
|
||||
*
|
||||
* @param array $coverage Array of coverage data.
|
||||
* @return string
|
||||
* @return void
|
||||
*/
|
||||
public function paintCoverage($coverage) {
|
||||
$reporter = new TextCoverageReport($coverage, $this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue