Skip to content

Commit

Permalink
Updating test task to use the option parser.
Browse files Browse the repository at this point in the history
Removing dead help method.
  • Loading branch information
markstory committed Oct 14, 2010
1 parent 52c1c71 commit d3e4ced
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions cake/console/libs/tasks/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class TestTask extends BakeTask {
*/
protected $_fixtures = array();


/**
* Execution method always used for tasks
*
Expand All @@ -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>');
}
}
}
Expand Down Expand Up @@ -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.