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


PHP EmailFolder::getDefaultOutboxName方法代码示例

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


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

示例1: createBoxAndDefaultFoldersByUserAndName

 /**
  * Given a box name and user, create an email box with the default folders.
  * @param User $user
  * @param string $name
  */
 public static function createBoxAndDefaultFoldersByUserAndName(User $user, $name)
 {
     assert('$user->id > 0');
     assert('is_string($name)');
     $box = new EmailBox();
     $box->name = $name;
     $box->user = $user;
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultDraftName();
     $folder->type = EmailFolder::TYPE_DRAFT;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultInboxName();
     $folder->type = EmailFolder::TYPE_INBOX;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultSentName();
     $folder->type = EmailFolder::TYPE_SENT;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxName();
     $folder->type = EmailFolder::TYPE_OUTBOX;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxErrorName();
     $folder->type = EmailFolder::TYPE_OUTBOX_ERROR;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxFailureName();
     $folder->type = EmailFolder::TYPE_OUTBOX_FAILURE;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultArchivedName();
     $folder->type = EmailFolder::TYPE_ARCHIVED;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultArchivedUnmatchedName();
     $folder->type = EmailFolder::TYPE_ARCHIVED_UNMATCHED;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $saved = $box->save();
     if (!$saved) {
         throw new NotSupportedException();
     }
     return $box;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:58,代码来源:EmailBoxUtil.php

示例2: testGetByBoxAndTypeForNotificationsBox

 public function testGetByBoxAndTypeForNotificationsBox()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $boxes = EmailBox::getAll();
     $this->assertEquals(0, count($boxes));
     $box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
     $this->assertEquals(EmailBox::NOTIFICATIONS_NAME, $box->name);
     $this->assertEquals(8, $box->folders->count());
     $this->assertTrue($box->id > 0);
     $folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
     $this->assertEquals(EmailFolder::getDefaultOutboxName(), $folder->name);
     $this->assertEquals(EmailFolder::TYPE_OUTBOX, $folder->type);
     $folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_SENT);
     $this->assertEquals(EmailFolder::getDefaultSentName(), $folder->name);
     $this->assertEquals(EmailFolder::TYPE_SENT, $folder->type);
     $folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_ARCHIVED);
     $this->assertEquals(EmailFolder::getDefaultArchivedName(), $folder->name);
     $this->assertEquals(EmailFolder::TYPE_ARCHIVED, $folder->type);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:EmailFolderTest.php

