API: silverstripe-upgrader run for ss4 compatibility.

This commit is contained in:
Sam Minnee 2016-09-10 11:39:25 +12:00
parent 033a7bb96f
commit 377a8cdc7c
31 changed files with 230 additions and 52 deletions

View File

@ -1,4 +1,6 @@
<?php <?php
use SilverStripe\Control\Director;
/** /**
* Fetches the name of the current module folder name. * Fetches the name of the current module folder name.

View File

@ -1,5 +1,7 @@
<?php <?php
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
{ {
/** /**
@ -13,7 +15,7 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
{ {
parent::__construct($itemsPerPage); parent::__construct($itemsPerPage);
$this->removeComponentsByType('GridFieldAddNewButton'); $this->removeComponentsByType('SilverStripe\\Forms\\GridField\\GridFieldAddNewButton');
$this->addComponent( $this->addComponent(
new GridFieldAddByDBField('buttons-before-left') new GridFieldAddByDBField('buttons-before-left')
@ -26,7 +28,7 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
/** /**
* @var GridFieldDataColumns $columns * @var GridFieldDataColumns $columns
*/ */
$columns = $this->getComponentByType('GridFieldDataColumns'); $columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setFieldFormatting(array( $columns->setFieldFormatting(array(
'BlogPostsCount' => function ($value, CategorisationObject $item) { 'BlogPostsCount' => function ($value, CategorisationObject $item) {
@ -45,7 +47,7 @@ class GridFieldCategorisationConfig extends GridFieldConfig_RecordEditor
/** /**
* @var GridFieldDataColumns $columns * @var GridFieldDataColumns $columns
*/ */
$columns = $this->getComponentByType('GridFieldDataColumns'); $columns = $this->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
$columns->setDisplayFields(array( $columns->setDisplayFields(array(
'Title' => 'Title', 'Title' => 'Title',

View File

@ -1,5 +1,7 @@
<?php <?php
use SilverStripe\Forms\GridField\GridField_FormAction;
class GridFieldFormAction extends GridField_FormAction class GridFieldFormAction extends GridField_FormAction
{ {
/** /**

View File

@ -1,5 +1,11 @@
<?php <?php
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Control\Controller;
use SilverStripe\Forms\GridField\GridField_ColumnProvider;
use SilverStripe\Forms\GridField\GridField_ActionProvider;
class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider class GridFieldMergeAction implements GridField_ColumnProvider, GridField_ActionProvider
{ {
/** /**

View File

@ -22,7 +22,7 @@ class BlogHolder extends BlogTree implements MigratableObject
* @var array * @var array
*/ */
private static $has_one = array( private static $has_one = array(
'Owner' => 'Member', 'Owner' => 'SilverStripe\\Security\\Member',
); );
/** /**

View File

@ -1,5 +1,12 @@
<?php <?php
use SilverStripe\Core\ClassInfo;
use SilverStripe\Control\Controller;
use SilverStripe\ORM\DatabaseAdmin;
use SilverStripe\ORM\DB;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Dev\MigrationTask;
class BlogMigrationTask extends MigrationTask class BlogMigrationTask extends MigrationTask
{ {
/** /**
@ -49,7 +56,7 @@ class BlogMigrationTask extends MigrationTask
return; return;
} }
if (is_subclass_of($class, 'SiteTree')) { if (is_subclass_of($class, 'SilverStripe\\CMS\\Model\\SiteTree')) {
$items = SiteTree::get()->filter('ClassName', $class); $items = SiteTree::get()->filter('ClassName', $class);
} else { } else {
$items = $class::get(); $items = $class::get();

View File

@ -1,5 +1,7 @@
<?php <?php
use SilverStripe\ORM\DataExtension;
/** /**
* Adds Blog specific behaviour to Comment. * Adds Blog specific behaviour to Comment.
*/ */

View File

@ -1,5 +1,15 @@
<?php <?php
use SilverStripe\Security\Permission;
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Core\Convert;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\FormTransformation;
use SilverStripe\Forms\GridField\GridField;
/** /**
* This class is responsible for filtering the SiteTree when necessary and also overlaps into * This class is responsible for filtering the SiteTree when necessary and also overlaps into
* filtering only published posts. * filtering only published posts.
@ -27,7 +37,7 @@ class BlogFilter extends Lumberjack
$dataQuery = $staged->dataQuery() $dataQuery = $staged->dataQuery()
->innerJoin('BlogPost', sprintf('"BlogPost%s"."ID" = "SiteTree%s"."ID"', $stage, $stage)) ->innerJoin('BlogPost', sprintf('"BlogPost%s"."ID" = "SiteTree%s"."ID"', $stage, $stage))
->where(sprintf('"PublishDate" < \'%s\'', Convert::raw2sql(SS_Datetime::now()))); ->where(sprintf('"PublishDate" < \'%s\'', Convert::raw2sql(DBDatetime::now())));
$staged = $staged->setDataQuery($dataQuery); $staged = $staged->setDataQuery($dataQuery);
} }
@ -53,7 +63,7 @@ class BlogFilter extends Lumberjack
if (!$this->shouldFilter() && $this->isBlog() && !Permission::check('VIEW_DRAFT_CONTENT')) { if (!$this->shouldFilter() && $this->isBlog() && !Permission::check('VIEW_DRAFT_CONTENT')) {
$dataQuery = $staged->dataQuery() $dataQuery = $staged->dataQuery()
->innerJoin('BlogPost', '"BlogPost_Live"."ID" = "SiteTree_Live"."ID"') ->innerJoin('BlogPost', '"BlogPost_Live"."ID" = "SiteTree_Live"."ID"')
->where(sprintf('"PublishDate" < \'%s\'', Convert::raw2sql(SS_Datetime::now()))); ->where(sprintf('"PublishDate" < \'%s\'', Convert::raw2sql(DBDatetime::now())));
$staged = $staged->setDataQuery($dataQuery); $staged = $staged->setDataQuery($dataQuery);
} }

View File

@ -1,5 +1,13 @@
<?php <?php
use SilverStripe\View\Parsers\URLSegmentFilter;
use SilverStripe\Security\Member;
use SilverStripe\Forms\FieldList;
use SilverStripe\View\Requirements;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\ORM\DataExtension;
/** /**
* This class is responsible for add Blog specific behaviour to Members. * This class is responsible for add Blog specific behaviour to Members.
* *
@ -20,7 +28,7 @@ class BlogMemberExtension extends DataExtension
* @var array * @var array
*/ */
private static $has_one = array( private static $has_one = array(
'BlogProfileImage' => 'Image', 'BlogProfileImage' => 'SilverStripe\\Assets\\Image',
); );
/** /**

View File

@ -1,5 +1,13 @@
<?php <?php
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\Control\Controller;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Security\Permission;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Core\Convert;
use SilverStripe\ORM\DataExtension;
/** /**
* This is responsible for filtering only published posts to users who do not have permission to * This is responsible for filtering only published posts to users who do not have permission to
* view non-published posts. * view non-published posts.
@ -23,7 +31,7 @@ class BlogPostFilter extends DataExtension
} }
if ($stage == 'Live' || !Permission::check('VIEW_DRAFT_CONTENT')) { if ($stage == 'Live' || !Permission::check('VIEW_DRAFT_CONTENT')) {
$query->addWhere(sprintf('"PublishDate" < \'%s\'', Convert::raw2sql(SS_Datetime::now()))); $query->addWhere(sprintf('"PublishDate" < \'%s\'', Convert::raw2sql(DBDatetime::now())));
} }
} }

View File

@ -1,5 +1,7 @@
<?php <?php
use SilverStripe\ORM\DataExtension;
/** /**
* Customise blog post to support comment notifications. * Customise blog post to support comment notifications.
* *

View File

@ -1,5 +1,9 @@
<?php <?php
use SilverStripe\View\Parsers\URLSegmentFilter;
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataExtension;
/** /**
* Adds URLSegment functionality to Tags & Categories. * Adds URLSegment functionality to Tags & Categories.
* *

View File

@ -1,5 +1,8 @@
<?php <?php
use SilverStripe\Control\Cookie;
use SilverStripe\Forms\FieldGroup;
class BlogAdminSidebar extends FieldGroup class BlogAdminSidebar extends FieldGroup
{ {
/** /**

View File

@ -1,5 +1,17 @@
<?php <?php
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Control\Controller;
use SilverStripe\Security\Security;
use SilverStripe\View\Requirements;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\GridField\GridField_FormAction;
use SilverStripe\View\ArrayData;
use SilverStripe\ORM\ArrayList;
use SilverStripe\Forms\GridField\GridField_ActionProvider;
use SilverStripe\Forms\GridField\GridField_HTMLProvider;
/** /**
* Adds a component which allows a user to add a new DataObject by database field. * Adds a component which allows a user to add a new DataObject by database field.
* *

View File

@ -1,5 +1,7 @@
<?php <?php
use SilverStripe\View\Requirements;
/** /**
* Provides a component to the {@link GridField} which tells the user whether or not a blog post * Provides a component to the {@link GridField} which tells the user whether or not a blog post
* has been published and when. * has been published and when.

View File

@ -1,5 +1,24 @@
<?php <?php
use SilverStripe\View\Requirements;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Security\Member;
use SilverStripe\ORM\UnsavedRelationList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Forms\NumericField;
use SilverStripe\Forms\ListboxField;
use SilverStripe\Security\Permission;
use SilverStripe\ORM\DB;
use SilverStripe\Core\Convert;
use SilverStripe\Control\Controller;
use SilverStripe\Security\Group;
use SilverStripe\Security\PermissionProvider;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\PaginatedList;
use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\Control\RSS\RSSFeed;
/** /**
* Blog Holder * Blog Holder
* *
@ -69,9 +88,9 @@ class Blog extends Page implements PermissionProvider
* @var array * @var array
*/ */
private static $many_many = array( private static $many_many = array(
'Editors' => 'Member', 'Editors' => 'SilverStripe\\Security\\Member',
'Writers' => 'Member', 'Writers' => 'SilverStripe\\Security\\Member',
'Contributors' => 'Member', 'Contributors' => 'SilverStripe\\Security\\Member',
); );
/** /**
@ -228,7 +247,7 @@ class Blog extends Page implements PermissionProvider
public function RoleOf($member) public function RoleOf($member)
{ {
if (is_numeric($member)) { if (is_numeric($member)) {
$member = DataObject::get_by_id('Member', $member); $member = DataObject::get_by_id('SilverStripe\\Security\\Member', $member);
} }
if (!$member) { if (!$member) {
@ -779,7 +798,7 @@ class Blog_Controller extends Page_Controller
return (int) $year; return (int) $year;
} }
} elseif ($this->request->param('Action') == 'archive') { } elseif ($this->request->param('Action') == 'archive') {
return SS_Datetime::now()->Year(); return DBDatetime::now()->Year();
} }
return null; return null;

View File

@ -1,5 +1,11 @@
<?php <?php
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Control\Controller;
use SilverStripe\Security\Permission;
use SilverStripe\ORM\DataObject;
/** /**
* A blog category for generalising blog posts. * A blog category for generalising blog posts.
* *

View File

@ -1,5 +1,21 @@
<?php <?php
use SilverStripe\ORM\UnsavedRelationList;
use SilverStripe\View\Requirements;
use SilverStripe\Forms\UploadField;
use SilverStripe\Forms\ToggleCompositeField;
use SilverStripe\Forms\HiddenField;
use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\DatetimeField;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Control\Controller;
use SilverStripe\ORM\ArrayList;
use SilverStripe\View\ArrayData;
/** /**
* An individual blog post. * An individual blog post.
* *
@ -37,7 +53,7 @@ class BlogPost extends Page
* @var array * @var array
*/ */
private static $has_one = array( private static $has_one = array(
'FeaturedImage' => 'Image', 'FeaturedImage' => 'SilverStripe\\Assets\\Image',
); );
/** /**
@ -46,7 +62,7 @@ class BlogPost extends Page
private static $many_many = array( private static $many_many = array(
'Categories' => 'BlogCategory', 'Categories' => 'BlogCategory',
'Tags' => 'BlogTag', 'Tags' => 'BlogTag',
'Authors' => 'Member', 'Authors' => 'SilverStripe\\Security\\Member',
); );
/** /**
@ -419,7 +435,7 @@ class BlogPost extends Page
$publishDate = $this->dbObject('PublishDate'); $publishDate = $this->dbObject('PublishDate');
if (!$publishDate->getValue()) { if (!$publishDate->getValue()) {
$this->PublishDate = SS_Datetime::now()->getValue(); $this->PublishDate = DBDatetime::now()->getValue();
$this->write(); $this->write();
} }
} }

View File

@ -1,5 +1,11 @@
<?php <?php
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Control\Controller;
use SilverStripe\Security\Permission;
use SilverStripe\ORM\DataObject;
/** /**
* A blog tag for keyword descriptions of a blog post. * A blog tag for keyword descriptions of a blog post.
* *

View File

@ -1,5 +1,11 @@
<?php <?php
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\NumericField;
use SilverStripe\ORM\ArrayList;
use SilverStripe\Control\Controller;
use SilverStripe\View\ArrayData;
if (!class_exists('Widget')) { if (!class_exists('Widget')) {
return; return;
} }

View File

@ -1,5 +1,10 @@
<?php <?php
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\NumericField;
use SilverStripe\Core\Convert;
if (!class_exists("Widget")) { if (!class_exists("Widget")) {
return; return;
} }

View File

@ -1,5 +1,8 @@
<?php <?php
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\NumericField;
if (!class_exists("Widget")) { if (!class_exists("Widget")) {
return; return;
} }

View File

@ -1,5 +1,11 @@
<?php <?php
use SilverStripe\Forms\DropdownField;
use SilverStripe\Core\Convert;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
if (!class_exists('Widget')) { if (!class_exists('Widget')) {
return; return;
} }

View File

@ -1,5 +1,9 @@
<?php <?php
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\NumericField;
use SilverStripe\Core\Convert;
if (!class_exists("Widget")) { if (!class_exists("Widget")) {
return; return;
} }

View File

@ -1,5 +1,11 @@
<?php <?php
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\Member;
use SilverStripe\Control\Controller;
use SilverStripe\ORM\ValidationException;
use SilverStripe\Dev\FunctionalTest;
/** /**
* @mixin PHPUnit_Framework_TestCase * @mixin PHPUnit_Framework_TestCase
*/ */
@ -17,7 +23,7 @@ class BlogCategoryTest extends FunctionalTest
{ {
parent::setUp(); parent::setUp();
SS_Datetime::set_mock_now('2013-10-10 20:00:00'); DBDatetime::set_mock_now('2013-10-10 20:00:00');
} }
/** /**
@ -25,7 +31,7 @@ class BlogCategoryTest extends FunctionalTest
*/ */
public function tearDown() public function tearDown()
{ {
SS_Datetime::clear_mock_now(); DBDatetime::clear_mock_now();
parent::tearDown(); parent::tearDown();
} }
@ -72,9 +78,9 @@ class BlogCategoryTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$this->objFromFixture('Member', 'Admin'); $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$category = $this->objFromFixture('BlogCategory', 'SecondCategory'); $category = $this->objFromFixture('BlogCategory', 'SecondCategory');
$this->assertFalse($category->canView($editor), 'Editor should not be able to view category.'); $this->assertFalse($category->canView($editor), 'Editor should not be able to view category.');
@ -87,8 +93,8 @@ class BlogCategoryTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$admin = $this->objFromFixture('Member', 'Admin'); $admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$category = $this->objFromFixture('BlogCategory', 'FirstCategory'); $category = $this->objFromFixture('BlogCategory', 'FirstCategory');
@ -110,8 +116,8 @@ class BlogCategoryTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$admin = $this->objFromFixture('Member', 'Admin'); $admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$category = singleton('BlogCategory'); $category = singleton('BlogCategory');
@ -123,8 +129,8 @@ class BlogCategoryTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$admin = $this->objFromFixture('Member', 'Admin'); $admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$category = $this->objFromFixture('BlogCategory', 'FirstCategory'); $category = $this->objFromFixture('BlogCategory', 'FirstCategory');

View File

@ -1,5 +1,9 @@
<?php <?php
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\Member;
use SilverStripe\Dev\SapphireTest;
/** /**
* @mixin PHPUnit_Framework_TestCase * @mixin PHPUnit_Framework_TestCase
*/ */
@ -14,12 +18,12 @@ class BlogPostFilterTest extends SapphireTest
{ {
parent::setUp(); parent::setUp();
SS_Datetime::set_mock_now('2013-10-10 20:00:00'); DBDatetime::set_mock_now('2013-10-10 20:00:00');
} }
public function tearDown() public function tearDown()
{ {
SS_Datetime::clear_mock_now(); DBDatetime::clear_mock_now();
parent::tearDown(); parent::tearDown();
} }
@ -39,7 +43,7 @@ class BlogPostFilterTest extends SapphireTest
$this->assertEquals(3, $blog->AllChildren()->Count(), 'Filtered blog posts'); $this->assertEquals(3, $blog->AllChildren()->Count(), 'Filtered blog posts');
SS_Datetime::set_mock_now('2020-01-01 00:00:00'); DBDatetime::set_mock_now('2020-01-01 00:00:00');
$this->assertEquals(5, $blog->AllChildren()->Count(), 'Unfiltered blog posts'); $this->assertEquals(5, $blog->AllChildren()->Count(), 'Unfiltered blog posts');
} }

View File

@ -1,5 +1,7 @@
<?php <?php
use SilverStripe\Dev\SapphireTest;
class BlogPostNotificationsTest extends SapphireTest class BlogPostNotificationsTest extends SapphireTest
{ {
/** /**

View File

@ -1,5 +1,9 @@
<?php <?php
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest;
class BlogPostTest extends SapphireTest class BlogPostTest extends SapphireTest
{ {
/** /**
@ -20,7 +24,7 @@ class BlogPostTest extends SapphireTest
*/ */
public function tearDown() public function tearDown()
{ {
SS_Datetime::clear_mock_now(); DBDatetime::clear_mock_now();
parent::tearDown(); parent::tearDown();
} }
@ -29,9 +33,9 @@ class BlogPostTest extends SapphireTest
*/ */
public function testCanView($date, $user, $page, $canView) public function testCanView($date, $user, $page, $canView)
{ {
$userRecord = $this->objFromFixture('Member', $user); $userRecord = $this->objFromFixture('SilverStripe\\Security\\Member', $user);
$pageRecord = $this->objFromFixture('BlogPost', $page); $pageRecord = $this->objFromFixture('BlogPost', $page);
SS_Datetime::set_mock_now($date); DBDatetime::set_mock_now($date);
$this->assertEquals($canView, $pageRecord->canView($userRecord)); $this->assertEquals($canView, $pageRecord->canView($userRecord));
} }
@ -88,10 +92,10 @@ class BlogPostTest extends SapphireTest
{ {
$blogPost = $this->objFromFixture('BlogPost', 'NullPublishDate'); $blogPost = $this->objFromFixture('BlogPost', 'NullPublishDate');
$editor = $this->objFromFixture('Member', 'BlogEditor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'BlogEditor');
$this->assertTrue($blogPost->canView($editor)); $this->assertTrue($blogPost->canView($editor));
$visitor = $this->objFromFixture('Member', 'Visitor'); $visitor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Visitor');
$this->assertFalse($blogPost->canView($visitor)); $this->assertFalse($blogPost->canView($visitor));
} }

View File

@ -1,5 +1,11 @@
<?php <?php
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\Member;
use SilverStripe\Control\Controller;
use SilverStripe\ORM\ValidationException;
use SilverStripe\Dev\FunctionalTest;
/** /**
* @mixin PHPUnit_Framework_TestCase * @mixin PHPUnit_Framework_TestCase
*/ */
@ -17,7 +23,7 @@ class BlogTagTest extends FunctionalTest
{ {
parent::setUp(); parent::setUp();
SS_Datetime::set_mock_now('2013-10-10 20:00:00'); DBDatetime::set_mock_now('2013-10-10 20:00:00');
} }
/** /**
@ -25,7 +31,7 @@ class BlogTagTest extends FunctionalTest
*/ */
public function tearDown() public function tearDown()
{ {
SS_Datetime::clear_mock_now(); DBDatetime::clear_mock_now();
parent::tearDown(); parent::tearDown();
} }
@ -75,8 +81,8 @@ class BlogTagTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$admin = $this->objFromFixture('Member', 'Admin'); $admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$tag = $this->objFromFixture('BlogTag', 'FirstTag'); $tag = $this->objFromFixture('BlogTag', 'FirstTag');
@ -93,8 +99,8 @@ class BlogTagTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$admin = $this->objFromFixture('Member', 'Admin'); $admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$tag = $this->objFromFixture('BlogTag', 'FirstTag'); $tag = $this->objFromFixture('BlogTag', 'FirstTag');
@ -116,8 +122,8 @@ class BlogTagTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$admin = $this->objFromFixture('Member', 'Admin'); $admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$tag = singleton('BlogTag'); $tag = singleton('BlogTag');
@ -129,8 +135,8 @@ class BlogTagTest extends FunctionalTest
{ {
$this->useDraftSite(); $this->useDraftSite();
$admin = $this->objFromFixture('Member', 'Admin'); $admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'Admin');
$editor = $this->objFromFixture('Member', 'Editor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Editor');
$tag = $this->objFromFixture('BlogTag', 'FirstTag'); $tag = $this->objFromFixture('BlogTag', 'FirstTag');

View File

@ -1,5 +1,9 @@
<?php <?php
use SilverStripe\Control\Director;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\SapphireTest;
class BlogTagsCloudWidgetTest extends SapphireTest { class BlogTagsCloudWidgetTest extends SapphireTest {
/** /**

View File

@ -1,5 +1,16 @@
<?php <?php
use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\Member;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\ORM\DataModel;
use SilverStripe\ORM\SS_List;
use SilverStripe\Dev\SapphireTest;
/** /**
* @mixin PHPUnit_Framework_TestCase * @mixin PHPUnit_Framework_TestCase
*/ */
@ -18,7 +29,7 @@ class BlogTest extends SapphireTest
parent::setUp(); parent::setUp();
Config::nest(); Config::nest();
SS_Datetime::set_mock_now('2013-10-10 20:00:00'); DBDatetime::set_mock_now('2013-10-10 20:00:00');
/** /**
* @var Blog $blog * @var Blog $blog
@ -33,7 +44,7 @@ class BlogTest extends SapphireTest
*/ */
public function tearDown() public function tearDown()
{ {
SS_Datetime::clear_mock_now(); DBDatetime::clear_mock_now();
Config::unnest(); Config::unnest();
parent::tearDown(); parent::tearDown();
@ -181,22 +192,22 @@ class BlogTest extends SapphireTest
/** /**
* @var Member $editor * @var Member $editor
*/ */
$editor = $this->objFromFixture('Member', 'BlogEditor'); $editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'BlogEditor');
/** /**
* @var Member $writer * @var Member $writer
*/ */
$writer = $this->objFromFixture('Member', 'Writer'); $writer = $this->objFromFixture('SilverStripe\\Security\\Member', 'Writer');
/** /**
* @var Member $contributor * @var Member $contributor
*/ */
$contributor = $this->objFromFixture('Member', 'Contributor'); $contributor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Contributor');
/** /**
* @var Member $visitor * @var Member $visitor
*/ */
$visitor = $this->objFromFixture('Member', 'Visitor'); $visitor = $this->objFromFixture('SilverStripe\\Security\\Member', 'Visitor');
$this->assertEquals('Editor', $fourthBlog->RoleOf($editor)); $this->assertEquals('Editor', $fourthBlog->RoleOf($editor));
$this->assertEquals('Contributor', $fourthBlog->RoleOf($contributor)); $this->assertEquals('Contributor', $fourthBlog->RoleOf($contributor));
@ -321,7 +332,7 @@ class BlogTest extends SapphireTest
*/ */
protected function requestURL(ContentController $controller, $url) protected function requestURL(ContentController $controller, $url)
{ {
$request = new SS_HTTPRequest('get', $url); $request = new HTTPRequest('get', $url);
$request->match('$URLSegment//$Action/$ID/$OtherID'); $request->match('$URLSegment//$Action/$ID/$OtherID');
$request->shift(); $request->shift();
$controller->init(); $controller->init();