mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
BUG Cant get owner names from a page that is disabled
This commit is contained in:
parent
5376c3a248
commit
3017712dfb
@ -132,12 +132,16 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getOwnerNames() {
|
public function getOwnerNames() {
|
||||||
|
$options = $this->getOptions();
|
||||||
$names = array();
|
$names = array();
|
||||||
foreach($this->OwnerGroups() as $group) {
|
if(!$options) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
foreach($options->OwnerGroups() as $group) {
|
||||||
$names[] = $group->getBreadcrumbs(' > ');
|
$names[] = $group->getBreadcrumbs(' > ');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->OwnerUsers() as $group) {
|
foreach($options->OwnerUsers() as $group) {
|
||||||
$names[] = $group->getName();
|
$names[] = $group->getName();
|
||||||
}
|
}
|
||||||
return implode(', ', $names);
|
return implode(', ', $names);
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class ContentReviewTest extends FunctionalTest {
|
|
||||||
|
|
||||||
public static $fixture_file = 'contentreview/tests/ContentReviewTest.yml';
|
|
||||||
|
|
||||||
public function testOwnerNames() {
|
|
||||||
$editor = $this->objFromFixture('Member', 'editor');
|
|
||||||
$this->logInAs($editor);
|
|
||||||
|
|
||||||
$page = new Page();
|
|
||||||
$page->ReviewPeriodDays = 10;
|
|
||||||
$page->ContentReviewUsers()->push($editor);
|
|
||||||
$page->write();
|
|
||||||
|
|
||||||
$this->assertTrue($page->doPublish());
|
|
||||||
$this->assertEquals($page->OwnerNames, "Test Editor", 'Test Editor should be the owner');
|
|
||||||
|
|
||||||
$page = $this->objFromFixture('Page', 'about');
|
|
||||||
$page->ContentReviewOwnerID = 0;
|
|
||||||
$page->write();
|
|
||||||
|
|
||||||
$this->assertTrue($page->doPublish());
|
|
||||||
$this->assertEquals('', $page->OwnerNames);
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,6 +4,27 @@ class SiteTreeContentReviewTest extends FunctionalTest {
|
|||||||
|
|
||||||
public static $fixture_file = 'contentreview/tests/ContentReviewTest.yml';
|
public static $fixture_file = 'contentreview/tests/ContentReviewTest.yml';
|
||||||
|
|
||||||
|
public function testOwnerNames() {
|
||||||
|
$editor = $this->objFromFixture('Member', 'editor');
|
||||||
|
$this->logInAs($editor);
|
||||||
|
|
||||||
|
$page = new Page();
|
||||||
|
$page->ReviewPeriodDays = 10;
|
||||||
|
$page->ContentReviewType ='Custom';
|
||||||
|
$page->ContentReviewUsers()->push($editor);
|
||||||
|
$page->write();
|
||||||
|
|
||||||
|
$this->assertTrue($page->doPublish());
|
||||||
|
$this->assertEquals($page->OwnerNames, "Test Editor", 'Test Editor should be the owner');
|
||||||
|
|
||||||
|
$page = $this->objFromFixture('Page', 'about');
|
||||||
|
$page->OwnerUsers()->removeAll();
|
||||||
|
$page->write();
|
||||||
|
|
||||||
|
$this->assertTrue($page->doPublish());
|
||||||
|
$this->assertEquals('', $page->OwnerNames);
|
||||||
|
}
|
||||||
|
|
||||||
public function testPermissionsExists() {
|
public function testPermissionsExists() {
|
||||||
$perms = singleton('SiteTreeContentReview')->providePermissions();
|
$perms = singleton('SiteTreeContentReview')->providePermissions();
|
||||||
$this->assertTrue(isset($perms['EDIT_CONTENT_REVIEW_FIELDS']));
|
$this->assertTrue(isset($perms['EDIT_CONTENT_REVIEW_FIELDS']));
|
||||||
|
Loading…
Reference in New Issue
Block a user