protected function setUp() { $config = DefaultApplicationConfig::create()->setDisplayName('The Application')->setVersion('1.2.3')->beginCommand('the-command')->end(); $this->application = new ConsoleApplication($config); $this->command = $this->application->getCommand('the-command'); $this->helpCommand = $this->application->getCommand('help'); $this->io = new BufferedIO(); $this->handler = new HelpXmlHandler(); }
protected function setUp() { $config = DefaultApplicationConfig::create()->beginCommand('the-command')->end(); $this->application = new ConsoleApplication($config); $this->command = $this->application->getCommand('the-command'); $this->helpCommand = $this->application->getCommand('help'); $this->io = new BufferedIO(); $this->handler = new HelpJsonHandler(); }
protected function setUp() { $config = DefaultApplicationConfig::create()->setName('the-app')->setDisplayName('The Application')->setVersion('1.2.3')->beginCommand('the-command')->end(); $this->manDir = __DIR__ . '/Fixtures/man'; $this->asciiDocDir = __DIR__ . '/Fixtures/ascii-doc'; $this->application = new ConsoleApplication($config); $this->command = $this->application->getCommand('the-command'); $this->helpCommand = $this->application->getCommand('help'); $this->io = new BufferedIO(); $this->executableFinder = $this->getMockBuilder('Symfony\\Component\\Process\\ExecutableFinder')->disableOriginalConstructor()->getMock(); $this->processLauncher = $this->getMockBuilder('Webmozart\\Console\\Process\\ProcessLauncher')->disableOriginalConstructor()->getMock(); $this->handler = new HelpHandler($this->executableFinder, $this->processLauncher); $this->handler->setManDir($this->manDir); $this->handler->setAsciiDocDir($this->asciiDocDir); }
<?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);