@@ -144,7 +144,7 @@ public function it_posts_the_task_the_correct_queue()
144144            $ commandgetCommandProperties ($ decoded'data ' ]['command ' ]);
145145
146146            return  $ decoded'displayName ' ] === SimpleJob::class
147-                 && $ command'queue ' ] === null 
147+                 && ( $ command'queue ' ] ??  null )  === null 
148148                && $ queueName'projects/my-test-project/locations/europe-west6/queues/barbequeue ' ;
149149        });
150150
@@ -161,7 +161,7 @@ public function it_posts_the_task_the_correct_queue()
161161    /** 
162162     * @test 
163163     */ 
164-     public  function  it_can_dispatch_after_commit ()
164+     public  function  it_can_dispatch_after_commit_inline ()
165165    {
166166        if  (version_compare (app ()->version (), '8.0.0 ' , '< ' )) {
167167            $ this markTestSkipped ('Not supported by Laravel 7.x and below. ' );
@@ -181,4 +181,29 @@ public function it_can_dispatch_after_commit()
181181            return  $ eventjob  instanceof  SimpleJob;
182182        });
183183    }
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  $ eventjob  instanceof  SimpleJob;
207+         });
208+     }
184209}
0 commit comments