Skip to content
Permalink
Browse files

Updating test task to use the option parser.

Removing dead help method.
  • Loading branch information...
markstory committed Oct 13, 2010
1 parent 52c1c71 commit d3e4cedf12633d54253aed3f5c2f7417e9a99719
Showing with 14 additions and 21 deletions.
  1. +14 −21 cake/console/libs/tasks/test.php
@@ -60,7 +60,6 @@ class TestTask extends BakeTask {
*/
protected $_fixtures = array();
/**
* Execution method always used for tasks
*
@@ -77,7 +76,7 @@ public function execute() {
if (count($this->args) > 1) {
$type = Inflector::underscore($this->args[0]);
if ($this->bake($type, $this->args[1])) {
$this->out('done');
$this->out('<success>Done</success>');
}
}
}
@@ -412,27 +411,21 @@ public function testCaseFileName($type, $className) {
}
/**
* Show help file.
* get the option parser.
*
* @return void
*/
public function help() {
$this->hr();
$this->out("Usage: cake bake test <type> <class>");
$this->hr();
$this->out('Commands:');
$this->out("");
$this->out("test model post\n\tbakes a test case for the post model.");
$this->out("");
$this->out("test controller comments\n\tbakes a test case for the comments controller.");
$this->out("");
$this->out('Arguments:');
$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();
public function getOptionParser() {
$parser = parent::getOptionParser();
return $parser->description(__('Bake test case skeletons for classes.'))
->addArgument('type', array(
'help' => __('Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'),
'choices' => array('controller', 'model', 'helper', 'component', 'behavior')
))->addArgument('name', array(
'help' => __('An existing class to bake tests for.')
))->addOption('plugin', array(
'short' => 'p',
'help' => __('CamelCased name of the plugin to bake tests for.')
));
}
}

0 comments on commit d3e4ced

Please sign in to comment.
You can’t perform that action at this time.