当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectProphecy::getTo方法代码示例

本文整理汇总了PHP中Prophecy\Prophecy\ObjectProphecy::getTo方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectProphecy::getTo方法的具体用法?PHP ObjectProphecy::getTo怎么用?PHP ObjectProphecy::getTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Prophecy\Prophecy\ObjectProphecy的用法示例。


在下文中一共展示了ObjectProphecy::getTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSendMail

 public function testSendMail()
 {
     $this->event->getType()->shouldBeCalledTimes(1)->willReturn('email_type1');
     $this->event->getTo()->shouldBeCalledTimes(1)->willReturn('to@email.com');
     $this->event->getParams()->shouldBeCalledTimes(1)->willReturn([]);
     $this->mailResolver->sendMail('email_type1', 'to@email.com', [])->shouldBeCalledTimes(1);
     $this->class->sendMail($this->event->reveal());
 }
开发者ID:pitechplus,项目名称:mailer-bundle,代码行数:8,代码来源:EventEmailSubscriberTest.php

示例2: testSendMail

 /**
  * @dataProvider getDataForTestSendMail
  *
  * @param null|string $to
  * @param null|string $from
  * @param null|string $subject
  * @param null|string $body
  * @param array       $cc
  * @param null|string $attachmentName
  * @param null|string $attachmentPath
  */
 public function testSendMail($to, $from, $subject, $body, $cc, $attachmentName, $attachmentPath)
 {
     $this->message->getTo()->shouldBeCalledTimes(2)->willReturn($to);
     $this->message->getFrom()->shouldBeCalledTimes(2)->willReturn($from);
     $this->message->getSubject()->shouldBeCalledTimes(2)->willReturn($subject);
     $this->message->getBody()->shouldBeCalledTimes(1)->willReturn($body);
     $getCcCalls = count($cc) > 0 ? 2 : 1;
     $this->message->getCc()->shouldBeCalledTimes($getCcCalls)->willReturn($cc);
     $getAttachmentPathCalls = $attachmentPath ? $attachmentName ? 2 : 1 : 1;
     $this->message->getAttachmentPath()->shouldBeCalledTimes($getAttachmentPathCalls)->willReturn($attachmentPath);
     $getAttachmentNameCalls = $attachmentPath ? $attachmentName ? 2 : 1 : 0;
     $this->message->getAttachmentName()->shouldBeCalledTimes($getAttachmentNameCalls)->willReturn($attachmentName);
     $this->logger->info(sprintf(SwiftMailer::INFO_LOG_MESSAGE, $from, $to, $subject), ['SwiftMailer'])->shouldBeCalledTimes(1);
     $this->class->sendMail($this->message->reveal());
 }
开发者ID:pitechplus,项目名称:mailer-bundle,代码行数:26,代码来源:SwiftMailerTest.php

示例3: testSendMail

 /**
  * @dataProvider getDataForTestSendMail
  *
  * @param null|string $type
  * @param null|string $to
  * @param array       $params
  * @param null|string $filename
  */
 public function testSendMail($type, $to, $params, $filename)
 {
     if (!$to && $type) {
         $this->provider->getTo($type)->shouldBeCalled();
     }
     if ($type) {
         $this->provider->getSubject($type, $params)->shouldBeCalled();
         $this->provider->getFrom($type)->shouldBeCalled();
         $this->provider->getBody($type, $params)->shouldBeCalled();
     }
     $this->provider->getCc($type)->shouldBeCalled();
     if (!$filename) {
         $this->provider->getAttachment($type)->shouldBeCalled();
     }
     $this->class->sendMail($type, $to, $params, $filename);
 }
开发者ID:pitechplus,项目名称:mailer-bundle,代码行数:24,代码来源:MailResolverTest.php


注:本文中的Prophecy\Prophecy\ObjectProphecy::getTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。