Skip to content

Commit 6537997

Browse files
committed
Add a test to ensure plain text email works
1 parent 9f21a97 commit 6537997

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/TestMail.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@
66

77
class TestMail extends Mailable
88
{
9+
protected $plainText;
10+
11+
public function __construct($plainText = false)
12+
{
13+
$this->plainText = $plainText;
14+
}
15+
916
public function build()
1017
{
11-
return $this->subject("Test from HELO")
12-
->markdown('helo::email');
18+
$this->subject("Test from HELO");
19+
20+
return $this->plainText ? $this->text('helo::email') : $this->markdown('helo::email');
1321
}
1422
}

tests/HeloTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ public function test_the_mail_commands_sends_the_mailable()
2929
Mail::assertSent(TestMail::class);
3030
}
3131

32+
/** @test */
33+
public function test_plain_text_mails_work_correctly()
34+
{
35+
Mail::fake();
36+
37+
Mail::to('[email protected]')->send(new TestMail(true));
38+
39+
Mail::assertSent(TestMail::class);
40+
}
41+
3242
/** @test */
3343
public function test_the_correct_mailer_is_binded()
3444
{

0 commit comments

Comments
 (0)