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,18 @@
/**
* CakeTestSuiteDispatcher controls dispatching TestSuite web based requests.
*
* 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
* @package Cake.TestSuite
* @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
*/
define('CORE_TEST_CASES', CAKE . 'Test' . DS . 'Case');
@ -38,7 +37,7 @@ class CakeTestSuiteDispatcher {
'codeCoverage' => false,
'case' => null,
'core' => false,
'app' => true,
'app' => false,
'plugin' => null,
'output' => 'html',
'show' => 'groups',
@ -55,7 +54,7 @@ class CakeTestSuiteDispatcher {
protected $_baseUrl;
/**
* Base dir of the request. Used for accessing assets.
* Base dir of the request. Used for accessing assets.
*
* @var string
*/
@ -64,7 +63,7 @@ class CakeTestSuiteDispatcher {
/**
* boolean to set auto parsing of params.
*
* @var boolean
* @var bool
*/
protected $_paramsParsed = false;
@ -76,9 +75,7 @@ class CakeTestSuiteDispatcher {
protected static $_Reporter = null;
/**
* constructor
*
* @return void
* Constructor
*/
public function __construct() {
$this->_baseUrl = $_SERVER['PHP_SELF'];
@ -117,7 +114,7 @@ class CakeTestSuiteDispatcher {
}
/**
* Checks that PHPUnit is installed. Will exit if it doesn't
* Checks that PHPUnit is installed. Will exit if it doesn't
*
* @return void
*/
@ -133,17 +130,37 @@ class CakeTestSuiteDispatcher {
/**
* Checks for the existence of the test framework files
*
* @return boolean true if found, false otherwise
* @return bool true if found, false otherwise
*/
public function loadTestFramework() {
foreach (App::path('vendors') as $vendor) {
if (is_dir($vendor . 'PHPUnit')) {
if (class_exists('PHPUnit_Framework_TestCase')) {
return true;
}
$phpunitPath = 'phpunit' . DS . 'phpunit';
if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
$composerGlobalDir[] = env('APPDATA') . DS . 'Composer' . DS . 'vendor' . DS;
} else {
$composerGlobalDir[] = env('HOME') . DS . '.composer' . DS . 'vendor' . DS;
}
$vendors = array_merge(App::path('vendors'), $composerGlobalDir);
foreach ($vendors as $vendor) {
$vendor = rtrim($vendor, DS);
if (is_dir($vendor . DS . $phpunitPath)) {
ini_set('include_path', $vendor . DS . $phpunitPath . PATH_SEPARATOR . ini_get('include_path'));
break;
} elseif (is_dir($vendor . DS . 'PHPUnit')) {
ini_set('include_path', $vendor . PATH_SEPARATOR . ini_get('include_path'));
break;
} elseif (is_file($vendor . DS . 'phpunit.phar')) {
$backup = $GLOBALS['_SERVER']['SCRIPT_NAME'];
$GLOBALS['_SERVER']['SCRIPT_NAME'] = '-';
$included = include_once $vendor . DS . 'phpunit.phar';
$GLOBALS['_SERVER']['SCRIPT_NAME'] = $backup;
return $included;
}
}
return include 'PHPUnit' . DS . 'Autoload.php';
include 'PHPUnit' . DS . 'Autoload.php';
return class_exists('PHPUnit_Framework_TestCase');
}
/**
@ -186,7 +203,7 @@ class CakeTestSuiteDispatcher {
}
/**
* Parse url params into a 'request'
* Parse URL params into a 'request'
*
* @return void
*/
@ -237,9 +254,9 @@ class CakeTestSuiteDispatcher {
restore_error_handler();
try {
self::time();
static::time();
$command = new CakeTestSuiteCommand('CakeTestLoader', $commandArgs);
$result = $command->run($options);
$command->run($options);
} catch (MissingConnectionException $exception) {
ob_end_clean();
$baseDir = $this->_baseDir;
@ -251,8 +268,8 @@ class CakeTestSuiteDispatcher {
/**
* Sets a static timestamp
*
* @param boolean $reset to set new static timestamp.
* @return integer timestamp
* @param bool $reset to set new static timestamp.
* @return int timestamp
*/
public static function time($reset = false) {
static $now;
@ -270,7 +287,7 @@ class CakeTestSuiteDispatcher {
* @return string formatted date
*/
public static function date($format) {
return date($format, self::time());
return date($format, static::time());
}
}