How would you test for a Bus::chain()? #326
-
|
Hi friends, Based on the documentation example, I'm trying to test if my actions were properly dispatched on the bus. use Illuminate\Support\Facades\Bus;
Bus::chain([
CreateNewTeamReport::makeJob($team),
OptimizeTeamReport::makeJob($team),
SendTeamReportEmail::makeJob($team),
])->dispatch();I've tried something like this, but it doesn't seem to be working properly. use Illuminate\Support\Facades\Bus;
Bus::assertChained([
CreateNewTeamReport::class,
OptimizeTeamReport::class,
SendTeamReportEmail::class
]);Do you have any ideas or hints? |
Beta Was this translation helpful? Give feedback.
Answered by
GregoireGaonach
Aug 25, 2025
Replies: 1 comment
-
|
Answering my own question, the following should work: Bus::assertChained([
fn(JobDecorator $job) => $job->getAction() instanceof CreateNewTeamReport,
fn(JobDecorator $job) => $job->getAction() instanceof OptimizeTeamReport,
fn(JobDecorator $job) => $job->getAction() instanceof SendTeamReportEmail,
]); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
GregoireGaonach
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Answering my own question, the following should work: