File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public function add($jobs)
98
98
protected function ensureJobIsBatchable (object |array $ job ): void
99
99
{
100
100
foreach (Arr::wrap ($ job ) as $ job ) {
101
- if ($ job instanceof PendingBatch) {
101
+ if ($ job instanceof PendingBatch || $ job instanceof Closure ) {
102
102
return ;
103
103
}
104
104
Original file line number Diff line number Diff line change @@ -244,6 +244,17 @@ public function test_it_throws_an_exception_if_batched_job_contains_batch_with_n
244
244
)
245
245
);
246
246
}
247
+
248
+ public function test_it_can_batch_a_closure (): void
249
+ {
250
+ new PendingBatch (
251
+ new Container ,
252
+ new Collection ([
253
+ function () {}
254
+ ])
255
+ );
256
+ $ this ->expectNotToPerformAssertions ();
257
+ }
247
258
}
248
259
249
260
class BatchableJob
You can’t perform that action at this time.
0 commit comments