Skip to content

Commit 62a03c4

Browse files
committed
Add support for custom connection name and update tests to test this scenario
1 parent acc5e91 commit 62a03c4

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/TaskHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function handle($task = null)
2929
$task = $task ?: $this->captureTask();
3030

3131
$command = unserialize($task['data']['command']);
32-
$connection = $command->connection ?? 'cloudtasks';
32+
$connection = $command->connection ?? config('queue.default');
3333

3434
$this->authorizeRequest($connection);
3535

tests/TaskHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function after_max_attempts_it_will_log_to_failed_table()
165165
}
166166

167167
$this->assertDatabaseHas('failed_jobs', [
168-
'connection' => 'cloudtasks',
168+
'connection' => 'my-cloudtasks-connection',
169169
'queue' => 'my-queue',
170170
'payload' => rtrim($this->failingJobPayload()),
171171
]);

tests/TestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ protected function getEnvironmentSetUp($app)
5959
}
6060

6161
$app['config']->set('cache.default', 'file');
62-
$app['config']->set('queue.default', 'cloudtasks');
63-
$app['config']->set('queue.connections.cloudtasks', [
62+
$app['config']->set('queue.default', 'my-cloudtasks-connection');
63+
$app['config']->set('queue.connections.my-cloudtasks-connection', [
6464
'driver' => 'cloudtasks',
6565
'queue' => 'test-queue',
6666
'project' => 'test-project',
@@ -72,6 +72,6 @@ protected function getEnvironmentSetUp($app)
7272

7373
protected function setConfigValue($key, $value)
7474
{
75-
$this->app['config']->set('queue.connections.cloudtasks.' . $key, $value);
75+
$this->app['config']->set('queue.connections.my-cloudtasks-connection.' . $key, $value);
7676
}
7777
}

0 commit comments

Comments
 (0)