Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding test cases for execute()

Adding more i18n
Fixing issues with folders being left behind by tests.
  • Loading branch information...
commit 701d93c61c65c6a1cceddb58b722bf29e025fbac 1 parent 22c5755
@markstory markstory authored
View
16 cake/console/libs/tasks/plugin.php
@@ -73,14 +73,13 @@ function execute() {
$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 @@ function execute() {
return $this->{$task}->execute();
}
}
- $this->help();
}
/**
@@ -133,11 +131,11 @@ function bake($plugin) {
}
$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
27 cake/tests/cases/console/libs/tasks/plugin.test.php
@@ -83,6 +83,7 @@ function startCase() {
$this->_paths = $paths = Configure::read('pluginPaths');
$this->_testPath = array_push($paths, TMP);
Configure::write('pluginPaths', $paths);
+ clearstatcache();
}
/**
@@ -132,7 +133,31 @@ function testBakeFoldersAndFiles() {
$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();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.