Browse Source

Add assertErrorEmpty()

This is handy for making sure a shell doesn't output any error messages.
mark_story 8 years ago
parent
commit
11b109a8b2
1 changed files with 12 additions and 0 deletions
  1. 12 0
      src/TestSuite/ConsoleIntegrationTestCase.php

+ 12 - 0
src/TestSuite/ConsoleIntegrationTestCase.php

@@ -191,6 +191,18 @@ class ConsoleIntegrationTestCase extends TestCase
     }
 
     /**
+     * Asserts that `stderr` is empty
+     *
+     * @param string $message The message to output when the assertion fails.
+     * @return void
+     */
+    public function assertErrorEmpty($message = 'stderr was not empty')
+    {
+        $output = implode(PHP_EOL, $this->_err->messages());
+        $this->assertSame('', $output, $message);
+    }
+
+    /**
      * Builds the appropriate command dispatcher
      *
      * @return CommandRunner|LegacyCommandRunner