I'm trying to test that a job is batching the correct number of another job like so
Bus::fake();
...
(new App\Jobs\ProcessChunkOfProducts($this->productsAsChunk()))->handle();
Bus::assertBatched( function (PendingBatch $batch) {
return $batch->jobs->count() === 49;
});
It passes most the time, but occasionally fails. Is it possible that I've created some sort of race condition where the jobs aren't batched before the assertion is made?