Browse Source

Update a test to make sure the correct message is generated when an unknown shell option is being used

Yves P 8 years ago
parent
commit
6e54f5706d

+ 1 - 1
src/Console/ConsoleOptionParser.php

@@ -825,7 +825,7 @@ class ConsoleOptionParser
      * @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);

+ 2 - 0
tests/TestCase/Console/ConsoleOptionParserTest.php

@@ -359,6 +359,8 @@ class ConsoleOptionParserTest extends TestCase
      * 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()