/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $action = $input->getArgument('action'); $payload = $input->getArgument('payload'); $output->writeln(sprintf('Performing action <info>%s</info> with payload <info>%s</info>', $action, json_encode($payload, JSON_UNESCAPED_SLASHES))); $timeStart = microtime(true) * 1000; $memStart = memory_get_usage(true); $result = $this->manager->execute($action, $payload); $duration = microtime(true) * 1000 - $timeStart; $usage = memory_get_usage(true) - $memStart; $output->writeln(sprintf('Completed in <comment>%dms</comment> using <comment>%s</comment> with result: <info>%s</info>', $duration, $this->formatBytes($usage), json_encode($result, JSON_UNESCAPED_SLASHES))); $this->manager->getDispatcher()->dispatch(WorkerEvents::FLUSH); }
public function testExecuteInvalidPayload() { $executor = new ObjectExecutor(); $action = $executor->getName(); $this->manager->addExecutor($executor); $this->assertFalse($this->manager->execute($action, [])); }