Merge branch '3'

This commit is contained in:
Robbie Averill 2017-10-12 13:22:24 +13:00
commit a55d5c285a
2 changed files with 25 additions and 1 deletions

View File

@ -488,7 +488,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
return false; return false;
} }
if (!$options || !$options->hasExtension(__CLASS__)) { if (!$options
// Options can be a SiteConfig with different extension applied
|| (!$options->hasExtension(__CLASS__) && !$options->hasExtension(ContentReviewDefaultSettings::class))
) {
return false; return false;
} }

View File

@ -330,4 +330,25 @@ class SiteTreeContentReviewTest extends ContentReviewBaseTest
DBDatetime::clear_mock_now(); DBDatetime::clear_mock_now();
} }
public function testSiteConfigSettingsAreUsedAsDefaults()
{
DBDatetime::set_mock_now("2020-03-01 12:00:00");
/** @var Member $author */
$author = $this->objFromFixture(Member::class, 'editor');
/** @var SiteConfig $siteConfig */
$siteConfig = SiteConfig::current_site_config();
// Set the author to a default user for reviewing
$siteConfig->OwnerUsers()->add($author);
$emptyPage = new Page;
$emptyPage->NextReviewDate = '2020-02-20 12:00:00';
$this->assertTrue($emptyPage->canBeReviewedBy($author));
DBDatetime::clear_mock_now();
}
} }