Add more tests

And ability to define how many messages can be hanle by the redis worker before stopping (usefull for tests)
This commit is contained in:
Jeremy Benoist
2016-09-11 20:24:04 +02:00
parent 7d862f83b9
commit 015c7a8359
9 changed files with 133 additions and 3 deletions

View File

@ -5,6 +5,7 @@ namespace Wallabag\ImportBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Config\Definition\Exception\Exception;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Simpleue\Worker\QueueWorker;
@ -17,6 +18,7 @@ class RedisWorkerCommand extends ContainerAwareCommand
->setName('wallabag:import:redis-worker')
->setDescription('Launch Redis worker')
->addArgument('serviceName', InputArgument::REQUIRED, 'Service to use: wallabag_v1, wallabag_v2, pocket or readability')
->addOption('maxIterations', '', InputOption::VALUE_OPTIONAL, 'Number of iterations before stoping', false)
;
}
@ -33,7 +35,8 @@ class RedisWorkerCommand extends ContainerAwareCommand
$worker = new QueueWorker(
$this->getContainer()->get('wallabag_import.queue.redis.'.$serviceName),
$this->getContainer()->get('wallabag_import.consumer.redis.'.$serviceName)
$this->getContainer()->get('wallabag_import.consumer.redis.'.$serviceName),
$input->getOption('maxIterations')
);
$worker->start();