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


PHP Email::setFromEmailAddress方法代码示例

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


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

示例1: testFromEmailAddressGetterAndSetter

 public function testFromEmailAddressGetterAndSetter()
 {
     $emailAddress = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailAddress');
     $entity = new Email();
     $entity->setFromEmailAddress($emailAddress);
     $this->assertTrue($emailAddress === $entity->getFromEmailAddress());
 }
开发者ID:xamin123,项目名称:platform,代码行数:7,代码来源:EmailTest.php

示例2: testGetDirection

 public function testGetDirection()
 {
     $fromEmail = 'from@example.com';
     $toEmail = 'to@example.com';
     $sender = new TestEmailHolder($fromEmail);
     $reciver = new TestEmailHolder($toEmail);
     $email = new Email();
     $emailAddress = new EmailAddress();
     $emailAddress->setEmail($fromEmail);
     $email->setFromEmailAddress($emailAddress);
     $this->assertEquals(DirectionProviderInterface::DIRECTION_INCOMING, $this->provider->getDirection($email, $reciver));
     $this->assertEquals(DirectionProviderInterface::DIRECTION_OUTGOING, $this->provider->getDirection($email, $sender));
 }
开发者ID:rodolfobandeira,项目名称:crm,代码行数:13,代码来源:EmailDirectionProviderTest.php

示例3: testUnknownDirectionForCustomEntity

 public function testUnknownDirectionForCustomEntity()
 {
     $getMethodName = "get" . Inflector::classify(self::COLUMN_NAME);
     $target = $this->getMock('Extend\\Entity\\Test', array($getMethodName));
     $target->method($getMethodName)->will($this->returnValue('test' . self::TO_EMAIL));
     $email = new Email();
     $toEmailAddress = new EmailAddress();
     $toEmailAddress->setEmail(self::TO_EMAIL);
     $recipient = new EmailRecipient();
     $recipient->setEmailAddress($toEmailAddress)->setType(EmailRecipient::TO);
     $email->addRecipient($recipient);
     $fromEmailAddress = new EmailAddress();
     $fromEmailAddress->setEmail(self::FROM_EMAIL);
     $email->setFromEmailAddress($fromEmailAddress);
     $this->assertEquals(DirectionProviderInterface::DIRECTION_UNKNOWN, $this->provider->getDirection($email, $target));
 }
开发者ID:antrampa,项目名称:crm,代码行数:16,代码来源:EmailDirectionProviderTest.php

示例4: addEmailSender

 /**
  * @param Email       $email
  * @param object|null $owner
  */
 protected function addEmailSender(Email $email, $owner = null)
 {
     $emailAddr = new EmailAddress();
     $emailAddr->setOwner($owner);
     $email->setFromEmailAddress($emailAddr);
 }
开发者ID:xamin123,项目名称:platform,代码行数:10,代码来源:EmailActivityManagerTest.php

