From cf9166a68921440a06b1bdc636b4d63932f6628f Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 23 Oct 2010 00:11:31 -0400 Subject: [PATCH] Starting to remove Dispatch->params in favor of the constants ShellDispatcher makes, this will make removing the dependency from Shell much easier. --- cake/console/shells/bake.php | 2 +- cake/console/shells/shell.php | 4 ++-- cake/console/shells/tasks/db_config.php | 2 +- cake/console/shells/tasks/extract.php | 2 +- cake/console/shells/tasks/fixture.php | 2 +- cake/tests/cases/console/shells/tasks/db_config.test.php | 3 +-- cake/tests/cases/console/shells/tasks/fixture.test.php | 5 +---- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cake/console/shells/bake.php b/cake/console/shells/bake.php index 1ee707cc4..5e934b351 100644 --- a/cake/console/shells/bake.php +++ b/cake/console/shells/bake.php @@ -60,7 +60,7 @@ class BakeShell extends Shell { public function main() { if (!is_dir($this->DbConfig->path)) { if ($this->Project->execute()) { - $this->DbConfig->path = $this->params['working'] . DS . 'config' . DS; + $this->DbConfig->path = APP_PATH . DS . 'config' . DS; } else { return false; } diff --git a/cake/console/shells/shell.php b/cake/console/shells/shell.php index d47e4ed3b..cdecaeef0 100644 --- a/cake/console/shells/shell.php +++ b/cake/console/shells/shell.php @@ -205,8 +205,8 @@ class Shell extends Object { $this->out(); $this->out('Welcome to CakePHP v' . Configure::version() . ' Console'); $this->hr(); - $this->out('App : '. $this->Dispatch->params['app']); - $this->out('Path: '. $this->Dispatch->params['working']); + $this->out('App : '. APP_DIR); + $this->out('Path: '. APP_PATH); $this->hr(); } diff --git a/cake/console/shells/tasks/db_config.php b/cake/console/shells/tasks/db_config.php index 8d15a953e..1e9dc6bbc 100644 --- a/cake/console/shells/tasks/db_config.php +++ b/cake/console/shells/tasks/db_config.php @@ -60,7 +60,7 @@ class DbConfigTask extends Shell { * @var string */ public function initialize() { - $this->path = $this->Dispatch->params['working'] . DS . 'config' . DS; + $this->path = APP_PATH . 'config' . DS; } /** diff --git a/cake/console/shells/tasks/extract.php b/cake/console/shells/tasks/extract.php index 713ae299b..c6e439313 100644 --- a/cake/console/shells/tasks/extract.php +++ b/cake/console/shells/tasks/extract.php @@ -103,7 +103,7 @@ class ExtractTask extends Shell { if (isset($this->params['paths'])) { $this->__paths = explode(',', $this->params['paths']); } else { - $defaultPath = $this->Dispatch->params['working']; + $defaultPath = APP_PATH; $message = sprintf(__("What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one"), $this->Dispatch->params['root'] . DS . 'myapp'); while (true) { $response = $this->in($message, null, $defaultPath); diff --git a/cake/console/shells/tasks/fixture.php b/cake/console/shells/tasks/fixture.php index c8062b1fc..d24d5db85 100644 --- a/cake/console/shells/tasks/fixture.php +++ b/cake/console/shells/tasks/fixture.php @@ -56,7 +56,7 @@ class FixtureTask extends BakeTask { */ public function __construct(&$dispatch, $stdout = null, $stderr = null, $stdin = null) { parent::__construct($dispatch, $stdout, $stderr, $stdin); - $this->path = $this->Dispatch->params['working'] . DS . 'tests' . DS . 'fixtures' . DS; + $this->path = APP_PATH . 'tests' . DS . 'fixtures' . DS; } /** diff --git a/cake/tests/cases/console/shells/tasks/db_config.test.php b/cake/tests/cases/console/shells/tasks/db_config.test.php index 3abbadfd9..c29e4b72c 100644 --- a/cake/tests/cases/console/shells/tasks/db_config.test.php +++ b/cake/tests/cases/console/shells/tasks/db_config.test.php @@ -69,7 +69,7 @@ class DbConfigTaskTest extends CakeTestCase { array(&$this->Dispatcher, $out, $out, $in) ); - $this->Task->params['working'] = rtrim(APP, DS); + $this->Task->path = APP . 'config' . DS; $this->Task->databaseClassName = 'TEST_DATABASE_CONFIG'; } @@ -100,7 +100,6 @@ class DbConfigTaskTest extends CakeTestCase { * @return void */ public function testInitialize() { - $this->assertTrue(empty($this->Task->path)); $this->Task->initialize(); $this->assertFalse(empty($this->Task->path)); $this->assertEqual($this->Task->path, APP . 'config' . DS); diff --git a/cake/tests/cases/console/shells/tasks/fixture.test.php b/cake/tests/cases/console/shells/tasks/fixture.test.php index b52f5ff94..42716af1e 100644 --- a/cake/tests/cases/console/shells/tasks/fixture.test.php +++ b/cake/tests/cases/console/shells/tasks/fixture.test.php @@ -85,11 +85,8 @@ class FixtureTaskTest extends CakeTestCase { $out = $this->getMock('ConsoleOutput', array(), array(), '', false); $in = $this->getMock('ConsoleInput', array(), array(), '', false); - $this->Dispatcher->params['working'] = DS . 'my' . DS . 'path'; $Task = new FixtureTask($this->Dispatcher, $out, $out, $in); - - $expected = DS . 'my' . DS . 'path' . DS . 'tests' . DS . 'fixtures' . DS; - $this->assertEqual($Task->path, $expected); + $this->assertEqual($Task->path, APP . 'tests' . DS . 'fixtures' . DS); } /**