Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MailMessageMailer::sendFormToUser #4049

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/bc-mail/src/Mailer/MailMessageMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public function sendFormToAdmin(
* @param array $options
* @checked
* @noTodo
* @unitTest
*/
public function sendFormToUser(
EntityInterface $mailContent,
Expand Down
28 changes: 27 additions & 1 deletion plugins/bc-mail/tests/TestCase/Mailer/MailMessageMailerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}

/**
Expand Down