FIX updated traditional array syntax

This commit is contained in:
Franco Springveldt 2017-09-14 10:59:01 +12:00
parent d9d5c01be3
commit e70e051380
23 changed files with 182 additions and 182 deletions

View File

@ -36,11 +36,11 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
$columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setFieldFormatting(
array(
[
'BlogPostsCount' => function ($value, CategorisationObject $item) {
return $item->BlogPosts()->Count();
}
)
]
);
$this->changeColumnOrder();
@ -57,12 +57,12 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
$columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setDisplayFields(
array(
[
'Title' => 'Title',
'BlogPostsCount' => 'Posts',
'MergeAction' => 'MergeAction',
'Actions' => 'Actions'
)
]
);
}
}

View File

@ -9,7 +9,7 @@ class GridFieldFormAction extends GridField_FormAction
/**
* @var array
*/
protected $extraAttributes = array();
protected $extraAttributes = [];
/**
* @param array $attributes

View File

@ -45,7 +45,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
* @param string $parentMethod
* @param string $childMethod
*/
public function __construct($records = array(), $parentType, $parentMethod, $childMethod)
public function __construct($records = [], $parentType, $parentMethod, $childMethod)
{
$this->records = $records;
$this->parentType = $parentType;
@ -70,7 +70,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getColumnsHandled($gridField)
{
return array('MergeAction');
return ['MergeAction'];
}
/**
@ -88,15 +88,15 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
'MergeAction' . $record->ID,
'Move',
'merge',
array(
[
'record' => $record->ID,
'target' => $prefix . '-target-record-' . $record->ID,
)
]
);
$action->setExtraAttributes(array(
$action->setExtraAttributes([
'data-target' => $prefix . '-target-record-' . $record->ID
));
]);
return $dropdown->Field() . $action->Field() . '<a title="Move posts to" class="MergeActionReveal">move posts to</a>';
}
@ -109,7 +109,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getColumnAttributes($gridField, $record, $columnName)
{
return array('class' => 'MergeAction');
return ['class' => 'MergeAction'];
}
/**
@ -117,7 +117,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getColumnMetadata($gridField, $columnName)
{
return array('title' => 'Move posts to');
return ['title' => 'Move posts to'];
}
/**
@ -125,7 +125,7 @@ class GridFieldMergeAction implements GridField_ColumnProvider, GridField_Action
*/
public function getActions($gridField)
{
return array('merge');
return ['merge'];
}
/**

View File

@ -54,9 +54,9 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
*/
public function getActions($gridField)
{
return array(
return [
'add',
);
];
}
/**
@ -94,9 +94,9 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
__CLASS__ . '.AddFail',
'Unable to save {class} to the database.',
'Unable to add the DataObject.',
array(
[
'class' => get_class($obj),
)
]
)
);
}
@ -107,9 +107,9 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
__CLASS__ . '.PermissionFail',
'You don\'t have permission to create a {class}.',
'Unable to add the DataObject.',
array(
[
'class' => get_class($obj)
)
]
)
);
}
@ -198,12 +198,12 @@ class GridFieldAddByDBField implements GridField_ActionProvider, GridField_HTMLP
$addAction->setAttribute('data-icon', 'add');
$addAction->addExtraClass('btn btn-primary');
$forTemplate = new ArrayData(array());
$forTemplate = new ArrayData([]);
$forTemplate->Fields = new ArrayList();
$forTemplate->Fields->push($textField);
$forTemplate->Fields->push($addAction);
return array($this->targetFragment => $forTemplate->renderWith(self::class));
return [$this->targetFragment => $forTemplate->renderWith(self::class)];
}
}

View File

@ -38,9 +38,9 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
__CLASS__ . '.Draft',
'<i class="btn-icon gridfield-icon btn-icon-pencil"></i> Saved as Draft on {date}',
'State for when a post is saved.',
array(
[
'date' => $lastEdited->FormatFromSettings(),
)
]
);
}
@ -54,9 +54,9 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
__CLASS__ . '.Timer',
'<i class="gridfield-icon blog-icon-timer"></i> Publish at {date}',
'State for when a post is published.',
array(
[
'date' => $publishDate->FormatFromSettings(),
)
]
) . $modifiedLabel;
}
@ -64,9 +64,9 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
__CLASS__ . '.Published',
'<i class="btn-icon gridfield-icon btn-icon-accept"></i> Published on {date}',
'State for when a post is published.',
array(
[
'date' => $publishDate->FormatFromSettings(),
)
]
) . $modifiedLabel;
}
}
@ -91,12 +91,12 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
$class = 'gridfield-icon published';
}
return array(
return [
'class' => $class,
);
];
}
}
return array();
return [];
}
}

View File

@ -87,48 +87,48 @@ class Blog extends Page implements PermissionProvider
/**
* @var array
*/
private static $db = array(
private static $db = [
'PostsPerPage' => 'Int',
);
];
/**
* @var array
*/
private static $has_many = array(
private static $has_many = [
'Tags' => BlogTag::class,
'Categories' => BlogCategory::class,
);
];
/**
* @var array
*/
private static $many_many = array(
private static $many_many = [
'Editors' => Member::class,
'Writers' => Member::class,
'Contributors' => Member::class,
);
];
/**
* @var array
*/
private static $allowed_children = array(
private static $allowed_children = [
BlogPost::class,
);
];
/**
* @var array
*/
private static $extensions = array(
private static $extensions = [
BlogFilter::class,
);
];
/**
* @var array
*/
private static $defaults = array(
private static $defaults = [
'ProvideComments' => false,
'PostsPerPage' => 10
);
];
/**
* @var string
@ -182,10 +182,10 @@ class Blog extends Page implements PermissionProvider
*/
$fields->addFieldsToTab(
'Root.Categorisation',
array(
[
$categories,
$tags
)
]
);
$fields->findOrMakeTab('Root.Categorisation')->addExtraClass('blog-cms-categorisation');
@ -408,11 +408,11 @@ class Blog extends Page implements PermissionProvider
$fields->addFieldsToTab(
'Root.Users',
array(
[
$editorField,
$writerField,
$contributorField
)
]
);
return $fields;
@ -606,8 +606,8 @@ class Blog extends Page implements PermissionProvider
*/
public function providePermissions()
{
return array(
Blog::MANAGE_USERS => array(
return [
Blog::MANAGE_USERS => [
'name' => _t(
__CLASS__ . '.PERMISSION_MANAGE_USERS_DESCRIPTION',
'Manage users for individual blogs'
@ -618,8 +618,8 @@ class Blog extends Page implements PermissionProvider
),
'category' => _t(__CLASS__ . '.PERMISSIONS_CATEGORY', 'Blog permissions'),
'sort' => 100
)
);
]
];
}
/**
@ -644,7 +644,7 @@ class Blog extends Page implements PermissionProvider
// Must check if the method exists or else an error occurs when changing page type
if ($this->hasMethod('Editors')) {
foreach (array($this->Editors(), $this->Writers(), $this->Contributors()) as $levels) {
foreach ([$this->Editors(), $this->Writers(), $this->Contributors()] as $levels) {
foreach ($levels as $user) {
if (!$user->inGroup($group)) {
$user->Groups()->add($group);

View File

@ -40,24 +40,24 @@ class BlogCategory extends DataObject implements CategorisationObject
/**
* @var array
*/
private static $db = array(
private static $db = [
'Title' => 'Varchar(255)',
'URLSegment' => 'Varchar(255)'
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'Blog' => Blog::class,
);
];
/**
* @var array
*/
private static $belongs_many_many = array(
private static $belongs_many_many = [
'BlogPosts' => BlogPost::class,
);
];
/**
* {@inheritdoc}

View File

@ -14,31 +14,31 @@ class BlogController extends PageController
/**
* @var array
*/
private static $allowed_actions = array(
private static $allowed_actions = [
'archive',
'tag',
'category',
'rss',
'profile'
);
];
/**
* @var array
*/
private static $url_handlers = array(
private static $url_handlers = [
'tag/$Tag!/$Rss' => 'tag',
'category/$Category!/$Rss' => 'category',
'archive/$Year!/$Month/$Day' => 'archive',
'profile/$URLSegment!' => 'profile'
);
];
/**
* @var array
*/
private static $casting = array(
private static $casting = [
'MetaTitle' => 'Text',
'FilterDescription' => 'Text'
);
];
/**
* The current Blog Post DataList query.
@ -243,7 +243,7 @@ class BlogController extends PageController
$tag = $this->request->param('Tag');
if ($tag) {
return $dataRecord->Tags()
->filter('URLSegment', array($tag, rawurlencode($tag)))
->filter('URLSegment', [$tag, rawurlencode($tag)])
->first();
}
return null;
@ -287,7 +287,7 @@ class BlogController extends PageController
$category = $this->request->param('Category');
if ($category) {
return $dataRecord->Categories()
->filter('URLSegment', array($category, rawurlencode($category)))
->filter('URLSegment', [$category, rawurlencode($category)])
->first();
}
return null;
@ -319,7 +319,7 @@ class BlogController extends PageController
*/
public function getFilterDescription()
{
$items = array();
$items = [];
$list = $this->PaginatedList();
$currentPage = $list->CurrentPage();
@ -329,9 +329,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_PAGE',
'Page {page}',
null,
array(
[
'page' => $currentPage
)
]
);
}
@ -340,9 +340,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_AUTHOR',
'By {author}',
null,
array(
[
'author' => $author->Title
)
]
);
}
@ -351,9 +351,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_TAG',
'Tagged with {tag}',
null,
array(
[
'tag' => $tag->Title
)
]
);
}
@ -362,9 +362,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_CATEGORY',
'In category {category}',
null,
array(
[
'category' => $category->Title
)
]
);
}
@ -381,9 +381,9 @@ class BlogController extends PageController
'SilverStripe\\Blog\\Model\\Blog.FILTERDESCRIPTION_DATE',
'In {date}',
null,
array(
[
'date' => $date,
)
]
);
}

