Skip to content

Commit

Permalink
Renaming + moving test and task files around. Updating tests to use i…
Browse files Browse the repository at this point in the history
…mport for tasks.
  • Loading branch information
markstory committed Oct 17, 2010
1 parent 2cdbd67 commit 8c63f15
Show file tree
Hide file tree
Showing 21 changed files with 59 additions and 42 deletions.
Expand Up @@ -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';

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion cake/console/shell_dispatcher.php
Expand Up @@ -317,7 +317,7 @@ protected function _getShell($plugin = null) {
}

if (!class_exists('Shell')) {
App::import('Shell', 'Shell');
require_once CONSOLE_LIBS . 'shell.php';
}

if (!class_exists($this->shellClass)) {
Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/schema.php
Expand Up @@ -269,7 +269,7 @@ function _loadSchema() {
$plugin = $this->params['plugin'];
}

if ($this->params['dry']) {
if (!empty($this->params['dry'])) {
$this->__dry = true;
$this->out(__('Performing a dry run.'));
}
Expand Down
3 changes: 2 additions & 1 deletion cake/console/shells/tasks/template.php
Expand Up @@ -55,14 +55,15 @@ protected function _findThemes() {
$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();
$themeFolders = $contents[0];

$plugins = App::objects('plugin');
foreach ($plugins as $plugin) {
$paths[] = $this->_pluginPath($plugin) . 'console' . DS . 'shells' . DS;
$paths[] = $this->_pluginPath($plugin) . 'vendors' . DS . 'shells' . DS;
}

Expand Down
Expand Up @@ -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
Expand Down Expand Up @@ -58,7 +58,7 @@ public function setUp() {
);
$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();
Expand Down Expand Up @@ -302,9 +302,9 @@ public function testGetPath() {
* @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'));
}
}
Expand Up @@ -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';


/**
Expand Down
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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';



/**
Expand Down
Expand Up @@ -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');
Expand Down
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -20,11 +20,11 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::import('Shell', 'Shell', false);
App::import('Core', 'File');
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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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 {

Expand Down

0 comments on commit 8c63f15

Please sign in to comment.