Updating test task to use the option parser.

Removing dead help method.
This commit is contained in:
mark_story 2010-10-12 22:25:04 -04:00
parent 52c1c71e4a
commit d3e4cedf12

View file

@ -60,7 +60,6 @@ class TestTask extends BakeTask {
*/ */
protected $_fixtures = array(); protected $_fixtures = array();
/** /**
* Execution method always used for tasks * Execution method always used for tasks
* *
@ -77,7 +76,7 @@ class TestTask extends BakeTask {
if (count($this->args) > 1) { if (count($this->args) > 1) {
$type = Inflector::underscore($this->args[0]); $type = Inflector::underscore($this->args[0]);
if ($this->bake($type, $this->args[1])) { if ($this->bake($type, $this->args[1])) {
$this->out('done'); $this->out('<success>Done</success>');
} }
} }
} }
@ -412,27 +411,21 @@ class TestTask extends BakeTask {
} }
/** /**
* Show help file. * get the option parser.
* *
* @return void * @return void
*/ */
public function help() { public function getOptionParser() {
$this->hr(); $parser = parent::getOptionParser();
$this->out("Usage: cake bake test <type> <class>"); return $parser->description(__('Bake test case skeletons for classes.'))
$this->hr(); ->addArgument('type', array(
$this->out('Commands:'); 'help' => __('Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'),
$this->out(""); 'choices' => array('controller', 'model', 'helper', 'component', 'behavior')
$this->out("test model post\n\tbakes a test case for the post model."); ))->addArgument('name', array(
$this->out(""); 'help' => __('An existing class to bake tests for.')
$this->out("test controller comments\n\tbakes a test case for the comments controller."); ))->addOption('plugin', array(
$this->out(""); 'short' => 'p',
$this->out('Arguments:'); 'help' => __('CamelCased name of the plugin to bake tests for.')
$this->out("\t<type> Can be any of the following 'controller', 'model', 'helper',\n\t'component', 'behavior'."); ));
$this->out("\t<class> Any existing class for the chosen type.");
$this->out("");
$this->out("Parameters:");
$this->out("\t-plugin CamelCased name of plugin to bake tests for.");
$this->out("");
$this->_stop();
} }
} }