Browse Source

Fix routes check not handling invalid input

Make the positional argument required so we don't get errors downstream.

Fixes #14438
Mark Story 6 years ago
parent
commit
714d753490
2 changed files with 14 additions and 0 deletions
  1. 1 0
      src/Command/RoutesCheckCommand.php
  2. 13 0
      tests/TestCase/Command/RoutesCommandTest.php

+ 1 - 0
src/Command/RoutesCheckCommand.php

@@ -90,6 +90,7 @@ class RoutesCheckCommand extends Command
         )
         ->addArgument('url', [
             'help' => 'The URL to check.',
+            'required' => true,
         ]);
 
         return $parser;

+ 13 - 0
tests/TestCase/Command/RoutesCommandTest.php

@@ -108,6 +108,19 @@ class RoutesCommandTest extends TestCase
         $this->assertErrorEmpty();
     }
 
+
+    /**
+     * Ensure routes check with no input
+     *
+     * @return void
+     */
+    public function testCheckNoInput()
+    {
+        $this->exec('routes check');
+        $this->assertExitCode(Command::CODE_ERROR);
+        $this->assertErrorContains('`url` argument is required');
+    }
+
     /**
      * Test checking an existing route.
      *