本文整理匯總了PHP中Twig_Environment::send方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twig_Environment::send方法的具體用法?PHP Twig_Environment::send怎麽用?PHP Twig_Environment::send使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Twig_Environment
的用法示例。
在下文中一共展示了Twig_Environment::send方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testSendingMailWorks
public function testSendingMailWorks()
{
$message = new ParsedMessage();
$message->setFrom('from@addr.com', 'from');
$message->setReplyTo('reply@addr.com');
$message->addTo('to1@addr.com', 'to1');
$message->addTo('to2@addr.com', 'to2');
$message->addCc('cc1@addr.com', 'cc1');
$message->addCc('cc2@addr.com', 'cc2');
$message->addBcc('bcc1@addr.com', 'bcc1');
$message->addBcc('bcc2@addr.com', 'bcc2');
$message->setSubject('_subject');
$message->setMessageText('_text_message');
$message->setMessageHtml('_html_message');
$this->mailer->send(Argument::type(\Swift_Message::class))->shouldBeCalled();
$closureExceuted = false;
$this->fixture->send($message, function (\Swift_Message $message) use(&$closureExceuted) {
// from
$this->assertEquals(['from@addr.com' => 'from'], $message->getFrom());
// reply-to
$this->assertEquals(['reply@addr.com' => null], $message->getReplyTo());
// to
$this->assertEquals(['to1@addr.com' => 'to1', 'to2@addr.com' => 'to2'], $message->getTo());
// cc
$this->assertEquals(['cc1@addr.com' => 'cc1', 'cc2@addr.com' => 'cc2'], $message->getCc());
// bcc
$this->assertEquals(['bcc1@addr.com' => 'bcc1', 'bcc2@addr.com' => 'bcc2'], $message->getBcc());
$this->assertEquals('_subject', $message->getSubject());
$this->assertEquals('_text_message', $message->getBody());
$closureExceuted = true;
});
$this->assertTrue($closureExceuted, 'closure was not executed.');
}