Closed splatEric closed 8 years ago
When using a Mailable that manages it's recipient directly, the Mail::assertSent(Mailable::class) method does not detect that the Mailable was sent.
class MyMailable extends Mailable { ... public function build() { return $this->view('views.email.mymailable') ->to($this->user->email); } ... public function testMailableFailing() { Mail::fake(); $user = factory(App\User::class, 1)->make(); $mailable = new MyMailable($user); Mail::send($mailable); Mail::assertSent(MyMailable::class); // fails } public function testMailablePasses() { Mail::fake(); $user = factory(App\User::class, 1)->make(); $mailable = new MyMailable($user); Mail::to($user)->send($mailable); Mail::assertSent(MyMailable::class); // passes }
PR submitted with a fix: https://github.com/laravel/framework/pull/16248
Description:
When using a Mailable that manages it's recipient directly, the Mail::assertSent(Mailable::class) method does not detect that the Mailable was sent.
Steps To Reproduce: