public function testOtherConnectionCanBeResolved()
 {
     $manager = new QueueManager(array());
     $config = m::mock('StdClass');
     $connector = m::mock('StdClass');
     $queue = m::mock('StdClass');
     $config->shouldReceive('get')->once()->with('foo')->andReturn(array('driver' => 'bar'));
     $connector->shouldReceive('connect')->once()->with(array('driver' => 'bar'))->andReturn($queue);
     $manager->setConfig($config);
     $manager->addConnector('bar', function () use($connector) {
         return $connector;
     });
     $queue->shouldReceive('setInjector')->once();
     $this->assertTrue($queue === $manager->connection('foo'));
 }
 /**
  * Listen to the given queue.
  *
  * @param  string $connectionName
  * @param  string $queue
  * @param  int    $delay
  * @param  int    $memory
  * @param  int    $sleep
  * @param  int    $maxTries
  *
  * @return void
  */
 public function pop($connectionName, $queue = null, $delay = 0, $memory = 128, $sleep = 3, $maxTries = 0)
 {
     $connection = $this->manager->connection($connectionName);
     $job = $this->getNextJob($connection, $queue);
     if (!is_null($job)) {
         $this->process($this->manager->getName($connectionName), $job, $maxTries, $delay);
     } else {
         $this->sleep($sleep);
     }
 }