/** * {@inheritdoc} */ public function runNextJob(string $connectionName, string $queue = null, int $delay = 0, int $sleep = 3, int $maxTries = 0) { try { $connection = $this->manager->connection($connectionName); $job = $this->getNextJob($connection, $queue); if ($job !== null) { return $this->process($connectionName, $job, $maxTries, $delay); } } catch (Throwable $exception) { if ($this->exceptions) { $this->exceptions->report($this->getErrorException($exception)); } } $this->sleep($sleep); }
public function testConnection() { $config = $this->mock(ConfigContract::class); $config->shouldReceive('get')->once()->with('queue.connections', [])->andReturn([]); $manager = new QueueManager($config, $this->mock(ContainerInteropInterface::class), $this->mock(EncrypterContract::class)); $manager->extend('testqueue', function ($config) { return new TestQueue(); }); $connection = $manager->connection('testqueue'); $this->assertInstanceOf(ContainerInteropInterface::class, $connection->getContainer()); $this->assertInstanceOf(EncrypterContract::class, $connection->getEncrypter()); }