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


PHP Email::expects方法代碼示例

本文整理匯總了PHP中Oro\Bundle\EmailBundle\Entity\Email::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP Email::expects方法的具體用法?PHP Email::expects怎麽用?PHP Email::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Oro\Bundle\EmailBundle\Entity\Email的用法示例。


在下文中一共展示了Email::expects方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCreateReplyAllEmailModel

 /**
  * @param object $getOwnerResult
  * @param object $getUserResult
  * @param int    $getToCalls
  *
  * @dataProvider createReplyEmailModelProvider
  */
 public function testCreateReplyAllEmailModel($getOwnerResult, $getUserResult, $getToCalls)
 {
     $this->fromEmailAddress = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailAddress');
     $this->fromCcEmailAddress = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailAddress');
     $this->fromEmailAddress->expects($this->once())->method('getOwner')->willReturn($getOwnerResult);
     $this->helper->expects($this->any())->method('getUser')->willReturn($getUserResult);
     $getUserResult->expects($this->any())->method('getEmails')->willReturn([]);
     $this->email->expects($this->once())->method('getFromEmailAddress')->willReturn($this->fromEmailAddress);
     $this->email->expects($this->any())->method('getId');
     $emailAddress = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailAddress');
     $emailAddress->expects($this->exactly($getToCalls))->method('getEmail')->willReturn(null);
     $emailRecipient = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailRecipient');
     $emailRecipient->expects($this->exactly($getToCalls))->method('getEmailAddress')->willReturn($emailAddress);
     $to = new ArrayCollection();
     $to->add($emailRecipient);
     $this->email->expects($this->exactly($getToCalls))->method('getTo')->willReturn($to);
     $emailCcRecipient = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailRecipient');
     $emailCcRecipient->expects($this->once())->method('getEmailAddress')->willReturn($this->fromCcEmailAddress);
     $cc = new ArrayCollection();
     $cc->add($emailCcRecipient);
     $this->email->expects($this->exactly($getToCalls))->method('getCc')->willReturn($cc);
     $this->helper->expects($this->once())->method('prependWith');
     $this->helper->expects($this->once())->method('getEmailBody');
     $this->activityListProvider->expects($this->once())->method('getTargetEntities')->willReturn([]);
     $result = $this->emailModelBuilder->createReplyAllEmailModel($this->email);
     $this->assertInstanceOf('Oro\\Bundle\\EmailBundle\\Form\\Model\\Email', $result);
 }
開發者ID:Maksold,項目名稱:platform,代碼行數:34,代碼來源:EmailModelBuilderTest.php

示例2: testCreateForwardEmailModel

 public function testCreateForwardEmailModel()
 {
     $this->helper->expects($this->once())->method('prependWith');
     $emailBody = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailBody');
     $emailBody->expects($this->exactly(1))->method('getAttachments')->willReturn([]);
     $this->email->expects($this->once())->method('getEmailBody')->willReturn($emailBody);
     $result = $this->emailModelBuilder->createForwardEmailModel($this->email);
     $this->assertInstanceOf('Oro\\Bundle\\EmailBundle\\Form\\Model\\Email', $result);
 }
開發者ID:nmallare,項目名稱:platform,代碼行數:9,代碼來源:EmailModelBuilderTest.php


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