Skip to content

Commit

Permalink
Add tests for the setAdditionalData method
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Oct 3, 2024
1 parent c8c469a commit 7629528
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/TemplateMailableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,20 @@ public function it_throws_an_exception_if_no_mail_template_exists_for_mailable()

(new BasicMail('John'))->render();
}

/** @test */
public function it_can_set_additional_data()
{
MailTemplate::create([
'mailable' => BasicMail::class,
'html_template' => 'Hello, {{ name }}. Your role is {{ role }}.',
]);

$mailable = new BasicMail('John');
$mailable->setAdditionalData(['role' => 'admin']);

$renderedMail = $mailable->render();

$this->assertEquals('Hello, John. Your role is admin.', $renderedMail);
}
}

0 comments on commit 7629528

Please sign in to comment.