@@ -144,7 +144,7 @@ public function it_posts_the_task_the_correct_queue()
144
144
$ command = TaskHandler::getCommandProperties ($ decoded ['data ' ]['command ' ]);
145
145
146
146
return $ decoded ['displayName ' ] === SimpleJob::class
147
- && $ command ['queue ' ] === null
147
+ && ( $ command ['queue ' ] ?? null ) === null
148
148
&& $ queueName === 'projects/my-test-project/locations/europe-west6/queues/barbequeue ' ;
149
149
});
150
150
@@ -161,7 +161,7 @@ public function it_posts_the_task_the_correct_queue()
161
161
/**
162
162
* @test
163
163
*/
164
- public function it_can_dispatch_after_commit ()
164
+ public function it_can_dispatch_after_commit_inline ()
165
165
{
166
166
if (version_compare (app ()->version (), '8.0.0 ' , '< ' )) {
167
167
$ this ->markTestSkipped ('Not supported by Laravel 7.x and below. ' );
@@ -181,4 +181,29 @@ public function it_can_dispatch_after_commit()
181
181
return $ event ->job instanceof SimpleJob;
182
182
});
183
183
}
184
+
185
+ /**
186
+ * @test
187
+ */
188
+ public function it_can_dispatch_after_commit_through_config ()
189
+ {
190
+ if (version_compare (app ()->version (), '8.0.0 ' , '< ' )) {
191
+ $ this ->markTestSkipped ('Not supported by Laravel 7.x and below. ' );
192
+ }
193
+
194
+ // Arrange
195
+ CloudTasksApi::fake ();
196
+ Event::fake ();
197
+ $ this ->setConfigValue ('after_commit ' , true );
198
+
199
+ // Act & Assert
200
+ Event::assertNotDispatched (JobQueued::class);
201
+ DB ::beginTransaction ();
202
+ SimpleJob::dispatch ();
203
+ Event::assertNotDispatched (JobQueued::class);
204
+ DB ::commit ();
205
+ Event::assertDispatched (JobQueued::class, function (JobQueued $ event ) {
206
+ return $ event ->job instanceof SimpleJob;
207
+ });
208
+ }
184
209
}
0 commit comments