From 6e54f5706df37ce771a4f899071a2780e11ff605 Mon Sep 17 00:00:00 2001 From: Yves P Date: Tue, 1 Aug 2017 13:25:28 +0200 Subject: [PATCH] Update a test to make sure the correct message is generated when an unknown shell option is being used --- src/Console/ConsoleOptionParser.php | 2 +- tests/TestCase/Console/ConsoleOptionParserTest.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Console/ConsoleOptionParser.php b/src/Console/ConsoleOptionParser.php index 10c03e781e7..0a235f989eb 100644 --- a/src/Console/ConsoleOptionParser.php +++ b/src/Console/ConsoleOptionParser.php @@ -825,7 +825,7 @@ public function getCommandError($command) * @param string $option Unknown option name trying to be used. * @return string The message to be displayed in the console. */ - public function getOptionError($option) + protected function getOptionError($option) { $availableOptions = array_keys($this->_options); $bestGuess = $this->findClosestItem($option, $availableOptions); diff --git a/tests/TestCase/Console/ConsoleOptionParserTest.php b/tests/TestCase/Console/ConsoleOptionParserTest.php index 982db66c0b5..fda9f2b7509 100644 --- a/tests/TestCase/Console/ConsoleOptionParserTest.php +++ b/tests/TestCase/Console/ConsoleOptionParserTest.php @@ -359,6 +359,8 @@ public function testOptionWithBooleanParam() * test parsing options that do not exist. * * @expectedException \Cake\Console\Exception\ConsoleException + * @expectedExceptionMessageRegexp /Unknown option `fail`.\n\nDid you mean `help` \?\n\nAvailable options are :\n\n + * - help\n - no-commit/ * @return void */ public function testOptionThatDoesNotExist()