View File

@ -96,10 +96,10 @@ class BlogFilter extends Lumberjack
$excluded = $this->owner->getExcludedSiteTreeClassNames();
if (!empty($excluded)) {
$pages = BlogPost::get()->filter(array(
$pages = BlogPost::get()->filter([
'ParentID' => $this->owner->ID,
'ClassName' => $excluded
));
]);
$gridField = BlogFilterGridField::create(
'ChildPages',

View File

@ -23,24 +23,24 @@ class BlogMemberExtension extends DataExtension
/**
* @var array
*/
private static $db = array(
private static $db = [
'URLSegment' => 'Varchar',
'BlogProfileSummary' => 'Text'
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'BlogProfileImage' => Image::class
);
];
/**
* @var array
*/
private static $belongs_many_many = array(
private static $belongs_many_many = [
'BlogPosts' => BlogPost::class
);
];
/**
* {@inheritdoc}

View File

@ -108,7 +108,7 @@ trait BlogObject
/**
* {@inheritdoc}
*/
public function canCreate($member = null, $context = array())
public function canCreate($member = null, $context = [])
{
$extended = $this->extendedCan(__FUNCTION__, $member);

View File

@ -58,77 +58,77 @@ class BlogPost extends Page
/**
* @var array
*/
private static $db = array(
private static $db = [
'PublishDate' => 'Datetime',
'AuthorNames' => 'Varchar(1024)',
'Summary' => 'HTMLText'
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'FeaturedImage' => Image::class
);
];
/**
* @var array
*/
private static $owns = array(
private static $owns = [
'FeaturedImage',
);
];
/**
* @var array
*/
private static $many_many = array(
private static $many_many = [
'Categories' => BlogCategory::class,
'Tags' => BlogTag::class,
'Authors' => Member::class
);
];
/**
* @var array
*/
private static $defaults = array(
private static $defaults = [
'ShowInMenus' => false,
'InheritSideBar' => true,
'ProvideComments' => true
);
];
/**
* @var array
*/
private static $extensions = array(
private static $extensions = [
BlogPostFilter::class
);
];
/**
* @var array
*/
private static $searchable_fields = array(
private static $searchable_fields = [
'Title'
);
];
/**
* @var array
*/
private static $summary_fields = array(
private static $summary_fields = [
'Title'
);
];
/**
* @var array
*/
private static $casting = array(
private static $casting = [
'Excerpt' => 'HTMLText',
'Date' => 'DBDatetime'
);
];
/**
* @var array
*/
private static $allowed_children = array();
private static $allowed_children = [];
/**
* The default sorting lists BlogPosts with an empty PublishDate at the top.
@ -215,7 +215,7 @@ class BlogPost extends Page
$this->beforeUpdateCMSFields(function ($fields) {
$uploadField = UploadField::create('FeaturedImage', _t(__CLASS__ . '.FeaturedImage', 'Featured Image'));
$uploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$uploadField->getValidator()->setAllowedExtensions(['jpg', 'jpeg', 'png', 'gif']);
/**
* @var FieldList $fields
@ -232,9 +232,9 @@ class BlogPost extends Page
$summaryHolder = ToggleCompositeField::create(
'CustomSummary',
_t(__CLASS__ . '.CUSTOMSUMMARY', 'Add A Custom Summary'),
array(
[
$summary,
)
]
);
$summaryHolder->setHeadingLevel(4);
$summaryHolder->addExtraClass('custom-summary');
@ -244,10 +244,10 @@ class BlogPost extends Page
$urlSegment = $fields->dataFieldByName('URLSegment');
$urlSegment->setURLPrefix($this->Parent()->RelativeLink());
$fields->removeFieldsFromTab('Root.Main', array(
$fields->removeFieldsFromTab('Root.Main', [
'MenuTitle',
'URLSegment',
));
]);
$authorField = ListboxField::create(
'Authors',
@ -681,9 +681,9 @@ class BlogPost extends Page
$items = new ArrayList();
foreach ($this->Authors() as $author) {
// Add link for each author
$author = $author->customise(array(
$author = $author->customise([
'URL' => $parent->ProfileLink($author->URLSegment),
));
]);
$items->push($author);
}
@ -702,9 +702,9 @@ class BlogPost extends Page
$authors = array_filter(preg_split('/\s*,\s*/', $this->AuthorNames));
foreach ($authors as $author) {
$item = new ArrayData(array(
$item = new ArrayData([
'Name' => $author,
));
]);
$items->push($item);
}

View File

@ -30,7 +30,7 @@ class BlogPostNotifications extends DataExtension
// If comment is spam and notification are set to not send on spam clear the recipient list
if (Config::inst()->get(__CLASS__, 'notification_on_spam') == false && $comment->IsSpam) {
$list = array();
$list = [];
}
}

View File

@ -40,24 +40,24 @@ class BlogTag extends DataObject implements CategorisationObject
/**
* @var array
*/
private static $db = array(
private static $db = [
'Title' => 'Varchar(255)',
'URLSegment' => 'Varchar(255)'
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'Blog' => Blog::class
);
];
/**
* @var array
*/
private static $belongs_many_many = array(
private static $belongs_many_many = [
'BlogPosts' => BlogPost::class
);
];
/**
* {@inheritdoc}

View File

@ -38,24 +38,24 @@ class BlogArchiveWidget extends Widget
/**
* @var array
*/
private static $db = array(
private static $db = [
'NumberToDisplay' => 'Int',
'ArchiveType' => 'Enum(\'Monthly,Yearly\', \'Monthly\')',
);
];
/**
* @var array
*/
private static $defaults = array(
private static $defaults = [
'NumberOfMonths' => 12,
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'Blog' => Blog::class,
);
];
/**
* {@inheritdoc}
@ -77,7 +77,7 @@ class BlogArchiveWidget extends Widget
/**
* @var FieldList $fields
*/
$fields->merge(array(
$fields->merge([
DropdownField::create(
'BlogID',
_t(__CLASS__ . '.Blog', 'Blog'),
@ -85,7 +85,7 @@ class BlogArchiveWidget extends Widget
),
DropdownField::create('ArchiveType', _t(__CLASS__ . '.ArchiveType', 'ArchiveType'), $type),
NumericField::create('NumberToDisplay', _t(__CLASS__ . '.NumberToDisplay', 'No. to Display'))
));
]);
});
return parent::getCMSFields();
@ -132,10 +132,10 @@ class BlogArchiveWidget extends Widget
$title = $date->FormatI18N("%B %Y");
}
$archive->push(new ArrayData(array(
$archive->push(new ArrayData([
'Title' => $title,
'Link' => Controller::join_links($this->Blog()->Link('archive'), $year, $month)
)));
]));
}
}

