Browse Source

Fix tests.

mscherer 6 years ago
parent
commit
b8acd0e1c2
2 changed files with 10 additions and 11 deletions
  1. 1 3
      src/Console/Exception/StopException.php
  2. 9 8
      tests/TestCase/ExceptionsTest.php

+ 1 - 3
src/Console/Exception/StopException.php

@@ -13,8 +13,6 @@
  */
 namespace Cake\Console\Exception;
 
-use Cake\Core\Exception\Exception;
-
 /**
  * Exception class for halting errors in console tasks
  *
@@ -22,6 +20,6 @@ use Cake\Core\Exception\Exception;
  * @see \Cake\Console\Shell::error()
  * @see \Cake\Console\Command::abort()
  */
-class StopException extends Exception
+class StopException extends ConsoleException
 {
 }

+ 9 - 8
tests/TestCase/ExceptionsTest.php

@@ -31,14 +31,15 @@ class ExceptionsTest extends TestCase
      * Tests simple exceptions work.
      *
      * @dataProvider exceptionProvider
-     * @param $class The exception class name
-     * @param $defaultCode The default exception code
+     * @param string $class The exception class name
+     * @param int $defaultCode The default exception code
      * @return void
      */
     public function testSimpleException($class, $defaultCode)
     {
         $previous = new Exception();
 
+        /** @var \Exception $exception */
         $exception = new $class('message', 100, $previous);
         $this->assertSame('message', $exception->getMessage());
         $this->assertSame(100, $exception->getCode());
@@ -124,12 +125,12 @@ class ExceptionsTest extends TestCase
     public function exceptionProvider()
     {
         return [
-            ['Cake\Console\Exception\ConsoleException', 500],
-            ['Cake\Console\Exception\MissingHelperException', 500],
-            ['Cake\Console\Exception\MissingShellException', 500],
-            ['Cake\Console\Exception\MissingShellMethodException', 500],
-            ['Cake\Console\Exception\MissingTaskException', 500],
-            ['Cake\Console\Exception\StopException', 500],
+            ['Cake\Console\Exception\ConsoleException', 1],
+            ['Cake\Console\Exception\MissingHelperException', 1],
+            ['Cake\Console\Exception\MissingShellException', 1],
+            ['Cake\Console\Exception\MissingShellMethodException', 1],
+            ['Cake\Console\Exception\MissingTaskException', 1],
+            ['Cake\Console\Exception\StopException', 1],
             ['Cake\Controller\Exception\AuthSecurityException', 400],
             ['Cake\Controller\Exception\MissingActionException', 404],
             ['Cake\Controller\Exception\MissingComponentException', 500],