Skip to content

Commit

Permalink
Provides backward compatibility for the CommandTask::subCommands() me…
Browse files Browse the repository at this point in the history
…thod
  • Loading branch information
HavokInspiration committed Dec 3, 2015
1 parent 82e315a commit 58ca430
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Shell/Task/CommandTask.php
Expand Up @@ -186,7 +186,7 @@ public function getShell($commandName)
$pluginDot = '';
}

if (!in_array($commandName, $this->commands())) {
if (!in_array($commandName, $this->commands()) && (empty($pluginDot) && !in_array($name, $this->commands()))) {
return false;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/TestCase/Shell/CompletionShellTest.php
Expand Up @@ -209,6 +209,20 @@ public function testSubCommandsPlugin()
$this->assertTextEquals($expected, $output);
}

/**
* test that using the dot notation when not mandatory works to provide backward compatibility
*
* @return void
*/
public function testSubCommandsPluginDotNotationBackwardCompatibility()
{
$this->Shell->runCommand(['subcommands', 'TestPluginTwo.welcome']);
$output = $this->out->output;

$expected = "say_hello\n";
$this->assertTextEquals($expected, $output);
}

/**
* test that subCommands with an existing plugin command returns the proper sub commands
*
Expand Down

0 comments on commit 58ca430

Please sign in to comment.