From a0660ffd9d8240599827f1556d77d0f084af0687 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 14 Apr 2011 21:58:46 -0400 Subject: [PATCH] Fixing constants being incorrect when calling cake console from the root of the source tree checkout. --- lib/Cake/Console/ShellDispatcher.php | 5 ++-- .../Case/Console/ShellDispatcherTest.php | 24 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 2bc41e66c..465b6d303 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -129,7 +129,6 @@ class ShellDispatcher { if (!is_dir(ROOT . DS . APP_DIR . DS . 'tmp')) { define('TMP', CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'Console' . DS . 'templates' . DS . 'skel' . DS . 'tmp' . DS); } - $boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . DS . 'bootstrap.php'); require CORE_PATH . 'Cake' . DS . 'bootstrap.php'; @@ -230,7 +229,7 @@ class ShellDispatcher { $defaults = array( 'app' => 'app', - 'root' => dirname(dirname(dirname(__FILE__))), + 'root' => dirname(dirname(dirname(dirname(__FILE__)))), 'working' => null, 'webroot' => 'webroot' ); @@ -323,4 +322,4 @@ class ShellDispatcher { protected function _stop($status = 0) { exit($status); } -} \ No newline at end of file +} diff --git a/lib/Cake/tests/Case/Console/ShellDispatcherTest.php b/lib/Cake/tests/Case/Console/ShellDispatcherTest.php index 7cb59e6e3..f31af2f5b 100644 --- a/lib/Cake/tests/Case/Console/ShellDispatcherTest.php +++ b/lib/Cake/tests/Case/Console/ShellDispatcherTest.php @@ -154,8 +154,8 @@ class ShellDispatcherTest extends CakeTestCase { $expected = array( 'app' => 'app', 'webroot' => 'webroot', - 'working' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH . DS . 'app'), - 'root' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH), + 'working' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'app'), + 'root' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH)), ); $Dispatcher->params = $Dispatcher->args = array(); $Dispatcher->parseParams($params); @@ -169,8 +169,8 @@ class ShellDispatcherTest extends CakeTestCase { $expected = array( 'app' => 'new', 'webroot' => 'webroot', - 'working' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH . DS . 'new'), - 'root' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH) + 'working' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'), + 'root' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH)) ); $Dispatcher->params = $Dispatcher->args = array(); $Dispatcher->parseParams($params); @@ -188,8 +188,8 @@ class ShellDispatcherTest extends CakeTestCase { $expected = array( 'app' => 'new', 'webroot' => 'webroot', - 'working' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH . DS . 'new'), - 'root' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH) + 'working' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'), + 'root' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH)) ); $Dispatcher->params = $Dispatcher->args = array(); @@ -207,8 +207,8 @@ class ShellDispatcherTest extends CakeTestCase { $expected = array( 'app' => 'new', 'webroot' => 'webroot', - 'working' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH . DS . 'new'), - 'root' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH) + 'working' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'), + 'root' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH)) ); $Dispatcher->params = $Dispatcher->args = array(); $Dispatcher->parseParams($params); @@ -225,8 +225,8 @@ class ShellDispatcherTest extends CakeTestCase { ); $expected = array( 'app' => 'new', - 'working' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH . DS . 'new'), - 'root' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH), + 'working' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'new'), + 'root' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH)), 'webroot' => 'webroot' ); $Dispatcher->params = $Dispatcher->args = array(); @@ -248,8 +248,8 @@ class ShellDispatcherTest extends CakeTestCase { $expected = array( 'app' => 'app', 'webroot' => 'webroot', - 'working' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH . DS . 'app'), - 'root' => str_replace('\\', '/', CAKE_CORE_INCLUDE_PATH), + 'working' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH) . DS . 'app'), + 'root' => str_replace('\\', '/', dirname(CAKE_CORE_INCLUDE_PATH)), ); $Dispatcher->params = $Dispatcher->args = array(); $Dispatcher->parseParams($params);