Browse Source

Add test for abort case

Mark Story 7 years ago
parent
commit
1c4b2134d3
1 changed files with 15 additions and 0 deletions
  1. 15 0
      tests/TestCase/Console/CommandTest.php

+ 15 - 0
tests/TestCase/Console/CommandTest.php

@@ -22,6 +22,7 @@ use Cake\ORM\Table;
 use Cake\TestSuite\Stub\ConsoleOutput;
 use Cake\TestSuite\TestCase;
 use InvalidArgumentException;
+use TestApp\Command\AbortCommand;
 use TestApp\Command\AutoLoadModelCommand;
 use TestApp\Command\DemoCommand;
 
@@ -343,6 +344,20 @@ class CommandTest extends TestCase
     }
 
     /**
+     * test executeCommand with an abort
+     *
+     * @return void
+     */
+    public function testExecuteCommandAbort()
+    {
+        $output = new ConsoleOutput();
+        $command = new Command();
+        $result = $command->executeCommand(AbortCommand::class, [], $this->getMockIo($output));
+        $this->assertSame(127, $result);
+        $this->assertEquals(['<error>Command aborted</error>'], $output->messages());
+    }
+
+    /**
      * test executeCommand with an invalid instance
      *
      * @return void