-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4049 from thangnnmd/unitTest_MailMessageMailer_se…
…ndFormToUser MailMessageMailer::sendFormToUser
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,33 @@ public function testSendFormToAdmin() | |
*/ | ||
public function testSendFormToUser() | ||
{ | ||
$this->markTestIncomplete('このテストは未実装'); | ||
//準備 | ||
$data['message'] = 'message test'; | ||
$data['mailContent'] = 'content test'; | ||
$data['mailFields'] = 'fields test'; | ||
$mailContent = MailContentFactory::make([ | ||
'description' => 'description test', | ||
'sender_1' => 'sender_1', | ||
'sender_name' => 'name 111', | ||
'subject_user' => 'subject_user 111', | ||
'subject_admin' => 'subject_admin 111', | ||
'form_template' => 'default', | ||
'mail_template' => 'mail_default', | ||
'redirect_url' => '/', | ||
])->getEntity(); | ||
|
||
//テスト | ||
$this->MailMessageMailer->sendFormToUser($mailContent, '[email protected]', '[email protected]', $data, [], []); | ||
|
||
//戻り値を確認 | ||
$this->assertEquals(['[email protected]' => '[email protected]'], $this->MailMessageMailer->getReplyTo()); | ||
$this->assertEquals(['[email protected]' => '[email protected]'], $this->MailMessageMailer->getTo()); | ||
|
||
$vars = $this->MailMessageMailer->viewBuilder()->getVars(); | ||
$this->assertEquals('message test', $vars['message']); | ||
$this->assertEquals('content test', $vars['mailContent']); | ||
$this->assertEquals('fields test', $vars['mailFields']); | ||
$this->assertEquals('user', $vars['other']['mode']); | ||
} | ||
|
||
/** | ||
|