File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -602,6 +602,10 @@ public function setDefaultInitTask(TaskInterface|string $task): static
602
602
$ this ->initTaskFactory = new CloneTaskFactory ($ task );
603
603
}
604
604
605
+ foreach ($ this ->workers as $ worker ) {
606
+ $ worker ->setInitTaskFactoryIfNecessary ($ this ->initTaskFactory );
607
+ }
608
+
605
609
return $ this ;
606
610
}
607
611
Original file line number Diff line number Diff line change @@ -100,4 +100,20 @@ public function testInitTask(): void
100
100
}
101
101
$ this ->assertEquals (3 , $ counter );
102
102
}
103
+
104
+ public function testInitTaskAfterWorkerCreation (): void
105
+ {
106
+ $ this ->taskmaster = new Taskmaster ();
107
+ $ this ->taskmaster ->addWorkers ($ this ->createWorker (), 3 );
108
+ $ this ->taskmaster ->setDefaultInitTask (InitTask::class);
109
+
110
+ $ this ->addTasks (new InitValidateTask (), 3 );
111
+ $ counter = 0 ;
112
+ foreach ($ this ->taskmaster ->waitAndHandleTasks () as $ task ) {
113
+ $ this ->assertNull ($ task ->getError ());
114
+ $ this ->assertTrue ($ task ->getResult ());
115
+ $ counter ++;
116
+ }
117
+ $ this ->assertEquals (3 , $ counter );
118
+ }
103
119
}
You can’t perform that action at this time.
0 commit comments