Renaming + moving test and task files around. Updating tests to use import for tasks.

This commit is contained in:
mark_story 2010-10-17 15:43:20 -04:00
parent 2cdbd67d7d
commit 8c63f155ba
21 changed files with 59 additions and 42 deletions

View file

@ -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';

View file

@ -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)) {

View file

@ -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.'));
}

View file

@ -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;
}

View file

@ -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'));
}
}

View file

@ -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';
/**

View file

@ -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 {

View file

@ -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';
/**

View file

@ -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');

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 {