public function testPeekMissingAction() { $executor = new ObjectExecutor(); $action = $executor->getName(); $this->manager->addExecutor($executor); $this->pheanstalk->expects($this->once())->method('peekReady')->with($action)->will($this->throwException(new ServerException(sprintf('Server reported %s', Response::RESPONSE_NOT_FOUND)))); $this->assertNull($this->manager->peek($action)); }
/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $actions = $input->getArgument('action'); if (empty($actions)) { $actions = array_keys($this->manager->getExecutors()); } $states = $input->getOption('state'); foreach ($actions as $action) { $output->writeln(sprintf('Action: <info>%s</info>', $action)); $table = new Table($output); $table->setHeaders(['state', 'id', 'data']); foreach ($states as $state) { $job = $this->manager->peek($action, $state); if (is_null($job)) { $table->addRow([$state, '-', '-']); } else { $table->addRow([$state, $job->getId(), $job->getData()]); } } $table->render(); $output->writeln(''); } }