@@ -112,10 +112,11 @@ public function testDelayedMessageWithRealTiming(): void
112112
113113 public function testMultipleDelayedJobsWithDifferentDelays (): void
114114 {
115- // Push jobs with different delays
116- $ result1 = $ this ->handler ->setDelay (1 )->push ($ this ->queue , 'success ' , ['order ' => 'first ' , 'delay ' => 1 ]);
117- $ result2 = $ this ->handler ->setDelay (3 )->push ($ this ->queue , 'success ' , ['order ' => 'second ' , 'delay ' => 3 ]);
118- $ result3 = $ this ->handler ->push ($ this ->queue , 'success ' , ['order ' => 'immediate ' , 'delay ' => 0 ]);
115+ // Push the immediate job first so slow test setup cannot allow a
116+ // delayed job to reach the main queue ahead of it.
117+ $ result1 = $ this ->handler ->push ($ this ->queue , 'success ' , ['order ' => 'immediate ' , 'delay ' => 0 ]);
118+ $ result2 = $ this ->handler ->setDelay (1 )->push ($ this ->queue , 'success ' , ['order ' => 'first ' , 'delay ' => 1 ]);
119+ $ result3 = $ this ->handler ->setDelay (3 )->push ($ this ->queue , 'success ' , ['order ' => 'second ' , 'delay ' => 3 ]);
119120
120121 $ this ->assertTrue ($ result1 ->getStatus ());
121122 $ this ->assertTrue ($ result2 ->getStatus ());
@@ -134,10 +135,6 @@ public function testMultipleDelayedJobsWithDifferentDelays(): void
134135 $ this ->assertSame ('first ' , $ job ->payload ['data ' ]['order ' ]);
135136 $ this ->handler ->done ($ job );
136137
137- // Should not get second job yet
138- $ job = $ this ->handler ->pop ($ this ->queue , ['default ' ]);
139- $ this ->assertNull ($ job );
140-
141138 // Wait another 2 seconds - should get second delayed job
142139 sleep (2 );
143140 $ job = $ this ->handler ->pop ($ this ->queue , ['default ' ]);
0 commit comments