Skip to content
Permalink
Browse files

Display help message with `out` instead of `err` when missing method

  • Loading branch information...
littleylv committed Sep 13, 2017
1 parent 6829ddd commit d8a4ff83ae74b6a8dd1650f588b6f4e34f2fafc3
Showing with 7 additions and 7 deletions.
  1. +1 −1 src/Console/Shell.php
  2. +6 −6 tests/TestCase/Console/ShellTest.php
@@ -508,7 +508,7 @@ public function runCommand($argv, $autoMethod = false, $extra = [])
return $this->main(...$this->args);
}
$this->err($this->OptionParser->help($command));
$this->out($this->OptionParser->help($command));
return false;
}
@@ -1049,7 +1049,7 @@ public function testRunCommandWithMissingMethodInSubcommands()
public function testRunCommandBaseClassMethod()
{
$shell = $this->getMockBuilder('Cake\Console\Shell')
->setMethods(['startup', 'getOptionParser', 'err', 'hr'])
->setMethods(['startup', 'getOptionParser', 'out', 'hr'])
->disableOriginalConstructor()
->getMock();
@@ -1062,7 +1062,7 @@ public function testRunCommandBaseClassMethod()
$shell->expects($this->once())->method('getOptionParser')
->will($this->returnValue($parser));
$shell->expects($this->never())->method('hr');
$shell->expects($this->once())->method('err');
$shell->expects($this->once())->method('out');
$shell->runCommand(['hr']);
}
@@ -1075,7 +1075,7 @@ public function testRunCommandBaseClassMethod()
public function testRunCommandMissingMethod()
{
$shell = $this->getMockBuilder('Cake\Console\Shell')
->setMethods(['startup', 'getOptionParser', 'err', 'hr'])
->setMethods(['startup', 'getOptionParser', 'out', 'hr'])
->disableOriginalConstructor()
->getMock();
$shell->io($this->getMockBuilder('Cake\Console\ConsoleIo')->getMock());
@@ -1086,7 +1086,7 @@ public function testRunCommandMissingMethod()
$parser->expects($this->once())->method('help');
$shell->expects($this->once())->method('getOptionParser')
->will($this->returnValue($parser));
$shell->expects($this->once())->method('err');
$shell->expects($this->once())->method('out');
$result = $shell->runCommand(['idontexist']);
$this->assertFalse($result);
@@ -1127,7 +1127,7 @@ public function testRunCommandTriggeringHelp()
public function testRunCommandNotCallUnexposedTask()
{
$shell = $this->getMockBuilder('Cake\Console\Shell')
->setMethods(['startup', 'hasTask', 'err'])
->setMethods(['startup', 'hasTask', 'out'])
->disableOriginalConstructor()
->getMock();
$shell->io($this->getMockBuilder('Cake\Console\ConsoleIo')->getMock());
@@ -1143,7 +1143,7 @@ public function testRunCommandNotCallUnexposedTask()
->method('hasTask')
->will($this->returnValue(true));
$shell->expects($this->never())->method('startup');
$shell->expects($this->once())->method('err');
$shell->expects($this->once())->method('out');
$shell->RunCommand = $task;
$result = $shell->runCommand(['run_command', 'one']);

0 comments on commit d8a4ff8

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