當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Twig_Environment::send方法代碼示例

本文整理匯總了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.');
 }
開發者ID:sgomez,項目名稱:SystemMailBundle,代碼行數:33,代碼來源:SwiftMailerTest.php


注:本文中的Twig_Environment::send方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。