Hi!
I'm using laravel 8.5 and laravel Sail.
I'm trying to test a job but is not being dispatched, no matter what I do. Here's my code
Event::fake();
TheProductDoesNotExists::dispatch($this->channel, $document['product'], $document['name']);
Event::assertDispatched(TheProductDoesNotExists::class);
And I get
The expected [App\Jobs\TheProductDoesNotExists] event was not dispatched.
Failed asserting that false is true.
Inside the Job I even have a logger in the handle method
public function handle()
{
logger('from the job');
$alertTo = 'test@test';
Mail::to($alertTo)->send(
new ProductMissing($this->product, $this->orderName)
);
}
And nothing. Any help would be really appreciated! Thanks