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


PHP ObjectProphecy::send方法代码示例

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


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

示例1: setupMockResponse

 protected function setupMockResponse(RequestInterface $request, $response)
 {
     // If a string is passed in, assume its a path to a HTTP representation
     if (is_string($response)) {
         $response = $this->getFixture($response);
     }
     $this->client->send(Argument::is($request))->shouldBeCalled()->willReturn($response);
 }
开发者ID:boxrice007,项目名称:openstack,代码行数:8,代码来源:TestCase.php

示例2: testNotifyShouldCallSkebbySendReceiveFailingResponseAndThrowNotificationFailedException

 /**
  * @dataProvider right
  *
  * @expectedException \Fazland\Notifire\Exception\NotificationFailedException
  *
  * @param Sms $sms
  */
 public function testNotifyShouldCallSkebbySendReceiveFailingResponseAndThrowNotificationFailedException(Sms $sms)
 {
     $skebbySms = SkebbySms::create()->setRecipients($sms->getTo())->setText($sms->getContent());
     $response = new Response(self::RESPONSE_FAIL);
     $this->skebby->send($skebbySms)->shouldBeCalled();
     $this->skebby->send($skebbySms)->willReturn([$response]);
     $this->handler->notify($sms);
     /** @var Result $result */
     foreach ($sms->getResultSet()->all() as $result) {
         $this->assertTrue(Result::FAIL === $result->getResult());
     }
 }
开发者ID:fazland,项目名称:notifire,代码行数:19,代码来源:SkebbyHandlerTest.php

示例3: testShouldSetMultipartAlternativeIfEmailIsMultipart

 public function testShouldSetMultipartAlternativeIfEmailIsMultipart()
 {
     $email = new Email();
     $email->addPart(Email\Part::create('BODY PART', 'text/plain'))->addPart(Email\Part::create('PART 2', 'text/html'));
     $this->mailer->send(Argument::that(function ($argument) {
         if (!$argument instanceof \Swift_Message) {
             return false;
         }
         $this->assertCount(2, $argument->getChildren());
         $this->assertEquals('multipart/alternative', $argument->getContentType());
         return true;
     }))->willReturn(1);
     $this->handler->notify($email);
 }
开发者ID:fazland,项目名称:notifire,代码行数:14,代码来源:SwiftMailerHandlerTest.php

示例4: testOnNewAccountCreated

 public function testOnNewAccountCreated()
 {
     $userName = 'tester';
     $userEmail = 'tester@example.com';
     $messageBody = 'Body';
     $messageSubject = 'Subject';
     $template = $this->prophet->prophesize('Twig_Template');
     $event = $this->prophet->prophesize('Smoovio\\Bundle\\CoreBundle\\Event\\NewAccountCreatedEvent');
     $user = $this->prophet->prophesize('Smoovio\\Bundle\\CoreBundle\\Entity\\User');
     $this->templating->loadTemplate($this->templateName)->willReturn($template->reveal())->shouldBeCalled();
     $template->renderBlock('subject', [])->willReturn('Subject');
     $event->getUser()->willReturn($user);
     $user->getUsername()->willReturn($userName);
     $user->getEmail()->willReturn($userEmail);
     $template->renderBlock('body', ['username' => $userName])->willReturn($messageBody)->shouldBeCalled();
     $this->mailer->send(Argument::that(function (\Swift_Message $message) use($userEmail, $messageBody, $messageSubject) {
         $this->assertSame($this->sender, $message->getSender());
         $this->assertSame($userEmail, $message->getTo());
         $this->assertSame($messageSubject, $message->getSubject());
         $this->assertSame($messageBody, $message->getBody());
     }));
     $this->listener->onNewAccountCreated($event->reveal());
     $this->prophet->checkPredictions();
 }
开发者ID:nicolas-grekas,项目名称:workshop-symfony3,代码行数:24,代码来源:SendConfirmationMailListenerTest.php


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