Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing incorrectly inflected shell names in help.

  • Loading branch information...
commit fb756c5aee34309f9e1c7caab6323ae7b7ee7e7c 1 parent 5f84b48
@markstory markstory authored
View
4 lib/Cake/Console/ConsoleOptionParser.php
@@ -124,7 +124,7 @@ class ConsoleOptionParser {
* this to false will prevent the addition of `--verbose` & `--quiet` options.
*/
public function __construct($command = null, $defaultOptions = true) {
- $this->_command = $command;
+ $this->command($command);
$this->addOption('help', array(
'short' => 'h',
@@ -206,7 +206,7 @@ public static function buildFromArray($spec) {
*/
public function command($text = null) {
if ($text !== null) {
- $this->_command = $text;
+ $this->_command = Inflector::underscore($text);
return $this;
}
return $this->_command;
View
12 lib/Cake/Test/Case/Console/ConsoleOptionParserTest.php
@@ -497,6 +497,16 @@ public function testCreateFactory() {
}
/**
+ * test that command() inflects the command name.
+ *
+ * @return void
+ */
+ public function testCommandInflection() {
+ $parser = new ConsoleOptionParser('CommandLine');
+ $this->assertEquals('command_line', $parser->command());
+ }
+
+/**
* test that parse() takes a subcommand argument, and that the subcommand parser
* is used.
*
@@ -529,4 +539,4 @@ public function testParsingWithSubParser() {
$this->assertEquals($expected, $result, 'Sub parser did not parse request.');
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.