Level 41
Maybe the condition within the closure is not met. Does the test case pass if it is simply like this:
Bus::assertDispatched(ExampleJob::class);
1 like
I am trying to test that a job was dispatched from running a command. But, the test is failing with The excepted job was not dispatched exception. Below is what my test looks like.
public function it_dispatches_a_job()
{
Bus::fake();
$records = $this->user->records;
$this->artisan('run-job');
Bus::assertDispatched(function (ExampleJob $job) use ($records) {
return $job->total === $records->sum('total');
});
}
Maybe the condition within the closure is not met. Does the test case pass if it is simply like this:
Bus::assertDispatched(ExampleJob::class);
Please or to participate in this conversation.