本文整理匯總了PHP中SiteTree::set_enforce_strict_hierarchy方法的典型用法代碼示例。如果您正苦於以下問題:PHP SiteTree::set_enforce_strict_hierarchy方法的具體用法?PHP SiteTree::set_enforce_strict_hierarchy怎麽用?PHP SiteTree::set_enforce_strict_hierarchy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SiteTree
的用法示例。
在下文中一共展示了SiteTree::set_enforce_strict_hierarchy方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff
function testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff()
{
$this->logInWithPermission('ADMIN');
SiteTree::set_enforce_strict_hierarchy(true);
$parentPage = $this->objFromFixture('Page', 'page3');
$childPage = $this->objFromFixture('Page', 'page1');
$parentPage->doUnpublish();
$childPage->doUnpublish();
$this->assertContains('action_publish', $childPage->getCMSActions()->column('Name'), 'Can publish a page with an unpublished parent with strict hierarchy off');
SiteTree::set_enforce_strict_hierarchy(false);
}
示例2: testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn
function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn()
{
SiteTree::set_enforce_strict_hierarchy(false);
$this->logInWithPermission('ADMIN');
$pageAbout = $this->objFromFixture('Page', 'about');
$pageAbout->doPublish();
$pageStaff = $this->objFromFixture('Page', 'staff');
$pageStaff->doPublish();
$pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate');
$pageStaffDuplicate->doPublish();
$parentPage = $this->objFromFixture('Page', 'about');
$parentPage->doUnpublish();
Versioned::reading_stage('Live');
$this->assertFalse(DataObject::get_by_id('Page', $pageAbout->ID));
$this->assertTrue(DataObject::get_by_id('Page', $pageStaff->ID) instanceof Page);
$this->assertTrue(DataObject::get_by_id('Page', $pageStaffDuplicate->ID) instanceof Page);
Versioned::reading_stage('Stage');
SiteTree::set_enforce_strict_hierarchy(true);
}