mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 10:36:16 +00:00
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6870 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
72c37d429e
commit
18b627636b
6 changed files with 219 additions and 187 deletions
|
@ -145,12 +145,15 @@ class ShellDispatcher {
|
||||||
ini_set('implicit_flush', true);
|
ini_set('implicit_flush', true);
|
||||||
ini_set('max_execution_time', 0);
|
ini_set('max_execution_time', 0);
|
||||||
}
|
}
|
||||||
define('PHP5', (phpversion() >= 5));
|
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||||
define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(dirname(__FILE__))));
|
define('PHP5', (phpversion() >= 5));
|
||||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
define('DISABLE_DEFAULT_ERROR_HANDLING', false);
|
define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(dirname(__FILE__))));
|
||||||
define('CAKEPHP_SHELL', true);
|
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||||
|
define('DISABLE_DEFAULT_ERROR_HANDLING', false);
|
||||||
|
define('CAKEPHP_SHELL', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Defines current working environment.
|
* Defines current working environment.
|
||||||
|
@ -204,8 +207,8 @@ class ShellDispatcher {
|
||||||
|
|
||||||
define('ROOT', $this->params['root']);
|
define('ROOT', $this->params['root']);
|
||||||
define('APP_DIR', $this->params['app']);
|
define('APP_DIR', $this->params['app']);
|
||||||
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
define('APP_PATH', $this->params['working'] . DS);
|
||||||
define('WWW_ROOT', 'webroot');
|
define('WWW_ROOT', APP_PATH . $this->params['webroot']);
|
||||||
|
|
||||||
$includes = array(
|
$includes = array(
|
||||||
CORE_PATH . 'cake' . DS . 'basics.php',
|
CORE_PATH . 'cake' . DS . 'basics.php',
|
||||||
|
@ -213,8 +216,10 @@ class ShellDispatcher {
|
||||||
CORE_PATH . 'cake' . DS . 'libs' . DS . 'object.php',
|
CORE_PATH . 'cake' . DS . 'libs' . DS . 'object.php',
|
||||||
CORE_PATH . 'cake' . DS . 'libs' . DS . 'inflector.php',
|
CORE_PATH . 'cake' . DS . 'libs' . DS . 'inflector.php',
|
||||||
CORE_PATH . 'cake' . DS . 'libs' . DS . 'configure.php',
|
CORE_PATH . 'cake' . DS . 'libs' . DS . 'configure.php',
|
||||||
|
CORE_PATH . 'cake' . DS . 'libs' . DS . 'file.php',
|
||||||
CORE_PATH . 'cake' . DS . 'libs' . DS . 'cache.php',
|
CORE_PATH . 'cake' . DS . 'libs' . DS . 'cache.php',
|
||||||
CORE_PATH . 'cake' . DS . 'libs' . DS . 'string.php',
|
CORE_PATH . 'cake' . DS . 'libs' . DS . 'string.php',
|
||||||
|
CORE_PATH . 'cake' . DS . 'libs' . DS . 'class_registry.php',
|
||||||
CORE_PATH . 'cake' . DS . 'console' . DS . 'error.php'
|
CORE_PATH . 'cake' . DS . 'console' . DS . 'error.php'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -229,12 +234,8 @@ class ShellDispatcher {
|
||||||
|
|
||||||
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
|
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
|
||||||
include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
|
include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
|
||||||
} else {
|
|
||||||
include_once APP_PATH . 'config' . DS . 'core.php';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require CORE_PATH . 'cake' . DS . 'libs' . DS . 'class_registry.php';
|
|
||||||
|
|
||||||
Configure::write('debug', 1);
|
Configure::write('debug', 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -441,8 +442,10 @@ class ShellDispatcher {
|
||||||
$app = 'app';
|
$app = 'app';
|
||||||
$root = dirname(dirname(dirname(__FILE__)));
|
$root = dirname(dirname(dirname(__FILE__)));
|
||||||
|
|
||||||
|
$this->params = str_replace("\\", '/', $this->params);
|
||||||
|
|
||||||
if (!empty($this->params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
|
if (!empty($this->params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
|
||||||
if ($this->params['app']{0} == '/' || preg_match('/([a-z])(:)(\\\\)/i', substr($this->params['app'], 0, 3))) {
|
if (empty($this->params['app'])) {
|
||||||
$root = dirname($this->params['working']);
|
$root = dirname($this->params['working']);
|
||||||
$app = basename($this->params['working']);
|
$app = basename($this->params['working']);
|
||||||
} else {
|
} else {
|
||||||
|
@ -452,13 +455,17 @@ class ShellDispatcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->params['app'])) {
|
if (!empty($this->params['app'])) {
|
||||||
if ($this->params['app']{0} == '/') {
|
if($this->params['app']{0} == '/' || preg_match('/([a-z])(:)/i', $this->params['app'])) {
|
||||||
$root = dirname($this->params['app']);
|
$root = dirname($this->params['app']);
|
||||||
}
|
}
|
||||||
$app = basename($this->params['app']);
|
$app = basename($this->params['app']);
|
||||||
unset($this->params['app']);
|
unset($this->params['app']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($this->params['webroot'])) {
|
||||||
|
$this->params['webroot'] = 'webroot';
|
||||||
|
}
|
||||||
|
|
||||||
$working = str_replace(DS . DS, DS, $root . DS . $app);
|
$working = str_replace(DS . DS, DS, $root . DS . $app);
|
||||||
|
|
||||||
$this->params = array_merge($this->params, array('app'=> $app, 'root'=> $root, 'working'=> $working));
|
$this->params = array_merge($this->params, array('app'=> $app, 'root'=> $root, 'working'=> $working));
|
||||||
|
@ -515,9 +522,9 @@ class ShellDispatcher {
|
||||||
*/
|
*/
|
||||||
function help() {
|
function help() {
|
||||||
$this->stdout("Current Paths:");
|
$this->stdout("Current Paths:");
|
||||||
|
$this->stdout(" -app: ". $this->params['app']);
|
||||||
$this->stdout(" -working: " . $this->params['working']);
|
$this->stdout(" -working: " . $this->params['working']);
|
||||||
$this->stdout(" -root: " . ROOT);
|
$this->stdout(" -root: " . $this->params['root']);
|
||||||
$this->stdout(" -app: ". APP);
|
|
||||||
$this->stdout(" -core: " . CORE_PATH);
|
$this->stdout(" -core: " . CORE_PATH);
|
||||||
$this->stdout("");
|
$this->stdout("");
|
||||||
$this->stdout("Changing Paths:");
|
$this->stdout("Changing Paths:");
|
||||||
|
|
|
@ -65,16 +65,11 @@ class ProjectTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($project) {
|
if ($project) {
|
||||||
if($project{0} == '/' || $project{0} == DS) {
|
$this->Dispatch->parseParams(array('-app', $project));
|
||||||
$this->Dispatch->parseParams(array('-working', $project, '-app', false));
|
$project = $this->params['working'];
|
||||||
} else {
|
|
||||||
$this->Dispatch->parseParams(array('-app', $project));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$project = $this->params['working'];
|
|
||||||
|
|
||||||
if (empty($this->params['skel'])) {
|
if (empty($this->params['skel'])) {
|
||||||
$this->params['skel'] = '';
|
$this->params['skel'] = '';
|
||||||
if (is_dir(CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'console'.DS.'libs'.DS.'templates'.DS.'skel') === true) {
|
if (is_dir(CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'console'.DS.'libs'.DS.'templates'.DS.'skel') === true) {
|
||||||
|
@ -82,38 +77,21 @@ class ProjectTask extends Shell {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!$project) {
|
||||||
|
$project = $this->in("What is the full path for this app including the app directory name?\nExample: ".$this->params['working'] . DS . "myapp", null, $this->params['working'] . DS . 'myapp');
|
||||||
|
}
|
||||||
|
|
||||||
if ($project) {
|
if ($project) {
|
||||||
$response = false;
|
$response = false;
|
||||||
while ($response == false && is_dir($project) === true && config('core') === true) {
|
while ($response == false && is_dir($project) === true && file_exists($project . 'config' . 'core.php')) {
|
||||||
$response = $this->in('A project already exists in this location: '.$project.' Overwrite?', array('y','n'), 'n');
|
$response = $this->in('A project already exists in this location: '.$project.' Overwrite?', array('y','n'), 'n');
|
||||||
if (low($response) === 'n') {
|
if (strtolower($response) === 'n') {
|
||||||
$response = false;
|
$response = $project = false;
|
||||||
|
|
||||||
while (!$response) {
|
|
||||||
$response = $this->in("What is the full path for this app including the app directory name?\nExample: ".$this->params['root'] . DS . "myapp\n[Q]uit", null, 'Q');
|
|
||||||
if (strtoupper($response) === 'Q') {
|
|
||||||
$this->out(__('Bake Aborted.', true));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$this->params['working'] = null;
|
|
||||||
$this->params['app'] = null;
|
|
||||||
$this->execute($response);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!$project) {
|
|
||||||
$project = $this->in("What is the full path for this app including the app directory name?\nExample: ".$this->params['root'] . DS . "myapp", null, $this->params['root'] . DS . 'myapp');
|
|
||||||
$this->execute($project);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($this->bake($project)) {
|
if($this->bake($project)) {
|
||||||
$this->params['app'] = basename($project);
|
|
||||||
$this->params['working'] = $project;
|
|
||||||
|
|
||||||
$path = Folder::slashTerm($project);
|
$path = Folder::slashTerm($project);
|
||||||
if ($this->createHome($path)) {
|
if ($this->createHome($path)) {
|
||||||
$this->out(__('Welcome page created', true));
|
$this->out(__('Welcome page created', true));
|
||||||
|
@ -158,6 +136,7 @@ class ProjectTask extends Shell {
|
||||||
if(!$skel) {
|
if(!$skel) {
|
||||||
$skel = $this->params['skel'];
|
$skel = $this->params['skel'];
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!$skel) {
|
while (!$skel) {
|
||||||
$skel = $this->in(sprintf(__("What is the path to the directory layout you wish to copy?\nExample: %s"), APP, null, ROOT . DS . 'myapp' . DS));
|
$skel = $this->in(sprintf(__("What is the path to the directory layout you wish to copy?\nExample: %s"), APP, null, ROOT . DS . 'myapp' . DS));
|
||||||
if ($skel == '') {
|
if ($skel == '') {
|
||||||
|
@ -201,9 +180,8 @@ class ProjectTask extends Shell {
|
||||||
} elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
|
} elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
|
||||||
$this->out('Bake Aborted.');
|
$this->out('Bake Aborted.');
|
||||||
} else {
|
} else {
|
||||||
$this->params['working'] = null;
|
|
||||||
$this->params['app'] = null;
|
|
||||||
$this->execute(false);
|
$this->execute(false);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -100,30 +100,27 @@ class Cache extends Object {
|
||||||
function config($name = 'default', $settings = array()) {
|
function config($name = 'default', $settings = array()) {
|
||||||
$_this =& Cache::getInstance();
|
$_this =& Cache::getInstance();
|
||||||
if (is_array($name)) {
|
if (is_array($name)) {
|
||||||
extract($name);
|
$settings = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_this->__config[$name])) {
|
if (!empty($settings)) {
|
||||||
$settings = array_merge($_this->__config[$name], $settings);
|
$_this->__name == null;
|
||||||
} elseif (!empty($settings)) {
|
|
||||||
$_this->__config[$name] = $settings;
|
$_this->__config[$name] = $settings;
|
||||||
|
} elseif (isset($_this->__config[$name])) {
|
||||||
|
$settings = array_merge($_this->__config[$name], $settings);
|
||||||
} elseif ($_this->__name !== null && isset($_this->__config[$_this->__name])) {
|
} elseif ($_this->__name !== null && isset($_this->__config[$_this->__name])) {
|
||||||
$name = $_this->__name;
|
$name = $_this->__name;
|
||||||
$settings = $_this->__config[$_this->__name];
|
$settings = $_this->__config[$_this->__name];
|
||||||
} else {
|
} else {
|
||||||
$name = 'default';
|
return false;
|
||||||
if(!empty($_this->__config['default'])) {
|
|
||||||
$settings = $_this->__config['default'];
|
|
||||||
} else {
|
|
||||||
$settings = array('engine'=>'File');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$engine = 'File';
|
if (empty($settings['engine'])) {
|
||||||
if (!empty($settings['engine'])) {
|
return false;
|
||||||
$engine = $settings['engine'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$engine = $settings['engine'];
|
||||||
|
|
||||||
if ($name !== $_this->__name) {
|
if ($name !== $_this->__name) {
|
||||||
if ($_this->engine($engine, $settings) === false) {
|
if ($_this->engine($engine, $settings) === false) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -334,6 +331,7 @@ class Cache extends Object {
|
||||||
if (!$engine && isset($_this->__config[$_this->__name]['engine'])) {
|
if (!$engine && isset($_this->__config[$_this->__name]['engine'])) {
|
||||||
$engine = $_this->__config[$_this->__name]['engine'];
|
$engine = $_this->__config[$_this->__name]['engine'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_this->_Engine[$engine]) && !is_null($_this->_Engine[$engine])) {
|
if (isset($_this->_Engine[$engine]) && !is_null($_this->_Engine[$engine])) {
|
||||||
return $_this->_Engine[$engine]->settings();
|
return $_this->_Engine[$engine]->settings();
|
||||||
}
|
}
|
||||||
|
@ -361,7 +359,6 @@ class Cache extends Object {
|
||||||
* @subpackage cake.cake.libs
|
* @subpackage cake.cake.libs
|
||||||
*/
|
*/
|
||||||
class CacheEngine extends Object {
|
class CacheEngine extends Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* settings of current engine instance
|
* settings of current engine instance
|
||||||
*
|
*
|
||||||
|
|
|
@ -207,9 +207,7 @@ class Configure extends Object {
|
||||||
* @return array List of directories or files in directory
|
* @return array List of directories or files in directory
|
||||||
*/
|
*/
|
||||||
function __list($path, $suffix = false, $extension = false) {
|
function __list($path, $suffix = false, $extension = false) {
|
||||||
if (!class_exists('folder')) {
|
App::import('Folder');
|
||||||
uses('folder');
|
|
||||||
}
|
|
||||||
$items = array();
|
$items = array();
|
||||||
$Folder =& new Folder($path);
|
$Folder =& new Folder($path);
|
||||||
$contents = $Folder->read(false, true);
|
$contents = $Folder->read(false, true);
|
||||||
|
@ -278,9 +276,7 @@ class Configure extends Object {
|
||||||
if (!class_exists('Debugger')) {
|
if (!class_exists('Debugger')) {
|
||||||
require LIBS . 'debugger.php';
|
require LIBS . 'debugger.php';
|
||||||
}
|
}
|
||||||
if (!class_exists('CakeLog')) {
|
App::import('CakeLog');
|
||||||
uses('cake_log');
|
|
||||||
}
|
|
||||||
Configure::write('log', LOG_NOTICE);
|
Configure::write('log', LOG_NOTICE);
|
||||||
} else {
|
} else {
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
|
@ -542,9 +538,7 @@ class Configure extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($write === true) {
|
if ($write === true) {
|
||||||
if (!class_exists('File')) {
|
App::import('File');
|
||||||
uses('File');
|
|
||||||
}
|
|
||||||
$fileClass = new File($file);
|
$fileClass = new File($file);
|
||||||
|
|
||||||
if ($fileClass->writable()) {
|
if ($fileClass->writable()) {
|
||||||
|
@ -642,7 +636,6 @@ class Configure extends Object {
|
||||||
|
|
||||||
if ($_this->read('Cache.disable') !== true) {
|
if ($_this->read('Cache.disable') !== true) {
|
||||||
$cache = Cache::settings();
|
$cache = Cache::settings();
|
||||||
|
|
||||||
if (empty($cache)) {
|
if (empty($cache)) {
|
||||||
trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING);
|
trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING);
|
||||||
list($engine, $cache) = Cache::config('default', array('engine' => 'File'));
|
list($engine, $cache) = Cache::config('default', array('engine' => 'File'));
|
||||||
|
@ -654,7 +647,7 @@ class Configure extends Object {
|
||||||
$config = Cache::config('_cake_core_' , array_merge($cache, $settings));
|
$config = Cache::config('_cake_core_' , array_merge($cache, $settings));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($_this->controllerPaths)) {
|
if (empty($_this->modelPaths)) {
|
||||||
$_this->buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths'));
|
$_this->buildPaths(compact('modelPaths', 'viewPaths', 'controllerPaths', 'helperPaths', 'componentPaths', 'behaviorPaths', 'pluginPaths', 'vendorPaths'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -900,9 +893,7 @@ class App extends Object {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isset($_this->__paths[$path])) {
|
if (!isset($_this->__paths[$path])) {
|
||||||
if (!class_exists('Folder')) {
|
$_this->import('Folder');
|
||||||
uses('Folder');
|
|
||||||
}
|
|
||||||
$Folder =& new Folder();
|
$Folder =& new Folder();
|
||||||
$directories = $Folder->tree($path, false, 'dir');
|
$directories = $Folder->tree($path, false, 'dir');
|
||||||
$_this->__paths[$path] = $directories;
|
$_this->__paths[$path] = $directories;
|
||||||
|
|
|
@ -30,11 +30,12 @@ if (!defined('DISABLE_AUTO_DISPATCH')) {
|
||||||
define('DISABLE_AUTO_DISPATCH', true);
|
define('DISABLE_AUTO_DISPATCH', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
if (!class_exists('ShellDispatcher')) {
|
||||||
$argv = false;
|
ob_start();
|
||||||
require CAKE . 'console' . DS . 'cake.php';
|
$argv = false;
|
||||||
$out = ob_get_clean();
|
require CAKE . 'console' . DS . 'cake.php';
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
|
||||||
class TestShellDispatcher extends ShellDispatcher {
|
class TestShellDispatcher extends ShellDispatcher {
|
||||||
|
|
||||||
|
@ -58,18 +59,21 @@ class ShellDispatcherTest extends UnitTestCase {
|
||||||
function testParseParams() {
|
function testParseParams() {
|
||||||
$Dispatcher =& new TestShellDispatcher();
|
$Dispatcher =& new TestShellDispatcher();
|
||||||
|
|
||||||
$params = array('/cake/1.2.x.x/cake/console/cake.php',
|
$params = array(
|
||||||
'bake',
|
'/cake/1.2.x.x/cake/console/cake.php',
|
||||||
'-app',
|
'bake',
|
||||||
'new',
|
'-app',
|
||||||
'-working',
|
'new',
|
||||||
'/var/www/htdocs'
|
'-working',
|
||||||
);
|
'/var/www/htdocs'
|
||||||
|
);
|
||||||
|
|
||||||
$expected = array('app' => 'new',
|
$expected = array(
|
||||||
'working' => '/var/www/htdocs/new',
|
'app' => 'new',
|
||||||
'root' => '/var/www/htdocs'
|
'webroot' => 'webroot',
|
||||||
);
|
'working' => '/var/www/htdocs/new',
|
||||||
|
'root' => '/var/www/htdocs'
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
|
|
||||||
|
@ -78,103 +82,121 @@ class ShellDispatcherTest extends UnitTestCase {
|
||||||
|
|
||||||
$params = array('cake.php');
|
$params = array('cake.php');
|
||||||
|
|
||||||
$expected = array('app' => 'app',
|
$expected = array(
|
||||||
'working' => ROOT . DS . 'app',
|
'app' => 'app',
|
||||||
'root' => ROOT,
|
'webroot' => 'webroot',
|
||||||
);
|
'working' => ROOT . DS . 'app',
|
||||||
|
'root' => ROOT,
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array('cake.php',
|
$params = array(
|
||||||
'-app',
|
'cake.php',
|
||||||
'new',
|
'-app',
|
||||||
);
|
'new',
|
||||||
|
);
|
||||||
|
|
||||||
$expected = array('app' => 'new',
|
$expected = array(
|
||||||
'working' => ROOT . DS . 'new',
|
'app' => 'new',
|
||||||
'root' => ROOT
|
'webroot' => 'webroot',
|
||||||
);
|
'working' => ROOT . DS . 'new',
|
||||||
|
'root' => ROOT
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array('./cake.php',
|
$params = array(
|
||||||
'bake',
|
'./cake.php',
|
||||||
'-app',
|
'bake',
|
||||||
'new',
|
'-app',
|
||||||
'-working',
|
'new',
|
||||||
' /cake/1.2.x.x/cake/console'
|
'-working',
|
||||||
);
|
'/cake/1.2.x.x/cake/console'
|
||||||
|
);
|
||||||
|
|
||||||
$expected = array('app' => 'new',
|
$expected = array(
|
||||||
'working' => ROOT . DS . 'new',
|
'app' => 'new',
|
||||||
'root' => ROOT
|
'webroot' => 'webroot',
|
||||||
);
|
'working' => ROOT . DS . 'new',
|
||||||
|
'root' => ROOT
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
|
||||||
$params = array('./console/cake.php',
|
$params = array(
|
||||||
'bake',
|
'./console/cake.php',
|
||||||
'-app',
|
'bake',
|
||||||
'new',
|
'-app',
|
||||||
'-working',
|
'new',
|
||||||
' /cake/1.2.x.x/cake'
|
'-working',
|
||||||
);
|
'/cake/1.2.x.x/cake'
|
||||||
|
);
|
||||||
|
|
||||||
$expected = array('app' => 'new',
|
$expected = array(
|
||||||
'working' => ROOT . DS . 'new',
|
'app' => 'new',
|
||||||
'root' => ROOT
|
'webroot' => 'webroot',
|
||||||
);
|
'working' => ROOT . DS . 'new',
|
||||||
|
'root' => ROOT
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
$params = array('./console/cake.php',
|
$params = array(
|
||||||
'bake',
|
'./console/cake.php',
|
||||||
'-app',
|
'bake',
|
||||||
'new',
|
'-app',
|
||||||
'-dry',
|
'new',
|
||||||
'-working',
|
'-dry',
|
||||||
' /cake/1.2.x.x/cake'
|
'-working',
|
||||||
);
|
'/cake/1.2.x.x/cake'
|
||||||
|
);
|
||||||
|
|
||||||
$expected = array('app' => 'new',
|
$expected = array(
|
||||||
'working' => ROOT . DS . 'new',
|
'app' => 'new',
|
||||||
'root' => ROOT,
|
'webroot' => 'webroot',
|
||||||
'dry' => 1
|
'working' => ROOT . DS . 'new',
|
||||||
);
|
'root' => ROOT,
|
||||||
|
'dry' => 1
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
$this->assertEqual($expected, $Dispatcher->params);
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
$params = array('./console/cake.php',
|
$params = array(
|
||||||
'-working',
|
'./console/cake.php',
|
||||||
'/cake/1.2.x.x/cake',
|
'-working',
|
||||||
'schema',
|
'/cake/1.2.x.x/cake',
|
||||||
'run',
|
'schema',
|
||||||
'create',
|
'run',
|
||||||
'-dry',
|
'create',
|
||||||
'-f',
|
'-dry',
|
||||||
'-name',
|
'-f',
|
||||||
'DbAcl'
|
'-name',
|
||||||
);
|
'DbAcl'
|
||||||
$expected = array('app' => 'app',
|
);
|
||||||
'working' => ROOT . DS . 'app',
|
|
||||||
'root' => ROOT,
|
$expected = array(
|
||||||
'dry' => 1,
|
'app' => 'app',
|
||||||
'f' => 1,
|
'webroot' => 'webroot',
|
||||||
'name' => 'DbAcl'
|
'working' => ROOT . DS . 'app',
|
||||||
);
|
'root' => ROOT,
|
||||||
|
'dry' => 1,
|
||||||
|
'f' => 1,
|
||||||
|
'name' => 'DbAcl'
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
|
@ -183,22 +205,26 @@ class ShellDispatcherTest extends UnitTestCase {
|
||||||
$expected = array('./console/cake.php', 'schema', 'run', 'create');
|
$expected = array('./console/cake.php', 'schema', 'run', 'create');
|
||||||
$this->assertEqual($expected, $Dispatcher->args);
|
$this->assertEqual($expected, $Dispatcher->args);
|
||||||
|
|
||||||
$params = array('/cake/1.2.x.x/cake/console/cake.php',
|
$params = array(
|
||||||
'-working',
|
'/cake/1.2.x.x/cake/console/cake.php',
|
||||||
'/cake/1.2.x.x/app',
|
'-working',
|
||||||
'schema',
|
'/cake/1.2.x.x/app',
|
||||||
'run',
|
'schema',
|
||||||
'create',
|
'run',
|
||||||
'-dry',
|
'create',
|
||||||
'-name',
|
'-dry',
|
||||||
'DbAcl'
|
'-name',
|
||||||
);
|
'DbAcl'
|
||||||
$expected = array('app' => 'app',
|
);
|
||||||
'working' => '/cake/1.2.x.x/app',
|
|
||||||
'root' => '/cake/1.2.x.x',
|
$expected = array(
|
||||||
'dry' => 1,
|
'app' => 'app',
|
||||||
'name' => 'DbAcl'
|
'webroot' => 'webroot',
|
||||||
);
|
'working' => '/cake/1.2.x.x/app',
|
||||||
|
'root' => '/cake/1.2.x.x',
|
||||||
|
'dry' => 1,
|
||||||
|
'name' => 'DbAcl'
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
|
@ -207,18 +233,41 @@ class ShellDispatcherTest extends UnitTestCase {
|
||||||
$expected = array('/cake/1.2.x.x/cake/console/cake.php', 'schema', 'run', 'create');
|
$expected = array('/cake/1.2.x.x/cake/console/cake.php', 'schema', 'run', 'create');
|
||||||
$this->assertEqual($expected, $Dispatcher->args);
|
$this->assertEqual($expected, $Dispatcher->args);
|
||||||
|
|
||||||
$params = array('cake.php',
|
$params = array(
|
||||||
'-working',
|
'cake.php',
|
||||||
'C:\wamp\www\cake\app',
|
'-working',
|
||||||
'bake',
|
'C:/wamp/www/cake/app',
|
||||||
'-app',
|
'bake',
|
||||||
'C:\wamp\www\apps\cake\app',
|
'-app',
|
||||||
);
|
'C:/wamp/www/apps/cake/app',
|
||||||
|
);
|
||||||
|
|
||||||
$expected = array('app' => 'C:\wamp\www\apps\cake\app',
|
$expected = array(
|
||||||
'working' => 'C:\wamp\www\cake\app',
|
'app' => 'app',
|
||||||
'root' => ROOT
|
'webroot' => 'webroot',
|
||||||
);
|
'working' => 'C:/wamp/www/apps/cake/app',
|
||||||
|
'root' => 'C:/wamp/www/apps/cake'
|
||||||
|
);
|
||||||
|
|
||||||
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
|
$Dispatcher->parseParams($params);
|
||||||
|
$this->assertEqual($expected, $Dispatcher->params);
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'cake.php',
|
||||||
|
'-working',
|
||||||
|
'C:\wamp\www\cake\app',
|
||||||
|
'bake',
|
||||||
|
'-app',
|
||||||
|
'C:\wamp\www\apps\cake\app',
|
||||||
|
);
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
'app' => 'app',
|
||||||
|
'webroot' => 'webroot',
|
||||||
|
'working' => 'C:/wamp/www/apps/cake/app',
|
||||||
|
'root' => 'C:/wamp/www/apps/cake'
|
||||||
|
);
|
||||||
|
|
||||||
$Dispatcher->params = $Dispatcher->args = array();
|
$Dispatcher->params = $Dispatcher->args = array();
|
||||||
$Dispatcher->parseParams($params);
|
$Dispatcher->parseParams($params);
|
||||||
|
@ -226,4 +275,4 @@ class ShellDispatcherTest extends UnitTestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -38,6 +38,7 @@ class ConfigureTest extends UnitTestCase {
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
$this->Configure =& Configure::getInstance();
|
$this->Configure =& Configure::getInstance();
|
||||||
|
$this->Configure->write('Cache.disable', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testListCoreObjects() {
|
function testListCoreObjects() {
|
||||||
|
@ -98,6 +99,15 @@ class ConfigureTest extends UnitTestCase {
|
||||||
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths')) {
|
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths')) {
|
||||||
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths');
|
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_core_paths');
|
||||||
}
|
}
|
||||||
|
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_dir_map')) {
|
||||||
|
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_dir_map');
|
||||||
|
}
|
||||||
|
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_file_map')) {
|
||||||
|
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_file_map');
|
||||||
|
}
|
||||||
|
if (file_exists(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_object_map')) {
|
||||||
|
unlink(TMP . 'cache' . DS . 'persistent' . DS . 'cake_core_object_map');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue