/** * {@inheritdoc} */ public function setUp() { parent::setUp(); if (!class_exists('Doctrine\\ORM\\EntityManager')) { $this->markTestSkipped('Doctrine not installed'); } $adapter = new Adapter\DoctrineAdapter(array()); $adapter->em = $this->em; $this->queue = new QueueService($this->container->get('logger'), $this->container->getParameter('jobqueue.config')); $this->queue->adapter = $adapter; $this->queue->attach($this->queueName . '1'); $application = new Application($this->kernel); $application->add(new QueueListenCommand()); $command = $application->find('jobqueue:listen'); $this->queue->setCommand($command); if ($this->verbose) { $this->queue->setOutput(new ConsoleOutput()); } }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); if (!class_exists('PhpAmqpLib\\Message\\AMQPMessage')) { $this->markTestSkipped('AMQP not installed'); } // Set default rabbitmq configuration $adapter = new Adapter\AmqpAdapter(['host' => 'localhost', 'port' => '5672', 'user' => 'guest', 'password' => 'guest']); $this->queue = new QueueService($this->container->get('logger'), $this->container->getParameter('jobqueue.config')); $this->queue->adapter = $adapter; $this->queue->attach($this->queueName . '1'); $application = new Application($this->kernel); $application->add(new QueueListenCommand()); $command = $application->find('jobqueue:listen'); $this->queue->setCommand($command); if ($this->verbose) { $this->queue->setOutput(new ConsoleOutput()); } $this->channel = $adapter->getChannel(); $this->connection = $adapter->getConnection(); }