/** * Tests sending a mail to two recipients. * * @covers ::execute */ public function testSendMailToTwoRecipients() { $to = ['*****@*****.**', '*****@*****.**']; $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->logger->notice(Argument::any(), Argument::any())->shouldBeCalledTimes(1); $this->action->execute(); }
/** * Tests sending a mail to two recipients. * * @covers ::execute */ public function testSendMailToTwoRecipients() { $to = ['*****@*****.**', '*****@*****.**']; $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->logger->log(LogLevel::NOTICE, SafeMarkup::format('Successfully sent email to %to', ['%to' => implode(', ', $to)]))->shouldBeCalledTimes(1); $this->action->execute(); }