本文整理汇总了PHP中EmailFolder::getDefaultArchivedName方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailFolder::getDefaultArchivedName方法的具体用法?PHP EmailFolder::getDefaultArchivedName怎么用?PHP EmailFolder::getDefaultArchivedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailFolder
的用法示例。
在下文中一共展示了EmailFolder::getDefaultArchivedName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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));
}
示例4: 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;
}