File tree 2 files changed +21
-5
lines changed
2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 13
13
use Illuminate \Support \Str ;
14
14
use Illuminate \Validation \ValidationException ;
15
15
use Safe \Exceptions \JsonException ;
16
- use stdClass ;
17
16
use UnexpectedValueException ;
18
17
use function Safe \json_decode ;
19
18
@@ -98,11 +97,8 @@ private function captureTask($task): array
98
97
99
98
private function loadQueueConnectionConfiguration (array $ task ): void
100
99
{
101
- /**
102
- * @var stdClass $command
103
- */
104
100
$ command = self ::getCommandProperties ($ task ['data ' ]['command ' ]);
105
- $ connection = $ command-> connection ?? config ('queue.default ' );
101
+ $ connection = $ command[ ' connection ' ] ?? config ('queue.default ' );
106
102
$ baseConfig = config ('queue.connections. ' . $ connection );
107
103
$ config = (new CloudTasksConnector ())->connect ($ baseConfig )->config ;
108
104
Original file line number Diff line number Diff line change @@ -222,6 +222,26 @@ public function it_can_run_a_task()
222
222
Log::assertLogged ('SimpleJob:success ' );
223
223
}
224
224
225
+ /**
226
+ * @test
227
+ */
228
+ public function it_can_run_a_task_using_the_task_connection ()
229
+ {
230
+ // Arrange
231
+ OpenIdVerificator::fake ();
232
+ Log::swap (new LogFake ());
233
+ Event::fake ([JobProcessing::class, JobProcessed::class]);
234
+ $ this ->app ['config ' ]->set ('queue.default ' , 'non-existing-connection ' );
235
+
236
+ // Act
237
+ $ job = new SimpleJob ();
238
+ $ job ->connection = 'my-cloudtasks-connection ' ;
239
+ $ this ->dispatch ($ job )->runWithoutExceptionHandler ();
240
+
241
+ // Assert
242
+ Log::assertLogged ('SimpleJob:success ' );
243
+ }
244
+
225
245
/**
226
246
* @test
227
247
*/
You can’t perform that action at this time.
0 commit comments