Skip to content

Commit 4f2f1d9

Browse files
committed
compatible with laravel low version
1 parent 565a625 commit 4f2f1d9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Bus.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,21 @@ public static function assertPendingBatched(callable $callback)
2020
$busFake = app(Dispatcher::class);
2121

2222
PHPUnit::assertTrue(
23-
collect($busFake->dispatchedBatches())
23+
collect(self::getDispatchedBatches())
2424
->filter(fn ($batch) => $callback(new FluentPendingBatch($busFake, $batch->jobs)))
2525
->isNotEmpty(),
2626
"The expected batch was not dispatched."
2727
);
2828
}
29+
30+
/**
31+
* Get all the batches that have been dispatched.
32+
*
33+
* @return array<\Illuminate\Support\Testing\Fakes\PendingBatchFake>
34+
*/
35+
private static function getDispatchedBatches()
36+
{
37+
/** @phpstan-ignore variable.undefined */
38+
return (fn () => $this->batches)->bindTo(app(Dispatcher::class), BusFake::class)();
39+
}
2940
}

0 commit comments

Comments
 (0)