From 8c63f155bafc9ccdcf6c160695c85c880bf74172 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 17 Oct 2010 15:43:20 -0400 Subject: [PATCH] Renaming + moving test and task files around. Updating tests to use import for tasks. --- cake/console/{shells => libs}/shell.php | 2 +- cake/console/{shells => libs}/task_collection.php | 0 cake/console/shell_dispatcher.php | 2 +- cake/console/shells/schema.php | 2 +- cake/console/shells/tasks/template.php | 3 ++- .../cases/console/{libs => shells}/acl.test.php | 10 +++++----- .../cases/console/{libs => shells}/api.test.php | 2 +- .../cases/console/{libs => shells}/bake.test.php | 10 +++++----- .../console/{libs => shells}/command_list.test.php | 0 .../cases/console/{libs => shells}/schema.test.php | 3 ++- .../{libs => shells}/tasks/controller.test.php | 13 +++++++------ .../{libs => shells}/tasks/db_config.test.php | 2 +- .../console/{libs => shells}/tasks/extract.test.php | 2 +- .../console/{libs => shells}/tasks/fixture.test.php | 7 +++++-- .../console/{libs => shells}/tasks/model.test.php | 8 +++++--- .../console/{libs => shells}/tasks/plugin.test.php | 7 +++++-- .../console/{libs => shells}/tasks/project.test.php | 4 ++-- .../{libs => shells}/tasks/template.test.php | 2 +- .../console/{libs => shells}/tasks/test.test.php | 7 +++++-- .../console/{libs => shells}/tasks/view.test.php | 12 +++++++----- .../console/{libs => shells}/testsuite.test.php | 3 ++- 21 files changed, 59 insertions(+), 42 deletions(-) rename cake/console/{shells => libs}/shell.php (99%) rename cake/console/{shells => libs}/task_collection.php (100%) rename cake/tests/cases/console/{libs => shells}/acl.test.php (97%) rename cake/tests/cases/console/{libs => shells}/api.test.php (97%) rename cake/tests/cases/console/{libs => shells}/bake.test.php (91%) rename cake/tests/cases/console/{libs => shells}/command_list.test.php (100%) rename cake/tests/cases/console/{libs => shells}/schema.test.php (99%) rename cake/tests/cases/console/{libs => shells}/tasks/controller.test.php (98%) rename cake/tests/cases/console/{libs => shells}/tasks/db_config.test.php (98%) rename cake/tests/cases/console/{libs => shells}/tasks/extract.test.php (98%) rename cake/tests/cases/console/{libs => shells}/tasks/fixture.test.php (98%) rename cake/tests/cases/console/{libs => shells}/tasks/model.test.php (99%) rename cake/tests/cases/console/{libs => shells}/tasks/plugin.test.php (98%) rename cake/tests/cases/console/{libs => shells}/tasks/project.test.php (99%) rename cake/tests/cases/console/{libs => shells}/tasks/template.test.php (98%) rename cake/tests/cases/console/{libs => shells}/tasks/test.test.php (99%) rename cake/tests/cases/console/{libs => shells}/tasks/view.test.php (98%) rename cake/tests/cases/console/{libs => shells}/testsuite.test.php (97%) diff --git a/cake/console/shells/shell.php b/cake/console/libs/shell.php similarity index 99% rename from cake/console/shells/shell.php rename to cake/console/libs/shell.php index 28bfd70b6..330eae937 100644 --- a/cake/console/shells/shell.php +++ b/cake/console/libs/shell.php @@ -17,7 +17,7 @@ * @since CakePHP(tm) v 1.2.0.5012 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::import('Shell', 'TaskCollection'); +require_once CONSOLE_LIBS . 'task_collection.php'; require_once CAKE . 'console' . DS . 'console_output.php'; require_once CAKE . 'console' . DS . 'console_input.php'; diff --git a/cake/console/shells/task_collection.php b/cake/console/libs/task_collection.php similarity index 100% rename from cake/console/shells/task_collection.php rename to cake/console/libs/task_collection.php diff --git a/cake/console/shell_dispatcher.php b/cake/console/shell_dispatcher.php index 000891b34..0f13ff8d3 100644 --- a/cake/console/shell_dispatcher.php +++ b/cake/console/shell_dispatcher.php @@ -317,7 +317,7 @@ class ShellDispatcher { } if (!class_exists('Shell')) { - App::import('Shell', 'Shell'); + require_once CONSOLE_LIBS . 'shell.php'; } if (!class_exists($this->shellClass)) { diff --git a/cake/console/shells/schema.php b/cake/console/shells/schema.php index 473737eac..b9c43d9cd 100644 --- a/cake/console/shells/schema.php +++ b/cake/console/shells/schema.php @@ -269,7 +269,7 @@ class SchemaShell extends Shell { $plugin = $this->params['plugin']; } - if ($this->params['dry']) { + if (!empty($this->params['dry'])) { $this->__dry = true; $this->out(__('Performing a dry run.')); } diff --git a/cake/console/shells/tasks/template.php b/cake/console/shells/tasks/template.php index 851815f2d..df9faf15a 100644 --- a/cake/console/shells/tasks/template.php +++ b/cake/console/shells/tasks/template.php @@ -55,7 +55,7 @@ class TemplateTask extends Shell { $paths = App::path('shells'); $core = array_pop($paths); $separator = DS === '/' ? '/' : '\\\\'; - $core = preg_replace('#libs' . $separator . '$#', '', $core); + $core = preg_replace('#shells' . $separator . '$#', '', $core); $paths[] = $core; $Folder =& new Folder($core . 'templates' . DS . 'default'); $contents = $Folder->read(); @@ -63,6 +63,7 @@ class TemplateTask extends Shell { $plugins = App::objects('plugin'); foreach ($plugins as $plugin) { + $paths[] = $this->_pluginPath($plugin) . 'console' . DS . 'shells' . DS; $paths[] = $this->_pluginPath($plugin) . 'vendors' . DS . 'shells' . DS; } diff --git a/cake/tests/cases/console/libs/acl.test.php b/cake/tests/cases/console/shells/acl.test.php similarity index 97% rename from cake/tests/cases/console/libs/acl.test.php rename to cake/tests/cases/console/shells/acl.test.php index 9af1eceb0..74807864c 100644 --- a/cake/tests/cases/console/libs/acl.test.php +++ b/cake/tests/cases/console/shells/acl.test.php @@ -18,9 +18,9 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', 'Acl'); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'acl.php'; /** * AclShellTest class @@ -58,7 +58,7 @@ class AclShellTest extends CakeTestCase { ); $this->Task = $this->getMock( 'AclShell', - array('in', 'out', 'hr', 'createFile', 'error', 'err', 'clear'), + array('in', 'out', 'hr', 'createFile', 'error', 'err', 'clear', 'dispatchShell'), array(&$this->Dispatcher, $out, $out, $in) ); $collection = new ComponentCollection(); @@ -302,9 +302,9 @@ class AclShellTest extends CakeTestCase { * @return void */ function testInitDb() { - $this->Task->Dispatch->expects($this->once())->method('dispatch'); + $this->Task->expects($this->once())->method('dispatchShell') + ->with('schema create DbAcl'); + $this->Task->initdb(); - - $this->assertEqual($this->Task->Dispatch->args, array('schema', 'create', 'DbAcl')); } } diff --git a/cake/tests/cases/console/libs/api.test.php b/cake/tests/cases/console/shells/api.test.php similarity index 97% rename from cake/tests/cases/console/libs/api.test.php rename to cake/tests/cases/console/shells/api.test.php index 685ddb091..6a4c5cb96 100644 --- a/cake/tests/cases/console/libs/api.test.php +++ b/cake/tests/cases/console/shells/api.test.php @@ -18,9 +18,9 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', 'Api'); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'api.php'; /** diff --git a/cake/tests/cases/console/libs/bake.test.php b/cake/tests/cases/console/shells/bake.test.php similarity index 91% rename from cake/tests/cases/console/libs/bake.test.php rename to cake/tests/cases/console/shells/bake.test.php index 9b546339f..ec124251e 100644 --- a/cake/tests/cases/console/libs/bake.test.php +++ b/cake/tests/cases/console/shells/bake.test.php @@ -19,13 +19,13 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); -App::import('Core', 'Controller'); +App::import('Shell', 'Bake', false); +App::import('Shell', 'tasks/model', false); +App::import('Shell', 'tasks/controller', false); +App::import('Shell', 'tasks/db_config', false); +App::import('Core', 'Controller'); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'bake.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'controller.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'db_config.php'; if (!class_exists('UsersController')) { class UsersController extends Controller { diff --git a/cake/tests/cases/console/libs/command_list.test.php b/cake/tests/cases/console/shells/command_list.test.php similarity index 100% rename from cake/tests/cases/console/libs/command_list.test.php rename to cake/tests/cases/console/shells/command_list.test.php diff --git a/cake/tests/cases/console/libs/schema.test.php b/cake/tests/cases/console/shells/schema.test.php similarity index 99% rename from cake/tests/cases/console/libs/schema.test.php rename to cake/tests/cases/console/shells/schema.test.php index 72fd74fb2..3a1c906bf 100644 --- a/cake/tests/cases/console/libs/schema.test.php +++ b/cake/tests/cases/console/shells/schema.test.php @@ -18,10 +18,11 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', 'Schema', false); App::import('Model', 'CakeSchema', false); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'schema.php'; + /** diff --git a/cake/tests/cases/console/libs/tasks/controller.test.php b/cake/tests/cases/console/shells/tasks/controller.test.php similarity index 98% rename from cake/tests/cases/console/libs/tasks/controller.test.php rename to cake/tests/cases/console/shells/tasks/controller.test.php index 849cf9088..e625b0db1 100644 --- a/cake/tests/cases/console/libs/tasks/controller.test.php +++ b/cake/tests/cases/console/shells/tasks/controller.test.php @@ -20,14 +20,15 @@ App::import('Core', 'ClassRegistry'); App::import('View', 'Helper', false); App::import('Shell', 'Shell', false); +App::import('Shell', array( + 'tasks/project', + 'tasks/controller', + 'tasks/model', + 'tasks/template', + 'tasks/test' +)); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'project.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'controller.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'test.php'; - $imported = App::import('Model', 'BakeArticle'); $imported = $imported || App::import('Model', 'BakeComment'); diff --git a/cake/tests/cases/console/libs/tasks/db_config.test.php b/cake/tests/cases/console/shells/tasks/db_config.test.php similarity index 98% rename from cake/tests/cases/console/libs/tasks/db_config.test.php rename to cake/tests/cases/console/shells/tasks/db_config.test.php index a03660869..e74b94d95 100644 --- a/cake/tests/cases/console/libs/tasks/db_config.test.php +++ b/cake/tests/cases/console/shells/tasks/db_config.test.php @@ -18,9 +18,9 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', 'tasks/DbConfig'); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'db_config.php'; class TEST_DATABASE_CONFIG { diff --git a/cake/tests/cases/console/libs/tasks/extract.test.php b/cake/tests/cases/console/shells/tasks/extract.test.php similarity index 98% rename from cake/tests/cases/console/libs/tasks/extract.test.php rename to cake/tests/cases/console/shells/tasks/extract.test.php index cd2393183..b7a583bb4 100644 --- a/cake/tests/cases/console/libs/tasks/extract.test.php +++ b/cake/tests/cases/console/shells/tasks/extract.test.php @@ -21,9 +21,9 @@ */ App::import('Core', 'Folder'); App::import('Shell', 'Shell', false); +App::import('Shell', 'tasks/Extract', false); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'extract.php'; /** * ExtractTaskTest class diff --git a/cake/tests/cases/console/libs/tasks/fixture.test.php b/cake/tests/cases/console/shells/tasks/fixture.test.php similarity index 98% rename from cake/tests/cases/console/libs/tasks/fixture.test.php rename to cake/tests/cases/console/shells/tasks/fixture.test.php index 656cf7d46..9386ae570 100644 --- a/cake/tests/cases/console/libs/tasks/fixture.test.php +++ b/cake/tests/cases/console/shells/tasks/fixture.test.php @@ -18,10 +18,13 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', array( + 'tasks/fixture', + 'tasks/template', + 'tasks/db_config' +)); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'fixture.php'; /** * FixtureTaskTest class diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/shells/tasks/model.test.php similarity index 99% rename from cake/tests/cases/console/libs/tasks/model.test.php rename to cake/tests/cases/console/shells/tasks/model.test.php index 0d7c4c12f..e7700ce24 100644 --- a/cake/tests/cases/console/libs/tasks/model.test.php +++ b/cake/tests/cases/console/shells/tasks/model.test.php @@ -20,11 +20,13 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', array( + 'tasks/model', + 'tasks/fixture', + 'tasks/template' +)); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'fixture.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php'; /** * ModelTaskTest class diff --git a/cake/tests/cases/console/libs/tasks/plugin.test.php b/cake/tests/cases/console/shells/tasks/plugin.test.php similarity index 98% rename from cake/tests/cases/console/libs/tasks/plugin.test.php rename to cake/tests/cases/console/shells/tasks/plugin.test.php index 03ba4c992..115a49ece 100644 --- a/cake/tests/cases/console/libs/tasks/plugin.test.php +++ b/cake/tests/cases/console/shells/tasks/plugin.test.php @@ -20,11 +20,14 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', array( + 'tasks/plugin', + 'tasks/model' +)); + App::import('Core', array('File')); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'plugin.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'model.php'; /** * PluginTaskPlugin class diff --git a/cake/tests/cases/console/libs/tasks/project.test.php b/cake/tests/cases/console/shells/tasks/project.test.php similarity index 99% rename from cake/tests/cases/console/libs/tasks/project.test.php rename to cake/tests/cases/console/shells/tasks/project.test.php index af178375a..c1228c11b 100644 --- a/cake/tests/cases/console/libs/tasks/project.test.php +++ b/cake/tests/cases/console/shells/tasks/project.test.php @@ -20,11 +20,11 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', 'tasks/project'); + App::import('Core', 'File'); - require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'project.php'; /** * ProjectTask Test class diff --git a/cake/tests/cases/console/libs/tasks/template.test.php b/cake/tests/cases/console/shells/tasks/template.test.php similarity index 98% rename from cake/tests/cases/console/libs/tasks/template.test.php rename to cake/tests/cases/console/shells/tasks/template.test.php index 752af6d51..eb5c53627 100644 --- a/cake/tests/cases/console/libs/tasks/template.test.php +++ b/cake/tests/cases/console/shells/tasks/template.test.php @@ -21,9 +21,9 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', 'tasks/template'); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php'; /** * TemplateTaskTest class diff --git a/cake/tests/cases/console/libs/tasks/test.test.php b/cake/tests/cases/console/shells/tasks/test.test.php similarity index 99% rename from cake/tests/cases/console/libs/tasks/test.test.php rename to cake/tests/cases/console/shells/tasks/test.test.php index 4508e82e1..15319c93f 100644 --- a/cake/tests/cases/console/libs/tasks/test.test.php +++ b/cake/tests/cases/console/shells/tasks/test.test.php @@ -20,12 +20,15 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', array( + 'tasks/test', + 'tasks/template' +)); + App::import('Controller', 'Controller', false); App::import('Model', 'Model', false); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'test.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php'; /** * Test Article model diff --git a/cake/tests/cases/console/libs/tasks/view.test.php b/cake/tests/cases/console/shells/tasks/view.test.php similarity index 98% rename from cake/tests/cases/console/libs/tasks/view.test.php rename to cake/tests/cases/console/shells/tasks/view.test.php index 759239ed6..c4878d3a5 100644 --- a/cake/tests/cases/console/libs/tasks/view.test.php +++ b/cake/tests/cases/console/shells/tasks/view.test.php @@ -20,13 +20,15 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ App::import('Shell', 'Shell', false); +App::import('Shell', array( + 'tasks/view', + 'tasks/controller', + 'tasks/template', + 'tasks/project', + 'tasks/db_config' +)); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'view.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'controller.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'template.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'tasks' . DS . 'project.php'; - /** * Test View Task Comment Model diff --git a/cake/tests/cases/console/libs/testsuite.test.php b/cake/tests/cases/console/shells/testsuite.test.php similarity index 97% rename from cake/tests/cases/console/libs/testsuite.test.php rename to cake/tests/cases/console/shells/testsuite.test.php index b949c8621..9e2d4d863 100644 --- a/cake/tests/cases/console/libs/testsuite.test.php +++ b/cake/tests/cases/console/shells/testsuite.test.php @@ -19,9 +19,10 @@ */ App::import('Shell', 'Shell', false); +App::import('Shell', 'TestSuite'); require_once CAKE . 'console' . DS . 'shell_dispatcher.php'; -require_once CAKE . 'console' . DS . 'libs' . DS . 'testsuite.php'; + class TestSuiteShellTest extends CakeTestCase {