/**
  * @dataProvider provideOptions
  */
 public function testExecute($queue, $options)
 {
     $expectedOptions = array_merge(['max-messages' => null, 'stop-when-empty' => false, 'max-runtime' => null], $options);
     $tmp = [];
     foreach ($options as $key => $value) {
         $tmp['--' . $key] = $value;
     }
     $options = $tmp;
     self::bootKernel();
     static::$kernel->getContainer()->set('abc.job.consumer', $this->consumer);
     $application = new Application(self::$kernel);
     $application->add(new ConsumerCommand($this->consumer));
     $this->consumer->expects($this->once())->method('consume')->with($queue, $expectedOptions);
     $command = $application->find('abc:job:consume');
     $options['queue'] = $queue;
     $options['command'] = $command->getName();
     $commandTester = new CommandTester($command);
     $commandTester->execute($options);
     // the output of the command in the console
     // $output = $commandTester->getDisplay();
     // $this->assertContains('Username: Wouter', $output);
 }
Exemplo n.º 2
0
 /**
  * {@inheritDoc}
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->consumer->consume($input->getArgument('queue'), ['max-runtime' => $input->getOption('max-runtime'), 'max-messages' => $input->getOption('max-messages'), 'stop-when-empty' => $input->getOption('stop-when-empty')]);
 }