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


PHP EmailFolder::getDefaultOutboxFailureName方法代码示例

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


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

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