本文整理汇总了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);
}