/** * @test */ public function shouldPrintHello() { $this->expectOutputString('hello'); $command = new HelloCommand(); $invoker = new Invoker(); $invoker->setCommand($command); $invoker->run(); }
protected function execute(InputInterface $input, OutputInterface $output) { $invoker = new Invoker(); $worker = $this->container['worker'](); $output->writeln('<info>Instance Hash</info>: ' . $worker->getInstanceHash()); $worker->run(function (CommandInterface $command) use($invoker, $output) { $now = (new \DateTime())->format('d/m/Y H:i:s'); $output->write("<comment>{$now}</comment>: "); $invoker->setCommand($command); $invoker->run(); }); }