Adding test cases for execute()

Adding more i18n
Fixing issues with folders being left behind by tests.
This commit is contained in:
mark_story 2009-06-10 23:21:42 -04:00
parent 22c575595d
commit 701d93c61c
2 changed files with 33 additions and 10 deletions

View file

@ -73,14 +73,13 @@ class PluginTask extends Shell {
$pluginPath = Inflector::underscore($plugin) . DS;
$this->Dispatch->shiftArgs();
if (is_dir($this->path . $pluginPath)) {
$this->out(sprintf('Plugin: %s', $plugin));
$this->out(sprintf('Path: %s', $this->path . $pluginPath));
$this->hr();
$this->out(sprintf(__('Plugin: %s', true), $plugin));
$this->out(sprintf(__('Path: %s', true), $this->path . $pluginPath));
} elseif (isset($this->args[0])) {
$this->err(sprintf('%s in path %s not found.', $plugin, $this->path . $pluginPath));
$this->err(sprintf(__('%s in path %s not found.', true), $plugin, $this->path . $pluginPath));
$this->_stop();
} else {
return $this->__interactive($plugin);
$this->__interactive($plugin);
}
}
@ -98,7 +97,6 @@ class PluginTask extends Shell {
return $this->{$task}->execute();
}
}
$this->help();
}
/**
@ -133,11 +131,11 @@ class PluginTask extends Shell {
}
$this->hr();
$this->out(__("Plugin Name: ", true) . $plugin);
$this->out(__("Plugin Directory: ", true) . $this->path . $pluginPath);
$this->out(sprintf(__("Plugin Name: %s", true) . $plugin));
$this->out(sprintf(__("Plugin Directory: %s", true) . $this->path . $pluginPath));
$this->hr();
$looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
$looksGood = $this->in(__('Look okay?', true), array('y', 'n', 'q'), 'y');
if (strtolower($looksGood) == 'y') {
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');

View file

@ -83,6 +83,7 @@ class PluginTaskTest extends CakeTestCase {
$this->_paths = $paths = Configure::read('pluginPaths');
$this->_testPath = array_push($paths, TMP);
Configure::write('pluginPaths', $paths);
clearstatcache();
}
/**
@ -132,7 +133,31 @@ class PluginTaskTest extends CakeTestCase {
$file = $path . DS . 'bake_test_plugin_app_model.php';
$this->Task->expectAt(1, 'createFile', array($file, '*'), 'No AppModel %s');
@rmdir(TMP . 'bake_test_plugin');
$Folder =& new Folder(TMP . 'bake_test_plugin');
$Folder->delete();
}
/**
* Test Execute
*
* @return void
**/
function testExecuteWithOneArg() {
$this->Task->setReturnValueAt(0, 'in', $this->_testPath);
$this->Task->setReturnValueAt(1, 'in', 'y');
$this->Task->Dispatch->args = array('BakeTestPlugin');
$this->Task->args =& $this->Task->Dispatch->args;
$path = TMP . 'bake_test_plugin';
$file = $path . DS . 'bake_test_plugin_app_controller.php';
$this->Task->expectAt(0, 'createFile', array($file, '*'), 'No AppController %s');
$file = $path . DS . 'bake_test_plugin_app_model.php';
$this->Task->expectAt(1, 'createFile', array($file, '*'), 'No AppModel %s');
$this->Task->execute();
$Folder =& new Folder(TMP . 'bake_test_plugin');
$Folder->delete();
}
}