public function SystemSendEmailTest::testSendMailToTwoRecipients in Rules 8.3
Tests sending a mail to two recipients.
@covers ::execute
File
- tests/
src/ Unit/ Integration/ RulesAction/ SystemSendEmailTest.php, line 99
Class
- SystemSendEmailTest
- @coversDefaultClass \Drupal\rules\Plugin\RulesAction\SystemSendEmail @group RulesAction
Namespace
Drupal\Tests\rules\Unit\Integration\RulesActionCode
public function testSendMailToTwoRecipients() {
$to = [
'mail@example.com',
'mail2@example.com',
];
$this->action
->setContextValue('to', $to)
->setContextValue('subject', 'subject')
->setContextValue('message', 'hello');
$params = [
'subject' => 'subject',
'message' => 'hello',
];
$this->mailManager
->mail('rules', 'rules_action_mail_' . $this->action
->getPluginId(), implode(', ', $to), LanguageInterface::LANGCODE_SITE_DEFAULT, $params, NULL)
->willReturn([
'result' => TRUE,
])
->shouldBeCalledTimes(1);
$this->action
->execute();
$this->logger
->notice('Successfully sent email to %recipient', [
'%recipient' => implode(', ', $to),
])
->shouldHaveBeenCalled();
}