View File

@ -37,18 +37,18 @@ class BlogCategoriesWidget extends Widget
/**
* @var array
*/
private static $db = array(
private static $db = [
'Limit' => 'Int',
'Order' => 'Varchar',
'Direction' => 'Varchar',
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'Blog' => Blog::class,
);
];
/**
* {@inheritdoc}
@ -78,7 +78,7 @@ class BlogCategoriesWidget extends Widget
$fields[] = DropdownField::create(
'Order',
_t(__CLASS__ . '.Sort', 'Sort'),
array('Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated')
['Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated']
)
->setDescription(
_t(__CLASS__ . '.Sort_Description', 'Change the order of categories shown by this widget.')
@ -87,7 +87,7 @@ class BlogCategoriesWidget extends Widget
$fields[] = DropdownField::create(
'Direction',
_t(__CLASS__ . '.Direction', 'Direction'),
array('ASC' => 'Ascending', 'DESC' => 'Descending')
['ASC' => 'Ascending', 'DESC' => 'Descending']
)
->setDescription(
_t(
@ -108,7 +108,7 @@ class BlogCategoriesWidget extends Widget
$blog = $this->Blog();
if (!$blog) {
return array();
return [];
}
$query = $blog->Categories();

View File

@ -36,16 +36,16 @@ class BlogRecentPostsWidget extends Widget
/**
* @var array
*/
private static $db = array(
private static $db = [
'NumberOfPosts' => 'Int',
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'Blog' => Blog::class,
);
];
/**
* {@inheritdoc}
@ -56,10 +56,10 @@ class BlogRecentPostsWidget extends Widget
/**
* @var FieldList $fields
*/
$fields->merge(array(
$fields->merge([
DropdownField::create('BlogID', _t(__CLASS__ . '.Blog', 'Blog'), Blog::get()->map()),
NumericField::create('NumberOfPosts', _t(__CLASS__ . '.NumberOfPosts', 'Number of Posts'))
));
]);
});
return parent::getCMSFields();
@ -78,6 +78,6 @@ class BlogRecentPostsWidget extends Widget
->limit($this->NumberOfPosts);
}
return array();
return [];
}
}

