mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
More coverage
This commit is contained in:
parent
32378bb269
commit
bfbc53c080
@ -387,8 +387,6 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
$nextDate = null;
|
||||
// Changed to Inherit
|
||||
} elseif($this->owner->ContentReviewType == 'Inherit') {
|
||||
// clear out the old value so the get_next_review_date() don't fetch it again
|
||||
$this->owner->NextReviewDate = null;
|
||||
// Take from Parent page
|
||||
if($settings && $this->owner->parent()->exists()) {
|
||||
$nextDate = $this->getReviewDate($this->owner->parent());
|
||||
@ -417,7 +415,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
}
|
||||
|
||||
// Oh yey.. now we need to update all the child pages that inherit this setting
|
||||
// We can only change children after this record has been saved, otherwise the stageChildren
|
||||
// We can only change children after this record has been created, otherwise the stageChildren
|
||||
// method will grab all pages in the DB (this messes up unittesting)
|
||||
if(!$this->owner->exists()) {
|
||||
return;
|
||||
|
@ -42,6 +42,18 @@ class ContentReviewSettingsTest extends SapphireTest {
|
||||
$this->assertFalse($page->getOptions());
|
||||
}
|
||||
|
||||
public function testGetOptionObjectFromInheritedDisabled() {
|
||||
$page = $this->objFromFixture('Page', 'page-2-1-1');
|
||||
$this->assertEquals('Inherit', $page->ContentReviewType);
|
||||
$this->assertFalse($page->getOptions());
|
||||
}
|
||||
|
||||
public function testGetOptionObjectFromDeeplyInheritedPage() {
|
||||
$page = $this->objFromFixture('Page', 'page-3-1-1-1');
|
||||
$this->assertEquals('Inherit', $page->ContentReviewType);
|
||||
$this->assertInstanceOf('SiteConfig', $page->getOptions());
|
||||
}
|
||||
|
||||
public function testGetSettingsObjectFromInheritPage() {
|
||||
$page = $this->objFromFixture('Page', 'page-1-1');
|
||||
$this->assertEquals('Inherit', $page->ContentReviewType);
|
||||
|
@ -51,22 +51,44 @@ Page:
|
||||
NextReviewDate: 2010-02-01
|
||||
ContentReviewUsers: =>Member.editor
|
||||
ReviewPeriodDays: 10
|
||||
ParentID: 0
|
||||
disabled:
|
||||
Title: disabled
|
||||
ContentReviewType: Disabled
|
||||
ParentID: 0
|
||||
inherit:
|
||||
Title: inherit
|
||||
ContentReviewType: Inherit
|
||||
ParentID: 0
|
||||
page-1:
|
||||
Title: page 1
|
||||
ContentReviewType: Custom
|
||||
ReviewPeriodDays: 5
|
||||
NextReviewDate: 2010-02-01
|
||||
ParentID: 0
|
||||
page-1-1:
|
||||
Title: page 1 1
|
||||
ContentReviewType: Inherit
|
||||
ParentID: =>Page.page-1
|
||||
ParentID: =>Page.page-1
|
||||
page-2:
|
||||
Title: page 2
|
||||
ContentReviewType: Inherit
|
||||
page-2-1:
|
||||
Title: page 2 1
|
||||
ContentReviewType: Disabled
|
||||
ParentID: =>Page.page-2
|
||||
page-2-1-1:
|
||||
Title: page 2 1 1
|
||||
ContentReviewType: Inherit
|
||||
ParentID: =>Page.page-2-1
|
||||
page-3:
|
||||
Title: page 3
|
||||
ContentReviewType: Inherit
|
||||
page-3-1:
|
||||
Title: page 3 1
|
||||
ContentReviewType: Inherit
|
||||
ParentID: =>Page.page-3
|
||||
page-3-1-1:
|
||||
Title: page 3 1 1
|
||||
ContentReviewType: Inherit
|
||||
ParentID: =>Page.page-3-1
|
||||
page-3-1-1-1:
|
||||
Title: page 3 1 1 1
|
||||
ContentReviewType: Inherit
|
||||
ParentID: =>Page.page-3-1-1
|
Loading…
Reference in New Issue
Block a user