saulsolorzano's avatar

Email not being dispatched from job in test

Hi!

I'm using laravel 8.5 and laravel Sail. I have the following code

Bus::fake();
Mail::fake();
TheProductDoesNotExists::dispatch($this->channel, $document['product'], $document['name']);
Bus::assertDispatched(TheProductDoesNotExists::class);
Mail::assertSent(ProductMissing::class);

I get

  The expected [App\Mail\ProductMissing] mailable was not sent.
  Failed asserting that false is true.

This is the Job handle method

$alertTo = '[email protected]';
	Mail::to($alertTo)->send(
			new ProductMissing($this->product, $this->orderName)
		);

And nothing. Any help would be really appreciated! Thanks

0 likes
1 reply

Please or to participate in this conversation.