-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11ba5f1
commit d48bd8d
Showing
4 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,18 +16,29 @@ protected function setUp(): void | |
'components' => [ | ||
'mailer' => [ | ||
'class' => 'boundstate\mailgun\Mailer', | ||
'key' => 'key-example', | ||
'domain' => 'mg.example.com', | ||
'key' => '801b0ee9ba59f340019da1c62a9f31df-816b23ef-3007ca87', | ||
'domain' => 'sandbox475d21b1d2084dd5af26f3612111b476.mailgun.org', | ||
], | ||
] | ||
]); | ||
} | ||
|
||
public function testHtmlMessage(): void | ||
public function testCompose(): void | ||
{ | ||
$message = Yii::$app->mailer->compose('example', ['name' => 'John']); | ||
$html = $message->getMessageBuilder()->getMessage()['html']; | ||
|
||
$this->assertEquals($html, '<p>Hi John!</p>'); | ||
} | ||
|
||
public function testSend(): void | ||
{ | ||
$message = Yii::$app->mailer->compose('example', ['name' => 'John']) | ||
->setTo('[email protected]') | ||
->setFrom('[email protected]') | ||
->setSubject('Test') | ||
->setTestMode(true); | ||
|
||
$this->assertTrue($message->send()); | ||
} | ||
} |