run() public method

public run ( Webmozart\Console\Api\Args\RawArgs $args = null, Webmozart\Console\Api\IO\InputStream $inputStream = null, Webmozart\Console\Api\IO\OutputStream $outputStream = null, Webmozart\Console\Api\IO\OutputStream $errorStream = null )
$args Webmozart\Console\Api\Args\RawArgs
$inputStream Webmozart\Console\Api\IO\InputStream
$outputStream Webmozart\Console\Api\IO\OutputStream
$errorStream Webmozart\Console\Api\IO\OutputStream
 /**
  * @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);
 }
 public function testUseConfiguredStyleSet()
 {
     $styleSet = new StyleSet();
     $styleSet->add(Style::tag('custom'));
     $this->config->setStyleSet($styleSet)->beginCommand('command')->setHandler(new CallbackHandler(function (Args $args, IO $io) {
         PHPUnit_Framework_Assert::assertSame('text', $io->removeFormat('<custom>text</custom>'));
         return 123;
     }))->end();
     $application = new ConsoleApplication($this->config);
     $args = new StringArgs('command');
     $inputStream = new StringInputStream();
     $outputStream = new BufferedOutputStream();
     $errorStream = new BufferedOutputStream();
     $status = $application->run($args, $inputStream, $outputStream, $errorStream);
     $this->assertSame(123, $status);
 }
<?php

use Webmozart\Console\Config\DefaultApplicationConfig;
use Webmozart\Console\ConsoleApplication;
use Webmozart\Console\Handler\CallbackHandler;
require_once __DIR__ . '/../../vendor/autoload.php';
$config = DefaultApplicationConfig::create()->setTerminateAfterRun(true)->editCommand('help')->setHandler(new CallbackHandler(function () {
    return 123;
}))->end();
$application = new ConsoleApplication($config);
$application->run();
// Should not be executed
exit(234);