本文整理汇总了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);
}
示例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());
}
}
示例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);
}
示例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();
}