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


PHP EmailFolder::getById方法代码示例

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


在下文中一共展示了EmailFolder::getById方法的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());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:47,代码来源:EmailFolderTest.php


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