1414 * @since 0.1.0
1515 * @license https://opensource.org/licenses/MIT MIT License
1616 */
17+
1718namespace Cake \Queue \Test \TestCase \Command ;
1819
1920use Cake \Console \TestSuite \ConsoleIntegrationTestTrait ;
2223use Cake \Queue \QueueManager ;
2324use Cake \Queue \Test \test_app \src \Job \LogToDebugWithServiceJob ;
2425use Cake \Queue \Test \test_app \src \Queue \TestCustomProcessor ;
25- use Cake \Queue \Test \TestCase \DebugLogTrait ;
26+ use Cake \Queue \Test \TestCase \QueueTestTrait ;
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 ;
4043
4144 /**
4245 * Test that command description prints out
@@ -49,9 +52,8 @@ public function testDescriptionOutput()
4952
5053 /**
5154 * Test that queue will run for one second
52- *
53- * @runInSeparateProcess
5455 */
56+ #[RunInSeparateProcess]
5557 public function testQueueProcessesStart ()
5658 {
5759 Configure::write ('Queue ' , [
@@ -66,9 +68,8 @@ public function testQueueProcessesStart()
6668
6769 /**
6870 * Test that queue will run for one second with valid listener
69- *
70- * @runInSeparateProcess
7171 */
72+ #[RunInSeparateProcess]
7273 public function testQueueProcessesWithListener ()
7374 {
7475 Configure::write ('Queue ' , [
@@ -84,9 +85,8 @@ public function testQueueProcessesWithListener()
8485
8586 /**
8687 * Test that queue will abort when the passed config is not present in the app configuration.
87- *
88- * @runInSeparateProcess
8988 */
89+ #[RunInSeparateProcess]
9090 public function testQueueWillAbortWithMissingConfig ()
9191 {
9292 Configure::write ('Queue ' , [
@@ -103,9 +103,8 @@ public function testQueueWillAbortWithMissingConfig()
103103
104104 /**
105105 * Test that queue will abort with invalid listener
106- *
107- * @runInSeparateProcess
108106 */
107+ #[RunInSeparateProcess]
109108 public function testQueueProcessesWithInvalidListener ()
110109 {
111110 Configure::write ('Queue ' , [
@@ -122,9 +121,8 @@ public function testQueueProcessesWithInvalidListener()
122121
123122 /**
124123 * Test that queue will write to specified logger option
125- *
126- * @runInSeparateProcess
127124 */
125+ #[RunInSeparateProcess]
128126 public function testQueueProcessesWithLogger ()
129127 {
130128 Configure::write ('Queue ' , [
@@ -157,10 +155,9 @@ public static function dataProviderCallableTypes(): array
157155
158156 /**
159157 * Start up the worker queue, push a job, and see that it processes
160- *
161- * @dataProvider dataProviderCallableTypes
162- * @runInSeparateProcess
163158 */
159+ #[RunInSeparateProcess]
160+ #[DataProvider('dataProviderCallableTypes ' )]
164161 public function testQueueProcessesJob ($ callable )
165162 {
166163 $ config = [
@@ -186,9 +183,8 @@ public function testQueueProcessesJob($callable)
186183
187184 /**
188185 * Set the processor name, Start up the worker queue, push a job, and see that it processes
189- *
190- * @runInSeparateProcess
191186 */
187+ #[RunInSeparateProcess]
192188 public function testQueueProcessesJobWithProcessor ()
193189 {
194190 $ config = [
@@ -213,9 +209,8 @@ public function testQueueProcessesJobWithProcessor()
213209
214210 /**
215211 * Test non-default queue name
216- *
217- * @runInSeparateProcess
218212 */
213+ #[RunInSeparateProcess]
219214 public function testQueueProcessesJobWithOtherQueue ()
220215 {
221216 $ config = [
@@ -241,9 +236,8 @@ public function testQueueProcessesJobWithOtherQueue()
241236
242237 /**
243238 * Test max-attempts option
244- *
245- * @runInSeparateProcess
246239 */
240+ #[RunInSeparateProcess]
247241 public function testQueueProcessesJobWithMaxAttempts ()
248242 {
249243 $ config = [
@@ -269,9 +263,8 @@ public function testQueueProcessesJobWithMaxAttempts()
269263
270264 /**
271265 * Test DI service injection works in tasks
272- *
273- * @runInSeparateProcess
274266 */
267+ #[RunInSeparateProcess]
275268 public function testQueueProcessesJobWithDIService ()
276269 {
277270 $ this ->skipIf (version_compare (Configure::version (), '4.2 ' , '< ' ), 'DI Container is only available since CakePHP 4.2 ' );
@@ -297,9 +290,8 @@ public function testQueueProcessesJobWithDIService()
297290
298291 /**
299292 * Test that queue will process when a unique cache is configured.
300- *
301- * @runInSeparateProcess
302293 */
294+ #[RunInSeparateProcess]
303295 public function testQueueProcessesWithUniqueCacheConfigured ()
304296 {
305297 $ config = [
@@ -324,9 +316,8 @@ public function testQueueProcessesWithUniqueCacheConfigured()
324316
325317 /**
326318 * Test that queue uses default processor when no processor is specified.
327- *
328- * @runInSeparateProcess
329319 */
320+ #[RunInSeparateProcess]
330321 public function testQueueUsesDefaultProcessor ()
331322 {
332323 $ config = [
@@ -352,9 +343,8 @@ public function testQueueUsesDefaultProcessor()
352343
353344 /**
354345 * Test that queue uses custom processor when specified in configuration.
355- *
356- * @runInSeparateProcess
357346 */
347+ #[RunInSeparateProcess]
358348 public function testQueueUsesCustomProcessor ()
359349 {
360350 $ config = [
@@ -383,9 +373,8 @@ public function testQueueUsesCustomProcessor()
383373
384374 /**
385375 * Test that queue aborts when custom processor class does not exist.
386- *
387- * @runInSeparateProcess
388376 */
377+ #[RunInSeparateProcess]
389378 public function testQueueAbortsWithNonExistentProcessor ()
390379 {
391380 $ config = [
@@ -403,9 +392,8 @@ public function testQueueAbortsWithNonExistentProcessor()
403392
404393 /**
405394 * Test that queue aborts when custom processor does not implement Interop\Queue\Processor.
406- *
407- * @runInSeparateProcess
408395 */
396+ #[RunInSeparateProcess]
409397 public function testQueueAbortsWithInvalidProcessor ()
410398 {
411399 $ config = [
@@ -423,9 +411,8 @@ public function testQueueAbortsWithInvalidProcessor()
423411
424412 /**
425413 * Test that custom processor works with listener configuration.
426- *
427- * @runInSeparateProcess
428414 */
415+ #[RunInSeparateProcess]
429416 public function testCustomProcessorWithListener ()
430417 {
431418 $ config = [
0 commit comments