示例3: testUserDefaultBoxBoxResolvesCorrectly

 /**
  * @depends testTryDeletingTheNotificationsBox
  */
 public function testUserDefaultBoxBoxResolvesCorrectly()
 {
     $jane = User::getByUsername('jane');
     Yii::app()->user->userModel = $jane;
     $boxes = EmailBox::getAll();
     $this->assertEquals(1, count($boxes));
     $box = EmailBoxUtil::getDefaultEmailBoxByUser($jane);
     $this->assertEquals(EmailBox::USER_DEFAULT_NAME, $box->name);
     $this->assertEquals(8, $box->folders->count());
     $this->assertTrue($box->isDeletable());
     $this->assertTrue($box->id > 0);
     //After it saves, it should create a Sent folder and an Outbox folder
     $boxes = EmailBox::getAll();
     $this->assertEquals(2, count($boxes));
     $jane->forget();
     $jane = User::getByUsername('jane');
     Yii::app()->user->userModel = $jane;
     $this->assertEquals(1, $jane->emailBoxes->count());
     $box = $jane->emailBoxes->offsetGet(0);
     $this->assertEquals(8, $box->folders->count());
     $folder1 = $box->folders->offsetGet(0);
     $folder2 = $box->folders->offsetGet(1);
     $folder3 = $box->folders->offsetGet(2);
     $folder4 = $box->folders->offsetGet(3);
     $folder5 = $box->folders->offsetGet(4);
     $folder6 = $box->folders->offsetGet(5);
     $folder7 = $box->folders->offsetGet(6);
     $folder8 = $box->folders->offsetGet(7);
     $this->assertTrue($folder1->name == EmailFolder::getDefaultInboxName() || $folder1->name == EmailFolder::getDefaultSentName() || $folder1->name == EmailFolder::getDefaultOutboxName() || $folder1->name == EmailFolder::getDefaultDraftName() || $folder1->name == EmailFolder::getDefaultOutboxErrorName() || $folder1->name == EmailFolder::getDefaultOutboxFailureName() || $folder1->name == EmailFolder::getDefaultArchivedName() || $folder1->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertTrue($folder2->name == EmailFolder::getDefaultInboxName() || $folder2->name == EmailFolder::getDefaultSentName() || $folder2->name == EmailFolder::getDefaultOutboxName() || $folder2->name == EmailFolder::getDefaultDraftName() || $folder2->name == EmailFolder::getDefaultOutboxErrorName() || $folder2->name == EmailFolder::getDefaultOutboxFailureName() || $folder2->name == EmailFolder::getDefaultArchivedName() || $folder2->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertTrue($folder3->name == EmailFolder::getDefaultInboxName() || $folder3->name == EmailFolder::getDefaultSentName() || $folder3->name == EmailFolder::getDefaultOutboxName() || $folder3->name == EmailFolder::getDefaultDraftName() || $folder3->name == EmailFolder::getDefaultOutboxErrorName() || $folder3->name == EmailFolder::getDefaultOutboxFailureName() || $folder3->name == EmailFolder::getDefaultArchivedName() || $folder3->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertTrue($folder4->name == EmailFolder::getDefaultInboxName() || $folder4->name == EmailFolder::getDefaultSentName() || $folder4->name == EmailFolder::getDefaultOutboxName() || $folder4->name == EmailFolder::getDefaultDraftName() || $folder4->name == EmailFolder::getDefaultOutboxErrorName() || $folder4->name == EmailFolder::getDefaultOutboxFailureName() || $folder4->name == EmailFolder::getDefaultArchivedName() || $folder4->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertTrue($folder5->name == EmailFolder::getDefaultInboxName() || $folder5->name == EmailFolder::getDefaultSentName() || $folder5->name == EmailFolder::getDefaultOutboxName() || $folder5->name == EmailFolder::getDefaultDraftName() || $folder5->name == EmailFolder::getDefaultOutboxErrorName() || $folder5->name == EmailFolder::getDefaultOutboxFailureName() || $folder5->name == EmailFolder::getDefaultArchivedName() || $folder5->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertTrue($folder6->name == EmailFolder::getDefaultInboxName() || $folder6->name == EmailFolder::getDefaultSentName() || $folder6->name == EmailFolder::getDefaultOutboxName() || $folder6->name == EmailFolder::getDefaultDraftName() || $folder6->name == EmailFolder::getDefaultOutboxErrorName() || $folder6->name == EmailFolder::getDefaultOutboxFailureName() || $folder6->name == EmailFolder::getDefaultArchivedName() || $folder6->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertTrue($folder7->name == EmailFolder::getDefaultInboxName() || $folder7->name == EmailFolder::getDefaultSentName() || $folder7->name == EmailFolder::getDefaultOutboxName() || $folder7->name == EmailFolder::getDefaultDraftName() || $folder7->name == EmailFolder::getDefaultOutboxErrorName() || $folder7->name == EmailFolder::getDefaultOutboxFailureName() || $folder7->name == EmailFolder::getDefaultArchivedName() || $folder7->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertTrue($folder8->name == EmailFolder::getDefaultInboxName() || $folder8->name == EmailFolder::getDefaultSentName() || $folder8->name == EmailFolder::getDefaultOutboxName() || $folder8->name == EmailFolder::getDefaultDraftName() || $folder8->name == EmailFolder::getDefaultOutboxErrorName() || $folder8->name == EmailFolder::getDefaultOutboxFailureName() || $folder8->name == EmailFolder::getDefaultArchivedName() || $folder8->name == EmailFolder::getDefaultArchivedUnmatchedName());
     $this->assertNotEquals($folder1->name, $folder2->name);
     $this->assertNotEquals($folder1->name, $folder3->name);
     $this->assertNotEquals($folder1->name, $folder4->name);
     $this->assertNotEquals($folder1->name, $folder5->name);
     $this->assertNotEquals($folder1->name, $folder6->name);
     $this->assertNotEquals($folder1->name, $folder7->name);
     $this->assertNotEquals($folder1->name, $folder8->name);
     $this->assertNotEquals($folder2->name, $folder3->name);
     $this->assertNotEquals($folder2->name, $folder4->name);
     $this->assertNotEquals($folder2->name, $folder5->name);
     $this->assertNotEquals($folder2->name, $folder6->name);
     $this->assertNotEquals($folder2->name, $folder7->name);
     $this->assertNotEquals($folder2->name, $folder8->name);
     $this->assertNotEquals($folder3->name, $folder4->name);
     $this->assertNotEquals($folder3->name, $folder5->name);
     $this->assertNotEquals($folder3->name, $folder6->name);
     $this->assertNotEquals($folder3->name, $folder7->name);
     $this->assertNotEquals($folder3->name, $folder8->name);
     $this->assertNotEquals($folder4->name, $folder5->name);
     $this->assertNotEquals($folder4->name, $folder6->name);
     $this->assertNotEquals($folder4->name, $folder7->name);
     $this->assertNotEquals($folder4->name, $folder8->name);
     $this->assertNotEquals($folder5->name, $folder6->name);
     $this->assertNotEquals($folder5->name, $folder7->name);
     $this->assertNotEquals($folder5->name, $folder8->name);
     $this->assertNotEquals($folder6->name, $folder7->name);
     $this->assertNotEquals($folder6->name, $folder8->name);
     $this->assertNotEquals($folder7->name, $folder8->name);
     $boxes = EmailBox::getAll();
     $this->assertEquals(2, count($boxes));
     $this->assertEquals($boxes[1]->user->id, $jane->id);
     $jane->forget();
     $jane = User::getByUsername('jane');
     Yii::app()->user->userModel = $jane;
     $this->assertEquals(1, $jane->emailBoxes->count());
     $this->assertEquals($jane->emailBoxes->offsetGet(0), $boxes[1]);
     // Check if only one default email box is created for user
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $jimmy = UserTestHelper::createBasicUser('jimmy');
     $saved = $jimmy->save();
     $this->assertTrue($saved);
     Yii::app()->user->userModel = $jimmy;
     $jimmysId = $jimmy->id;
     $this->assertTrue($jimmysId > 0);
     $this->assertTrue($jimmy->emailBoxes->count() == 0);
     EmailBoxUtil::getDefaultEmailBoxByUser($jimmy);
     //still doesn't show from the user side, because it was added via the other side.
     $this->assertTrue($jimmy->emailBoxes->count() == 0);
     $jimmysId = $jimmy->id;
     $jimmy->forget();
     $jimmy = User::getById($jimmysId);
     //now we forgot and re-retrieved so it should still show
     $this->assertTrue($jimmy->emailBoxes->count() == 1);
     EmailBoxUtil::getDefaultEmailBoxByUser($jimmy);
     // This command shouldn't create new box because we have manually refreshed user
     $boxes = EmailBox::getAll();
     // Note that two new boxes are created for use jimmy instead one.
     // Probably because $jimmy->emailBoxes->count() return 0
     $this->assertEquals(3, count($boxes));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:100,代码来源:EmailBoxTest.php

示例4: testResolveEmailMessageFromPostData

 public function testResolveEmailMessageFromPostData()
 {
     $billy = User::getByUsername('billy');
     Yii::app()->user->userModel = $billy;
     //Test with no users/person in recipients
     $emailMessage = new EmailMessage();
     $emailMessageForm = new CreateEmailMessageForm($emailMessage);
     $postVariableName = get_class($emailMessageForm);
     $postData = array($postVariableName => array('recipientsData' => array('to' => 'a@zurmo.com,b@zurmo.com', 'cc' => 'c@zurmo.com,d@zurmo.com', 'bcc' => 'e@zurmo.com,f@zurmo.com'), 'subject' => 'Test Email From Post', 'content' => array('htmlContent' => 'This is a test email')));
     $emailMessageForm = EmailMessageUtil::resolveEmailMessageFromPostData($postData, $emailMessageForm, $billy);
     //Message should have 6 recipients 2 of each type
     $this->assertEquals('6', count($emailMessageForm->getModel()->recipients));
     $recipients = $emailMessageForm->getModel()->recipients;
     $this->assertEquals(EmailMessageRecipient::TYPE_TO, $recipients[0]->type);
     $this->assertEquals(EmailMessageRecipient::TYPE_TO, $recipients[1]->type);
     $this->assertEquals(EmailMessageRecipient::TYPE_CC, $recipients[2]->type);
     $this->assertEquals(EmailMessageRecipient::TYPE_CC, $recipients[3]->type);
     $this->assertEquals(EmailMessageRecipient::TYPE_BCC, $recipients[4]->type);
     $this->assertEquals(EmailMessageRecipient::TYPE_BCC, $recipients[5]->type);
     $this->assertEquals('a@zurmo.com', $recipients[0]->toAddress);
     $this->assertEquals('b@zurmo.com', $recipients[1]->toAddress);
     $this->assertEquals('c@zurmo.com', $recipients[2]->toAddress);
     $this->assertEquals('d@zurmo.com', $recipients[3]->toAddress);
     $this->assertEquals('e@zurmo.com', $recipients[4]->toAddress);
     $this->assertEquals('f@zurmo.com', $recipients[5]->toAddress);
     $this->assertEquals('', $recipients[0]->toName);
     $this->assertEquals('', $recipients[1]->toName);
     $this->assertEquals('', $recipients[2]->toName);
     $this->assertEquals('', $recipients[3]->toName);
     $this->assertEquals('', $recipients[4]->toName);
     $this->assertEquals('', $recipients[5]->toName);
     //Recipients are not personOrAccount
     $this->assertLessThan(0, $recipients[0]->personOrAccount->id);
     $this->assertLessThan(0, $recipients[1]->personOrAccount->id);
     $this->assertLessThan(0, $recipients[2]->personOrAccount->id);
     $this->assertLessThan(0, $recipients[3]->personOrAccount->id);
     $this->assertLessThan(0, $recipients[4]->personOrAccount->id);
     $this->assertLessThan(0, $recipients[5]->personOrAccount->id);
     //The message should go to the default outbox folder
     $this->assertEquals(EmailFolder::getDefaultOutboxName(), $emailMessageForm->folder->name);
     $this->assertEquals(EmailFolder::TYPE_OUTBOX, $emailMessageForm->folder->type);
     //Test with null in cc/bcc
     $emailMessage = new EmailMessage();
     $emailMessageForm = new CreateEmailMessageForm($emailMessage);
     $postVariableName = get_class($emailMessageForm);
     $postData = array($postVariableName => array('recipientsData' => array('to' => 'a@zurmo.com', 'cc' => null, 'bcc' => null), 'subject' => 'Test Email From Post', 'content' => array('htmlContent' => 'This is a test email')));
     $emailMessageForm = EmailMessageUtil::resolveEmailMessageFromPostData($postData, $emailMessageForm, $billy);
     $this->assertEquals('1', count($emailMessageForm->getModel()->recipients));
     $this->assertEquals(EmailMessageRecipient::TYPE_TO, $emailMessageForm->getModel()->recipients[0]->type);
     $this->assertEquals('a@zurmo.com', $emailMessageForm->getModel()->recipients[0]->toAddress);
     //Test with with contacts in recipients
     $emailMessage = new EmailMessage();
     $emailMessageForm = new CreateEmailMessageForm($emailMessage);
     $postVariableName = get_class($emailMessageForm);
     $postData = array($postVariableName => array('recipientsData' => array('to' => 'sally@zurmoland.com', 'cc' => null, 'bcc' => null), 'subject' => 'Test Email From Post', 'content' => array('htmlContent' => 'This is a test email')));
     $emailMessageForm = EmailMessageUtil::resolveEmailMessageFromPostData($postData, $emailMessageForm, $billy);
     $this->assertEquals('1', count($emailMessageForm->getModel()->recipients));
     $this->assertEquals(EmailMessageRecipient::TYPE_TO, $emailMessageForm->getModel()->recipients[0]->type);
     $this->assertEquals('sally@zurmoland.com', $emailMessageForm->getModel()->recipients[0]->toAddress);
     $contacts = Contact::getByName('sally sallyson');
     $this->assertEquals($emailMessageForm->getModel()->recipients[0]->personOrAccount->getClassId('Item'), $contacts[0]->getClassId('Item'));
     //Test with attachments
     $email = new Email();
     $filesIds = array();
     $fileDocx = ZurmoTestHelper::createFileModel('testNote.txt', 'FileModel');
     $filesIds[] = $fileDocx->id;
     $fileTxt = ZurmoTestHelper::createFileModel('testImage.png', 'FileModel');
     $filesIds[] = $fileTxt->id;
     $emailMessage = new EmailMessage();
     $emailMessageForm = new CreateEmailMessageForm($emailMessage);
     $postVariableName = get_class($emailMessageForm);
     $postData = array($postVariableName => array('recipientsData' => array('to' => 'a@zurmo.com', 'cc' => null, 'bcc' => null), 'subject' => 'Test Email From Post', 'content' => array('htmlContent' => 'This is a test email')), 'filesIds' => $filesIds);
     $emailMessageForm = EmailMessageUtil::resolveEmailMessageFromPostData($postData, $emailMessageForm, $billy);
     $this->assertEquals(2, count($emailMessageForm->getModel()->files));
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:75,代码来源:EmailMessageUtilTest.php

示例5: makeSystemMissingBox

 protected static function makeSystemMissingBox($name)
 {
     $box = new EmailBox();
     $box->name = $name;
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultDraftName();
     $folder->type = EmailFolder::TYPE_DRAFT;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultSentName();
     $folder->type = EmailFolder::TYPE_SENT;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxName();
     $folder->type = EmailFolder::TYPE_OUTBOX;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxErrorName();
     $folder->type = EmailFolder::TYPE_OUTBOX_ERROR;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultOutboxFailureName();
     $folder->type = EmailFolder::TYPE_OUTBOX_FAILURE;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultInboxName();
     $folder->type = EmailFolder::TYPE_INBOX;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultArchivedName();
     $folder->type = EmailFolder::TYPE_ARCHIVED;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $folder = new EmailFolder();
     $folder->name = EmailFolder::getDefaultArchivedUnmatchedName();
     $folder->type = EmailFolder::TYPE_ARCHIVED_UNMATCHED;
     $folder->emailBox = $box;
     $box->folders->add($folder);
     $saved = $box->save();
     assert('$saved');
     return $box;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:48,代码来源:EmailBox.php


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