當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SiteTree::on_db_reset方法代碼示例

本文整理匯總了PHP中SiteTree::on_db_reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteTree::on_db_reset方法的具體用法?PHP SiteTree::on_db_reset怎麽用?PHP SiteTree::on_db_reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SiteTree的用法示例。


在下文中一共展示了SiteTree::on_db_reset方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testEditPermissionsOnDraftVsLive

 public function testEditPermissionsOnDraftVsLive()
 {
     // Create an inherit-permission page
     $page = new Page();
     $page->write();
     $page->CanEditType = "Inherit";
     $page->doPublish();
     $pageID = $page->ID;
     // Lock down the site config
     $sc = $page->SiteConfig;
     $sc->CanEditType = 'OnlyTheseUsers';
     $sc->EditorGroups()->add($this->idFromFixture('Group', 'admins'));
     $sc->write();
     // Confirm that Member.editor can't edit the page
     $this->objFromFixture('Member', 'editor')->logIn();
     $this->assertFalse($page->canEdit());
     // Change the page to be editable by Group.editors, but do not publish
     $this->objFromFixture('Member', 'admin')->logIn();
     $page->CanEditType = 'OnlyTheseUsers';
     $page->EditorGroups()->add($this->idFromFixture('Group', 'editors'));
     $page->write();
     // Clear permission cache
     SiteTree::on_db_reset();
     // Confirm that Member.editor can now edit the page
     $this->objFromFixture('Member', 'editor')->logIn();
     $this->assertTrue($page->canEdit());
     // Publish the changes to the page
     $this->objFromFixture('Member', 'admin')->logIn();
     $page->doPublish();
     // Confirm that Member.editor can still edit the page
     $this->objFromFixture('Member', 'editor')->logIn();
     $this->assertTrue($page->canEdit());
 }
開發者ID:fanggu,項目名稱:loveyourwater_ss_v3.1.6,代碼行數:33,代碼來源:SiteTreeTest.php


注:本文中的SiteTree::on_db_reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。