Sets whether the application catches and displays exceptions thrown
while running a command.
public setCatchExceptions ( boolean $catch ) : static | ||
$catch | boolean | Whether to catch and display exceptions thrown while running a command. |
return | static | The current instance. |
/** * @expectedException \Webmozart\Console\Api\Command\NoSuchCommandException */ public function testThrowExceptionIfCatchingNotActive() { $this->config->setCatchExceptions(false)->beginCommand('list')->setHandler(new CallbackHandler(function () { throw NoSuchCommandException::forCommandName('foobar', 123); }))->end(); $args = new StringArgs('list'); $input = new StringInputStream(); $output = new BufferedOutputStream(); $errorOutput = new BufferedOutputStream(); $application = new ConsoleApplication($this->config); $application->run($args, $input, $output, $errorOutput); }
/** * @expectedException \InvalidArgumentException */ public function testSetCatchExceptionsFailsIfNoBoolean() { $this->config->setCatchExceptions(1234); }