2222use Cake \Queue \QueueManager ;
2323use Cake \Queue \Test \test_app \src \Job \LogToDebugWithServiceJob ;
2424use Cake \Queue \Test \test_app \src \Queue \TestCustomProcessor ;
25- use Cake \Queue \Test \TestCase \DebugLogTrait ;
25+ use Cake \Queue \Test \TestCase \QueueTestTrait ;
26+ use Cake \TestSuite \LogTestTrait ;
2627use Cake \TestSuite \TestCase ;
28+ use PHPUnit \Framework \Attributes \DataProvider ;
29+ use PHPUnit \Framework \Attributes \RunInSeparateProcess ;
2730use TestApp \Job \LogToDebugJob ;
2831use TestApp \Job \RequeueJob ;
2932use TestApp \WelcomeMailerListener ;
3639class WorkerCommandTest extends TestCase
3740{
3841 use ConsoleIntegrationTestTrait;
39- use DebugLogTrait;
42+ use QueueTestTrait;
43+ use LogTestTrait;
4044
4145 /**
4246 * Test that command description prints out
@@ -49,9 +53,8 @@ public function testDescriptionOutput()
4953
5054 /**
5155 * Test that queue will run for one second
52- *
53- * @runInSeparateProcess
5456 */
57+ #[RunInSeparateProcess]
5558 public function testQueueProcessesStart ()
5659 {
5760 Configure::write ('Queue ' , [
@@ -66,9 +69,8 @@ public function testQueueProcessesStart()
6669
6770 /**
6871 * Test that queue will run for one second with valid listener
69- *
70- * @runInSeparateProcess
7172 */
73+ #[RunInSeparateProcess]
7274 public function testQueueProcessesWithListener ()
7375 {
7476 Configure::write ('Queue ' , [
@@ -84,9 +86,8 @@ public function testQueueProcessesWithListener()
8486
8587 /**
8688 * Test that queue will abort when the passed config is not present in the app configuration.
87- *
88- * @runInSeparateProcess
8989 */
90+ #[RunInSeparateProcess]
9091 public function testQueueWillAbortWithMissingConfig ()
9192 {
9293 Configure::write ('Queue ' , [
@@ -103,9 +104,8 @@ public function testQueueWillAbortWithMissingConfig()
103104
104105 /**
105106 * Test that queue will abort with invalid listener
106- *
107- * @runInSeparateProcess
108107 */
108+ #[RunInSeparateProcess]
109109 public function testQueueProcessesWithInvalidListener ()
110110 {
111111 Configure::write ('Queue ' , [
@@ -122,9 +122,8 @@ public function testQueueProcessesWithInvalidListener()
122122
123123 /**
124124 * Test that queue will write to specified logger option
125- *
126- * @runInSeparateProcess
127125 */
126+ #[RunInSeparateProcess]
128127 public function testQueueProcessesWithLogger ()
129128 {
130129 Configure::write ('Queue ' , [
@@ -157,10 +156,9 @@ public static function dataProviderCallableTypes(): array
157156
158157 /**
159158 * Start up the worker queue, push a job, and see that it processes
160- *
161- * @dataProvider dataProviderCallableTypes
162- * @runInSeparateProcess
163159 */
160+ #[RunInSeparateProcess]
161+ #[DataProvider('dataProviderCallableTypes ' )]
164162 public function testQueueProcessesJob ($ callable )
165163 {
166164 $ config = [
@@ -186,9 +184,8 @@ public function testQueueProcessesJob($callable)
186184
187185 /**
188186 * Set the processor name, Start up the worker queue, push a job, and see that it processes
189- *
190- * @runInSeparateProcess
191187 */
188+ #[RunInSeparateProcess]
192189 public function testQueueProcessesJobWithProcessor ()
193190 {
194191 $ config = [
@@ -213,9 +210,8 @@ public function testQueueProcessesJobWithProcessor()
213210
214211 /**
215212 * Test non-default queue name
216- *
217- * @runInSeparateProcess
218213 */
214+ #[RunInSeparateProcess]
219215 public function testQueueProcessesJobWithOtherQueue ()
220216 {
221217 $ config = [
@@ -241,9 +237,8 @@ public function testQueueProcessesJobWithOtherQueue()
241237
242238 /**
243239 * Test max-attempts option
244- *
245- * @runInSeparateProcess
246240 */
241+ #[RunInSeparateProcess]
247242 public function testQueueProcessesJobWithMaxAttempts ()
248243 {
249244 $ config = [
@@ -269,9 +264,8 @@ public function testQueueProcessesJobWithMaxAttempts()
269264
270265 /**
271266 * Test DI service injection works in tasks
272- *
273- * @runInSeparateProcess
274267 */
268+ #[RunInSeparateProcess]
275269 public function testQueueProcessesJobWithDIService ()
276270 {
277271 $ this ->skipIf (version_compare (Configure::version (), '4.2 ' , '< ' ), 'DI Container is only available since CakePHP 4.2 ' );
@@ -297,9 +291,8 @@ public function testQueueProcessesJobWithDIService()
297291
298292 /**
299293 * Test that queue will process when a unique cache is configured.
300- *
301- * @runInSeparateProcess
302294 */
295+ #[RunInSeparateProcess]
303296 public function testQueueProcessesWithUniqueCacheConfigured ()
304297 {
305298 $ config = [
@@ -324,9 +317,8 @@ public function testQueueProcessesWithUniqueCacheConfigured()
324317
325318 /**
326319 * Test that queue uses default processor when no processor is specified.
327- *
328- * @runInSeparateProcess
329320 */
321+ #[RunInSeparateProcess]
330322 public function testQueueUsesDefaultProcessor ()
331323 {
332324 $ config = [
@@ -352,9 +344,8 @@ public function testQueueUsesDefaultProcessor()
352344
353345 /**
354346 * Test that queue uses custom processor when specified in configuration.
355- *
356- * @runInSeparateProcess
357347 */
348+ #[RunInSeparateProcess]
358349 public function testQueueUsesCustomProcessor ()
359350 {
360351 $ config = [
@@ -383,9 +374,8 @@ public function testQueueUsesCustomProcessor()
383374
384375 /**
385376 * Test that queue aborts when custom processor class does not exist.
386- *
387- * @runInSeparateProcess
388377 */
378+ #[RunInSeparateProcess]
389379 public function testQueueAbortsWithNonExistentProcessor ()
390380 {
391381 $ config = [
@@ -403,9 +393,8 @@ public function testQueueAbortsWithNonExistentProcessor()
403393
404394 /**
405395 * Test that queue aborts when custom processor does not implement Interop\Queue\Processor.
406- *
407- * @runInSeparateProcess
408396 */
397+ #[RunInSeparateProcess]
409398 public function testQueueAbortsWithInvalidProcessor ()
410399 {
411400 $ config = [
@@ -423,9 +412,8 @@ public function testQueueAbortsWithInvalidProcessor()
423412
424413 /**
425414 * Test that custom processor works with listener configuration.
426- *
427- * @runInSeparateProcess
428415 */
416+ #[RunInSeparateProcess]
429417 public function testCustomProcessorWithListener ()
430418 {
431419 $ config = [
0 commit comments