handle() public méthode

Executes the command for the given parsed arguments.
public handle ( Args $args, IO $io ) : integer
$args Webmozart\Console\Api\Args\Args The parsed console arguments.
$io Webmozart\Console\Api\IO\IO The I/O.
Résultat integer Returns 0 on success and any other integer on error.
Exemple #1
0
 public function testHandleDispatchesEvent()
 {
     $args = new Args(new ArgsFormat());
     $io = $this->getMockBuilder('Webmozart\\Console\\Api\\IO\\IO')->disableOriginalConstructor()->getMock();
     $handler = $this->getMock('stdClass', array('handle'));
     $this->application->getConfig()->addEventListener(ConsoleEvents::PRE_HANDLE, function (PreHandleEvent $event) {
         $event->setHandled(true);
         $event->setStatusCode(123);
     });
     $config = new CommandConfig('command');
     $config->setHandler($handler);
     $command = new Command($config, $this->application);
     $handler->expects($this->never())->method('handle');
     $this->assertSame(123, $command->handle($args, $io));
 }