FIX Simplify JS requirements in SiteTreeContentReview and fix linting errors

This commit is contained in:
Raissa North 2018-01-09 10:11:31 +13:00
parent f64561e1b4
commit e55931f874
3 changed files with 20 additions and 14 deletions

View File

@ -8,30 +8,27 @@ use SilverStripe\ContentReview\Jobs\ContentReviewNotificationJob;
use SilverStripe\ContentReview\Models\ContentReviewLog;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Manifest\ModuleLoader;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\DateField;
use SilverStripe\Forms\DateTimeField;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
use SilverStripe\Forms\HeaderField;
use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\OptionsetField;
use SilverStripe\Forms\ReadonlyField;
use SilverStripe\Forms\HeaderField;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\FieldType\DBDate;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\SS_List;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
@ -332,9 +329,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
return;
}
$module = ModuleLoader::getModule('silverstripe/contentreview');
Requirements::javascript($module->getResource('client/dist/js/contentreview.js')->getRelativePath());
Requirements::javascript('silverstripe/contentreview:client/dist/js/contentreview.js');
// Display read-only version only
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {
$schedule = self::get_schedule();

View File

@ -70,8 +70,9 @@ class ContentReviewNotificationTest extends SapphireTest
$email = $this->findEmail($ToEmail, null, $Subject);
$this->assertNotNull($email, "Email haven't been sent.");
$this->assertContains(
"<h1>$Subject</h1><p>There are $PagesCount pages that are due for review today by you, "
. "$ToFirstName.</p><p>This email was sent to $ToEmail</p>",
"<h1>$Subject</h1>".
"<p>There are $PagesCount pages that are due for review today by you, $ToFirstName.</p>".
"<p>This email was sent to $ToEmail</p>",
$email['HtmlContent']
);
$this->assertContains('Staff', $email['HtmlContent']);

View File

@ -4,6 +4,7 @@ namespace SilverStripe\ContentReview\Tests;
use function date;
use Page;
use PHPUnit_Framework_TestCase;
use SilverStripe\CMS\Controllers\CMSPageEditController;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
@ -117,7 +118,10 @@ class ContentReviewSettingsTest extends SapphireTest
$page->write();
$this->assertEquals(
date('Y-m-d', strtotime("now + " . $siteConfig->ReviewPeriodDays . " days")),
date(
'Y-m-d',
strtotime("now + " . $siteConfig->ReviewPeriodDays . " days")
),
$page->NextReviewDate
);
}
@ -177,7 +181,13 @@ class ContentReviewSettingsTest extends SapphireTest
$page = $this->objFromFixture(Page::class, "inherit");
$this->assertEquals("Inherit", $page->ContentReviewType);
$this->assertEquals($this->objFromFixture(SiteConfig::class, "default")->ID, $page->getOptions()->ID);
$this->assertEquals(
$this->objFromFixture(
SiteConfig::class,
"default"
)->ID,
$page->getOptions()->ID
);
}
public function testGetNextReviewDateFromCustomSettings()