View File

@ -37,14 +37,14 @@ class BlogTagsCloudWidget extends Widget
/**
* @var array
*/
private static $db = array();
private static $db = [];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'Blog' => Blog::class,
);
];
/**
* {@inheritdoc}
@ -115,6 +115,6 @@ class BlogTagsCloudWidget extends Widget
return $tags;
}
return array();
return [];
}
}

View File

@ -36,18 +36,18 @@ class BlogTagsWidget extends Widget
/**
* @var array
*/
private static $db = array(
private static $db = [
'Limit' => 'Int',
'Order' => 'Varchar',
'Direction' => 'Varchar',
);
];
/**
* @var array
*/
private static $has_one = array(
private static $has_one = [
'Blog' => Blog::class
);
];
/**
* {@inheritdoc}
@ -77,7 +77,7 @@ class BlogTagsWidget extends Widget
$fields[] = DropdownField::create(
'Order',
_t(__CLASS__ . '.Sort', 'Sort'),
array('Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated')
['Title' => 'Title', 'Created' => 'Created', 'LastEdited' => 'Updated']
)
->setDescription(
_t(__CLASS__ . '.Sort_Description', 'Change the order of tags shown by this widget.')
@ -86,7 +86,7 @@ class BlogTagsWidget extends Widget
$fields[] = DropdownField::create(
'Direction',
_t(__CLASS__ . '.Direction', 'Direction'),
array('ASC' => 'Ascending', 'DESC' => 'Descending')
['ASC' => 'Ascending', 'DESC' => 'Descending']
)
->setDescription(
_t(
@ -107,7 +107,7 @@ class BlogTagsWidget extends Widget
$blog = $this->Blog();
if (!$blog) {
return array();
return [];
}
$query = $blog->Tags();

View File

@ -27,14 +27,14 @@ class BlogPostNotificationsTest extends SapphireTest
$comment
)->toArray();
$segments = array();
$segments = [];
foreach ($recipients as $recipient) {
array_push($segments, $recipient->URLSegment);
}
sort($segments);
$this->assertEquals(
array('blog-contributor', 'blog-editor', 'blog-writer'),
['blog-contributor', 'blog-editor', 'blog-writer'],
$segments
);
}

View File

@ -43,33 +43,33 @@ class BlogPostTest extends SapphireTest
{
$someFutureDate = '2013-10-10 20:00:00';
$somePastDate = '2009-10-10 20:00:00';
return array(
return [
// Check this post given the date has passed
array($someFutureDate, 'Editor', 'PostA', true),
array($someFutureDate, 'Contributor', 'PostA', true),
array($someFutureDate, 'BlogEditor', 'PostA', true),
array($someFutureDate, 'Writer', 'PostA', true),
[$someFutureDate, 'Editor', 'PostA', true],
[$someFutureDate, 'Contributor', 'PostA', true],
[$someFutureDate, 'BlogEditor', 'PostA', true],
[$someFutureDate, 'Writer', 'PostA', true],
// Check unpublished pages
array($somePastDate, 'Editor', 'PostA', true),
array($somePastDate, 'Contributor', 'PostA', true),
array($somePastDate, 'BlogEditor', 'PostA', true),
array($somePastDate, 'Writer', 'PostA', true),
[$somePastDate, 'Editor', 'PostA', true],
[$somePastDate, 'Contributor', 'PostA', true],
[$somePastDate, 'BlogEditor', 'PostA', true],
[$somePastDate, 'Writer', 'PostA', true],
// Test a page that was authored by another user
// Check this post given the date has passed
array($someFutureDate, 'Editor', 'FirstBlogPost', true),
array($someFutureDate, 'Contributor', 'FirstBlogPost', true),
array($someFutureDate, 'BlogEditor', 'FirstBlogPost', true),
array($someFutureDate, 'Writer', 'FirstBlogPost', true),
[$someFutureDate, 'Editor', 'FirstBlogPost', true],
[$someFutureDate, 'Contributor', 'FirstBlogPost', true],
[$someFutureDate, 'BlogEditor', 'FirstBlogPost', true],
[$someFutureDate, 'Writer', 'FirstBlogPost', true],
// Check future pages - non-editors shouldn't be able to see this
array($somePastDate, 'Editor', 'FirstBlogPost', true),
array($somePastDate, 'Contributor', 'FirstBlogPost', false),
array($somePastDate, 'BlogEditor', 'FirstBlogPost', false),
array($somePastDate, 'Writer', 'FirstBlogPost', false),
);
[$somePastDate, 'Editor', 'FirstBlogPost', true],
[$somePastDate, 'Contributor', 'FirstBlogPost', false],
[$somePastDate, 'BlogEditor', 'FirstBlogPost', false],
[$somePastDate, 'Writer', 'FirstBlogPost', false],
];
}
public function testCandidateAuthors()

View File

@ -23,12 +23,12 @@ class BlogTagsCloudWidgetTest extends SapphireTest
$widget = new BlogTagsCloudWidget();
$fields = $widget->getCMSFields();
$names = array();
$names = [];
foreach ($fields as $field) {
array_push($names, $field->getName());
}
$expected = array('Title', 'Enabled', 'BlogID');
$expected = ['Title', 'Enabled', 'BlogID'];
$this->assertEquals($expected, $names);
}

View File

@ -325,7 +325,7 @@ class BlogTest extends SapphireTest
// Request first tag
$this->requestURL($controller, 'first-post/tag/first-tag');
$this->assertIDsEquals(
array($firstPostID, $firstFuturePostID, $secondFuturePostID),
[$firstPostID, $firstFuturePostID, $secondFuturePostID],
$controller->PaginatedList()
);
}
@ -343,7 +343,7 @@ class BlogTest extends SapphireTest
// Request 2013 posts
$this->requestURL($controller, 'first-post/archive/2013');
$this->assertIDsEquals(
array($firstPostID, $secondPostID, $secondFuturePostID),
[$firstPostID, $secondPostID, $secondFuturePostID],
$controller->PaginatedList()
);
}