示例5: testPersist

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testPersist()
 {
     $origin = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\EmailOrigin')->getMock();
     $origin->expects($this->any())->method('getId')->will($this->returnValue(1));
     $folder = new EmailFolder();
     $folder->setName('Exist');
     $folder->setFullName('Exist');
     $folder->setOrigin($origin);
     $this->batch->addFolder($folder);
     $newFolder = new EmailFolder();
     $newFolder->setName('New');
     $newFolder->setFullName('New');
     $newFolder->setOrigin($origin);
     $this->batch->addFolder($newFolder);
     $dbFolder = new EmailFolder();
     $dbFolder->setName('DbExist');
     $dbFolder->setFullName('DbExist');
     $dbFolder->setOrigin($origin);
     $addr = $this->addrManager->newEmailAddress()->setEmail('Exist');
     $this->batch->addAddress($addr);
     $newAddr = $this->addrManager->newEmailAddress()->setEmail('New');
     $this->batch->addAddress($newAddr);
     $dbAddr = $this->addrManager->newEmailAddress()->setEmail('DbExist');
     $email1 = new Email();
     $email1->setXMessageId('email1');
     $email1->setMessageId('email1');
     $email1->setFromEmailAddress($addr);
     $emailUser1 = new EmailUser();
     $emailUser1->addFolder($folder);
     $emailUser1->setOrigin($origin);
     $email1->addEmailUser($emailUser1);
     $this->addEmailRecipient($email1, $addr);
     $this->addEmailRecipient($email1, $newAddr);
     $this->batch->addEmailUser($emailUser1);
     $email2 = new Email();
     $email2->setXMessageId('email2');
     $email2->setMessageId('email2');
     $email2->setFromEmailAddress($newAddr);
     $emailUser2 = new EmailUser();
     $emailUser2->addFolder($newFolder);
     $emailUser2->setOrigin($origin);
     $email2->addEmailUser($emailUser2);
     $this->addEmailRecipient($email2, $addr);
     $this->addEmailRecipient($email2, $newAddr);
     $this->batch->addEmailUser($emailUser2);
     $email3 = new Email();
     $email3->setXMessageId('email3');
     $email3->setMessageId('some_email');
     $email3->setFromEmailAddress($newAddr);
     $emailUser3 = new EmailUser();
     $emailUser3->addFolder($folder);
     $email3->addEmailUser($emailUser3);
     $this->addEmailRecipient($email3, $addr);
     $this->addEmailRecipient($email3, $newAddr);
     $this->batch->addEmailUser($emailUser3);
     $email4 = new Email();
     $email4->setXMessageId('email4');
     $email4->setMessageId('some_email');
     $email4->setFromEmailAddress($newAddr);
     $emailUser4 = new EmailUser();
     $emailUser4->addFolder($folder);
     $email4->addEmailUser($emailUser4);
     $this->addEmailRecipient($email4, $addr);
     $this->addEmailRecipient($email4, $newAddr);
     $this->batch->addEmailUser($emailUser4);
     $existingEmail = new Email();
     $existingEmail->setXMessageId('existing_email');
     $existingEmail->setMessageId('some_email');
     $existingEmail->setFromEmailAddress($newAddr);
     $emailUser5 = new EmailUser();
     $emailUser5->addFolder($dbFolder);
     $existingEmail->addEmailUser($emailUser5);
     $this->addEmailRecipient($existingEmail, $addr);
     $this->addEmailRecipient($existingEmail, $newAddr);
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $folderRepo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $addrRepo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $emailRepo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $em->expects($this->exactly(3))->method('getRepository')->will($this->returnValueMap(array(array('OroEmailBundle:EmailFolder', $folderRepo), array('Oro\\Bundle\\EmailBundle\\Tests\\Unit\\Entity\\TestFixtures\\TestEmailAddressProxy', $addrRepo), array('OroEmailBundle:Email', $emailRepo))));
     $folderRepo->expects($this->exactly(2))->method('findOneBy')->will($this->returnCallback(function ($c) use(&$dbFolder) {
         return $c['fullName'] === 'Exist' ? $dbFolder : null;
     }));
     $addrRepo->expects($this->exactly(2))->method('findOneBy')->will($this->returnCallback(function ($c) use(&$dbAddr) {
         return $c['email'] === 'Exist' ? $dbAddr : null;
     }));
     $emailRepo->expects($this->once())->method('findBy')->with(array('messageId' => array('email1', 'email2', 'some_email')))->will($this->returnValue([$existingEmail]));
     $owner = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailOwnerInterface');
     $this->ownerProvider->expects($this->any())->method('findEmailOwner')->will($this->returnValue($owner));
     $this->batch->persist($em);
     $this->assertCount(1, $email1->getEmailUsers());
     $this->assertCount(1, $email2->getEmailUsers());
     $this->assertTrue($origin === $emailUser1->getOrigin());
     $this->assertTrue($origin === $emailUser2->getOrigin());
     $this->assertSame($newFolder, $emailUser2->getFolders()->first());
     $this->assertSame($dbFolder, $emailUser1->getFolders()->first());
     $this->assertTrue($dbAddr === $email1->getFromEmailAddress());
     $this->assertNull($email1->getFromEmailAddress()->getOwner());
//.........这里部分代码省略.........
开发者ID:Maksold,项目名称:platform,代码行数:101,代码来源:EmailEntityBatchProcessorTest.php

示例6: testPersist

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function testPersist()
 {
     $origin = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Entity\\EmailOrigin')->getMock();
     $origin->expects($this->any())->method('getId')->will($this->returnValue(1));
     $this->batch->addOrigin($origin);
     $folder = new EmailFolder();
     $folder->setName('Exist');
     $folder->setFullName('Exist');
     $folder->setOrigin($origin);
     $this->batch->addFolder($folder);
     $newFolder = new EmailFolder();
     $newFolder->setName('New');
     $newFolder->setFullName('New');
     $newFolder->setOrigin($origin);
     $this->batch->addFolder($newFolder);
     $dbFolder = new EmailFolder();
     $dbFolder->setName('DbExist');
     $dbFolder->setFullName('DbExist');
     $dbFolder->setOrigin($origin);
     $addr = $this->addrManager->newEmailAddress()->setEmail('Exist');
     $this->batch->addAddress($addr);
     $newAddr = $this->addrManager->newEmailAddress()->setEmail('New');
     $this->batch->addAddress($newAddr);
     $dbAddr = $this->addrManager->newEmailAddress()->setEmail('DbExist');
     $email1 = new Email();
     $email1->setFolder($folder);
     $email1->setFromEmailAddress($addr);
     $email1Recip1 = new EmailRecipient();
     $email1Recip1->setEmailAddress($addr);
     $email1Recip2 = new EmailRecipient();
     $email1Recip2->setEmailAddress($newAddr);
     $email1->addRecipient($email1Recip1);
     $email1->addRecipient($email1Recip2);
     $this->batch->addEmail($email1);
     $email2 = new Email();
     $email2->setFolder($newFolder);
     $email2->setFromEmailAddress($newAddr);
     $email2Recip1 = new EmailRecipient();
     $email2Recip1->setEmailAddress($addr);
     $email2Recip2 = new EmailRecipient();
     $email2Recip2->setEmailAddress($newAddr);
     $email2->addRecipient($email2Recip1);
     $email2->addRecipient($email2Recip2);
     $this->batch->addEmail($email2);
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $folderRepo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $addrRepo = $this->getMockBuilder('Doctrine\\ORM\\EntityRepository')->disableOriginalConstructor()->getMock();
     $em->expects($this->exactly(2))->method('getRepository')->will($this->returnValueMap(array(array('OroEmailBundle:EmailFolder', $folderRepo), array('Oro\\Bundle\\EmailBundle\\Tests\\Unit\\Entity\\TestFixtures\\TestEmailAddressProxy', $addrRepo))));
     $folderRepo->expects($this->exactly(2))->method('findOneBy')->will($this->returnCallback(function ($c) use(&$dbFolder) {
         return $c['fullName'] === 'Exist' ? $dbFolder : null;
     }));
     $addrRepo->expects($this->exactly(2))->method('findOneBy')->will($this->returnCallback(function ($c) use(&$dbAddr) {
         return $c['email'] === 'Exist' ? $dbAddr : null;
     }));
     $em->expects($this->exactly(4))->method('persist')->with($this->logicalOr($this->identicalTo($newFolder), $this->identicalTo($newAddr), $this->identicalTo($email1), $this->identicalTo($email2)));
     $owner = $this->getMock('Oro\\Bundle\\EmailBundle\\Entity\\EmailOwnerInterface');
     $this->ownerProvider->expects($this->any())->method('findEmailOwner')->will($this->returnValue($owner));
     $this->batch->persist($em);
     $this->assertTrue($origin === $email1->getFolder()->getOrigin());
     $this->assertTrue($origin === $email2->getFolder()->getOrigin());
     $this->assertTrue($dbFolder === $email1->getFolder());
     $this->assertTrue($newFolder === $email2->getFolder());
     $this->assertTrue($dbAddr === $email1->getFromEmailAddress());
     $this->assertNull($email1->getFromEmailAddress()->getOwner());
     $this->assertTrue($newAddr === $email2->getFromEmailAddress());
     $this->assertTrue($owner === $email2->getFromEmailAddress()->getOwner());
     $email1Recipients = $email1->getRecipients();
     $this->assertTrue($dbAddr === $email1Recipients[0]->getEmailAddress());
     $this->assertNull($email1Recipients[0]->getEmailAddress()->getOwner());
     $this->assertTrue($newAddr === $email1Recipients[1]->getEmailAddress());
     $this->assertTrue($owner === $email1Recipients[1]->getEmailAddress()->getOwner());
     $email2Recipients = $email2->getRecipients();
     $this->assertTrue($dbAddr === $email2Recipients[0]->getEmailAddress());
     $this->assertNull($email2Recipients[0]->getEmailAddress()->getOwner());
     $this->assertTrue($newAddr === $email2Recipients[1]->getEmailAddress());
     $this->assertTrue($owner === $email2Recipients[1]->getEmailAddress()->getOwner());
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:80,代码来源:EmailEntityBatchProcessorTest.php


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