本文整理汇总了PHP中EmailFolder::forget方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailFolder::forget方法的具体用法?PHP EmailFolder::forget怎么用?PHP EmailFolder::forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailFolder
的用法示例。
在下文中一共展示了EmailFolder::forget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetAndGetFolder
/**
* @depends testGetByBoxAndTypeForNotificationsBox
*/
public function testSetAndGetFolder()
{
$billy = User::getByUsername('billy');
Yii::app()->user->userModel = $billy;
$folders = EmailFolder::getAll();
$this->assertEquals(8, count($folders));
$box = new EmailBox();
$box->name = 'Some new mailbox';
$saved = $box->save();
$this->assertTrue($saved);
$this->assertEquals(0, $box->folders->count());
$folder = new EmailFolder();
$folder->name = 'Billy\'s Inbox';
$folder->type = EmailFolder::TYPE_INBOX;
$saved = $folder->save();
//Missing 'box', so it should not save
$this->assertFalse($saved);
$folder->emailBox = $box;
$saved = $folder->save();
$this->assertTrue($saved);
$folderId = $folder->id;
$folder->forget();
unset($folder);
$folder = EmailFolder::getById($folderId);
$this->assertEquals($box->id, $folder->emailBox->id);
//Now check the box has the correct folder related to it
$boxId = $box->id;
$box->forget();
unset($box);
$box = EmailBox::getById($boxId);
$this->assertEquals(1, $box->folders->count());
$this->assertEquals('Billy\'s Inbox', $box->folders[0]->name);
$this->assertEquals(EmailFolder::TYPE_INBOX, $box->folders[0]->type);
$folders = EmailFolder::getAll();
$this->assertEquals(9, count($folders));
//Now delete billy's inbox
$folder->delete();
$folders = EmailFolder::getAll();
$this->assertEquals(8, count($folders));
$box->forget();
unset($box);
$box = EmailBox::getById($boxId);
$this->assertEquals(0, $box->folders->count());
}