mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
API Upgrade to rely on silverstripe/versioned module
This commit is contained in:
parent
672a31e56e
commit
5ce98aced2
@ -14,6 +14,7 @@ env:
|
|||||||
global:
|
global:
|
||||||
- TRAVIS_NODE_VERSION="4"
|
- TRAVIS_NODE_VERSION="4"
|
||||||
- CORE_RELEASE=4
|
- CORE_RELEASE=4
|
||||||
|
- COMPOSER_ROOT_VERSION="4.0.x-dev"
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@ -38,12 +39,12 @@ before_script:
|
|||||||
- phpenv config-rm xdebug.ini
|
- phpenv config-rm xdebug.ini
|
||||||
- echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
- echo 'memory_limit = 2G' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||||
- composer install --prefer-dist
|
- composer install --prefer-dist
|
||||||
|
- composer require silverstripe/framework:4.0.x-dev silverstripe/config:1.0.x-dev silverstripe/admin:1.0.x-dev silverstripe/assets:1.0.x-dev silverstripe/versioned:1.0.x-dev --prefer-dist
|
||||||
- "if [ \"$DB\" = \"PGSQL\" ]; then composer require silverstripe/postgresql:2.0.x-dev --prefer-dist; fi"
|
- "if [ \"$DB\" = \"PGSQL\" ]; then composer require silverstripe/postgresql:2.0.x-dev --prefer-dist; fi"
|
||||||
- "if [ \"$DB\" = \"SQLITE\" ]; then composer require silverstripe/sqlite3:2.0.x-dev --prefer-dist; fi"
|
- "if [ \"$DB\" = \"SQLITE\" ]; then composer require silverstripe/sqlite3:2.0.x-dev --prefer-dist; fi"
|
||||||
- "php ./tests/bootstrap/mysite.php"
|
- "php ./tests/bootstrap/mysite.php"
|
||||||
- "export DISPLAY=\":99\""
|
- "export DISPLAY=\":99\""
|
||||||
- "export XVFBARGS=\":99 -ac -screen 0 1024x768x16\""
|
- "export XVFBARGS=\":99 -ac -screen 0 1024x768x16\""
|
||||||
- "export COMPOSER_ROOT_VERSION=4.0.x-dev"
|
|
||||||
- "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm install $TRAVIS_NODE_VERSION && npm install --silent && npm run build); fi"
|
- "if [ \"$NPM_TEST\" = \"1\" ]; then (nvm install $TRAVIS_NODE_VERSION && npm install --silent && npm run build); fi"
|
||||||
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then sh -e /etc/init.d/xvfb start; sleep 3; fi"
|
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then sh -e /etc/init.d/xvfb start; sleep 3; fi"
|
||||||
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then (vendor/bin/selenium-server-standalone > selenium.log 2>&1 &); fi"
|
- "if [ \"$BEHAT_TEST\" = \"1\" ]; then (vendor/bin/selenium-server-standalone > selenium.log 2>&1 &); fi"
|
||||||
|
@ -6,7 +6,7 @@ use SilverStripe\Admin\CMSBatchAction;
|
|||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,7 +50,7 @@ use SilverStripe\ORM\FieldType\DBHTMLText;
|
|||||||
use SilverStripe\ORM\HiddenClass;
|
use SilverStripe\ORM\HiddenClass;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\ValidationResult;
|
use SilverStripe\ORM\ValidationResult;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
use SilverStripe\Security\PermissionProvider;
|
use SilverStripe\Security\PermissionProvider;
|
||||||
|
@ -16,7 +16,7 @@ use SilverStripe\Forms\HTMLReadonlyField;
|
|||||||
use SilverStripe\Forms\LiteralField;
|
use SilverStripe\Forms\LiteralField;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
use SilverStripe\View\ViewableData;
|
use SilverStripe\View\ViewableData;
|
||||||
|
@ -9,7 +9,7 @@ use SilverStripe\Forms\DateField;
|
|||||||
use SilverStripe\ORM\DataList;
|
use SilverStripe\ORM\DataList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for filtering the subtree for certain node statuses.
|
* Base class for filtering the subtree for certain node statuses.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\CMS\Controllers;
|
namespace SilverStripe\CMS\Controllers;
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all pages which have changed on stage.
|
* Gets all pages which have changed on stage.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\CMS\Controllers;
|
namespace SilverStripe\CMS\Controllers;
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Works a bit different than the other filters:
|
* Works a bit different than the other filters:
|
||||||
|
@ -4,7 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This filter will display the SiteTree as a site visitor might see the site, i.e only the
|
* This filter will display the SiteTree as a site visitor might see the site, i.e only the
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
namespace SilverStripe\CMS\Controllers;
|
namespace SilverStripe\CMS\Controllers;
|
||||||
|
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter
|
class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters pages which have a status "Deleted".
|
* Filters pages which have a status "Deleted".
|
||||||
|
@ -4,7 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters pages which have a status "Draft".
|
* Filters pages which have a status "Draft".
|
||||||
|
@ -4,7 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters pages which have a status "Removed from Draft".
|
* Filters pages which have a status "Removed from Draft".
|
||||||
|
@ -19,7 +19,7 @@ use SilverStripe\ORM\FieldType\DBField;
|
|||||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
use SilverStripe\ORM\FieldType\DBVarchar;
|
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\MemberAuthenticator;
|
use SilverStripe\Security\MemberAuthenticator;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
|
@ -4,7 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\ORM\CMSPreviewable;
|
use SilverStripe\ORM\CMSPreviewable;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\View\ViewableData;
|
use SilverStripe\View\ViewableData;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ abstract class SilverStripeNavigatorItem extends ViewableData
|
|||||||
*/
|
*/
|
||||||
public function isArchived()
|
public function isArchived()
|
||||||
{
|
{
|
||||||
if (!$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')) {
|
if (!$this->record->hasExtension(Versioned::class)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use SilverStripe\Control\Controller;
|
|||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem
|
class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem
|
|||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')
|
$this->record->hasExtension(Versioned::class)
|
||||||
&& $this->isArchived()
|
&& $this->isArchived()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($this->record instanceof RedirectorPage)
|
||||||
|
@ -4,7 +4,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
use SilverStripe\CMS\Model\RedirectorPage;
|
use SilverStripe\CMS\Model\RedirectorPage;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
|
class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem
|
|||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')
|
$this->record->hasExtension(Versioned::class)
|
||||||
&& $this->getLivePage()
|
&& $this->getLivePage()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($this->record instanceof RedirectorPage)
|
||||||
|
@ -5,7 +5,7 @@ use SilverStripe\CMS\Model\RedirectorPage;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SiteTreeFutureState;
|
use SiteTreeFutureState;
|
||||||
|
|
||||||
class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem
|
class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem
|
||||||
@ -58,7 +58,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem
|
|||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')
|
$this->record->hasExtension(Versioned::class)
|
||||||
&& $this->getDraftPage()
|
&& $this->getDraftPage()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($this->record instanceof RedirectorPage)
|
||||||
|
@ -5,7 +5,7 @@ namespace SilverStripe\CMS\Model;
|
|||||||
use SilverStripe\Assets\Storage\GeneratedAssetHandler;
|
use SilverStripe\Assets\Storage\GeneratedAssetHandler;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\DataModel;
|
use SilverStripe\ORM\DataModel;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\CMS\Controllers\ModelAsController;
|
use SilverStripe\CMS\Controllers\ModelAsController;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
|
@ -48,7 +48,7 @@ use SilverStripe\ORM\HiddenClass;
|
|||||||
use SilverStripe\ORM\Hierarchy\Hierarchy;
|
use SilverStripe\ORM\Hierarchy\Hierarchy;
|
||||||
use SilverStripe\ORM\ManyManyList;
|
use SilverStripe\ORM\ManyManyList;
|
||||||
use SilverStripe\ORM\ValidationResult;
|
use SilverStripe\ORM\ValidationResult;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Group;
|
use SilverStripe\Security\Group;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
@ -1057,7 +1057,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
|
|
||||||
// check for specific groups
|
// check for specific groups
|
||||||
if ($member && is_numeric($member)) {
|
if ($member && is_numeric($member)) {
|
||||||
$member = DataObject::get_by_id('SilverStripe\\Security\\Member', $member);
|
$member = DataObject::get_by_id(Member::class, $member);
|
||||||
}
|
}
|
||||||
if ($this->CanViewType == 'OnlyTheseUsers'
|
if ($this->CanViewType == 'OnlyTheseUsers'
|
||||||
&& $member
|
&& $member
|
||||||
@ -1352,7 +1352,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
|
|
||||||
// Get the groups that the given member belongs to
|
// Get the groups that the given member belongs to
|
||||||
/** @var Member $member */
|
/** @var Member $member */
|
||||||
$member = DataObject::get_by_id('SilverStripe\\Security\\Member', $memberID);
|
$member = DataObject::get_by_id(Member::class, $memberID);
|
||||||
$groupIDs = $member->Groups()->column("ID");
|
$groupIDs = $member->Groups()->column("ID");
|
||||||
$SQL_groupList = implode(", ", $groupIDs);
|
$SQL_groupList = implode(", ", $groupIDs);
|
||||||
if (!$SQL_groupList) {
|
if (!$SQL_groupList) {
|
||||||
|
@ -9,7 +9,7 @@ use SilverStripe\Forms\ReadonlyField;
|
|||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\ManyManyList;
|
use SilverStripe\ORM\ManyManyList;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\View\SSViewer;
|
use SilverStripe\View\SSViewer;
|
||||||
use Subsite;
|
use Subsite;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use SilverStripe\ORM\DataExtension;
|
|||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
use SilverStripe\ORM\ManyManyList;
|
use SilverStripe\ORM\ManyManyList;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use DOMElement;
|
use DOMElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,7 +8,7 @@ use SilverStripe\Forms\ReadonlyTransformation;
|
|||||||
use SilverStripe\Forms\TreeDropdownField;
|
use SilverStripe\Forms\TreeDropdownField;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\ValidationResult;
|
use SilverStripe\ORM\ValidationResult;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use Page;
|
use Page;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ use SilverStripe\Forms\CheckboxField;
|
|||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
class BrokenFilesReport extends Report
|
class BrokenFilesReport extends Report
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ use SilverStripe\Control\Controller;
|
|||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
@ -6,7 +6,7 @@ use SilverStripe\Core\ClassInfo;
|
|||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
|
||||||
class BrokenRedirectorPagesReport extends Report
|
class BrokenRedirectorPagesReport extends Report
|
||||||
|
@ -6,7 +6,7 @@ use SilverStripe\Core\ClassInfo;
|
|||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
|
||||||
class BrokenVirtualPagesReport extends Report
|
class BrokenVirtualPagesReport extends Report
|
||||||
|
@ -14,7 +14,7 @@ use SilverStripe\Forms\OptionsetField;
|
|||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\SS_List;
|
use SilverStripe\ORM\SS_List;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
|
@ -17,10 +17,11 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"composer/installers": "*",
|
"composer/installers": "*",
|
||||||
"silverstripe/framework": "^4.0@dev",
|
|
||||||
"silverstripe/admin": "^1.0@dev",
|
"silverstripe/admin": "^1.0@dev",
|
||||||
|
"silverstripe/framework": "^4.0@dev",
|
||||||
"silverstripe/reports": "^4.0@dev",
|
"silverstripe/reports": "^4.0@dev",
|
||||||
"silverstripe/siteconfig": "^4.0@dev"
|
"silverstripe/siteconfig": "^4.0@dev",
|
||||||
|
"silverstripe/versioned": "^1.0@dev"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/PHPUnit": "~4.8",
|
"phpunit/PHPUnit": "~4.8",
|
||||||
|
@ -9,7 +9,7 @@ use SilverStripe\BehatExtension\Context\FixtureContext;
|
|||||||
use SilverStripe\Framework\Test\Behaviour\CmsFormsContext;
|
use SilverStripe\Framework\Test\Behaviour\CmsFormsContext;
|
||||||
use SilverStripe\Framework\Test\Behaviour\CmsUiContext;
|
use SilverStripe\Framework\Test\Behaviour\CmsUiContext;
|
||||||
use SilverStripe\Cms\Test\Behaviour;
|
use SilverStripe\Cms\Test\Behaviour;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
|
@ -11,7 +11,7 @@ use Behat\Behat\Exception\PendingException;
|
|||||||
use Behat\Mink\Driver\Selenium2Driver;
|
use Behat\Mink\Driver\Selenium2Driver;
|
||||||
use Behat\Gherkin\Node\PyStringNode;
|
use Behat\Gherkin\Node\PyStringNode;
|
||||||
use Behat\Gherkin\Node\TableNode;
|
use Behat\Gherkin\Node\TableNode;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context used to create fixtures in the SilverStripe ORM.
|
* Context used to create fixtures in the SilverStripe ORM.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\CMS\BatchActions\CMSBatchAction_Archive;
|
use SilverStripe\CMS\BatchActions\CMSBatchAction_Archive;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\BatchActions\CMSBatchAction_Publish;
|
use SilverStripe\CMS\BatchActions\CMSBatchAction_Publish;
|
||||||
use SilverStripe\CMS\BatchActions\CMSBatchAction_Unpublish;
|
use SilverStripe\CMS\BatchActions\CMSBatchAction_Unpublish;
|
||||||
use SilverStripe\CMS\BatchActions\CMSBatchAction_Restore;
|
use SilverStripe\CMS\BatchActions\CMSBatchAction_Restore;
|
||||||
|
@ -4,7 +4,7 @@ use SilverStripe\Core\Injector\Injector;
|
|||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\ValidationException;
|
use SilverStripe\ORM\ValidationException;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\HiddenClass;
|
use SilverStripe\ORM\HiddenClass;
|
||||||
use SilverStripe\CMS\Controllers\CMSMain;
|
use SilverStripe\CMS\Controllers\CMSMain;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
@ -250,7 +250,7 @@ class CMSMainTest extends FunctionalTest
|
|||||||
|
|
||||||
$response = $this->get('admin/pages/edit/show/' . $pageID);
|
$response = $this->get('admin/pages/edit/show/' . $pageID);
|
||||||
|
|
||||||
$livePage = Versioned::get_one_by_stage("SilverStripe\\CMS\\Model\\SiteTree", "Live", array(
|
$livePage = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, array(
|
||||||
'"SiteTree"."ID"' => $pageID
|
'"SiteTree"."ID"' => $pageID
|
||||||
));
|
));
|
||||||
$this->assertInstanceOf('SilverStripe\\CMS\\Model\\SiteTree', $livePage);
|
$this->assertInstanceOf('SilverStripe\\CMS\\Model\\SiteTree', $livePage);
|
||||||
|
@ -5,7 +5,7 @@ use SilverStripe\Forms\FieldList;
|
|||||||
use SilverStripe\Forms\HiddenField;
|
use SilverStripe\Forms\HiddenField;
|
||||||
use SilverStripe\Forms\HTMLReadonlyField;
|
use SilverStripe\Forms\HTMLReadonlyField;
|
||||||
use SilverStripe\Forms\TextField;
|
use SilverStripe\Forms\TextField;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Controllers\CMSPageHistoryController;
|
use SilverStripe\CMS\Controllers\CMSPageHistoryController;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_Search;
|
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_Search;
|
||||||
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_ChangedPages;
|
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_ChangedPages;
|
||||||
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_DeletedPages;
|
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_DeletedPages;
|
||||||
@ -190,7 +191,7 @@ class CMSSiteTreeFilterTest extends SapphireTest
|
|||||||
// Can't use straight $blah->delete() as that blows it away completely and test fails
|
// Can't use straight $blah->delete() as that blows it away completely and test fails
|
||||||
$deletedPage->deleteFromStage(Versioned::LIVE);
|
$deletedPage->deleteFromStage(Versioned::LIVE);
|
||||||
$deletedPage->deleteFromStage(Versioned::DRAFT);
|
$deletedPage->deleteFromStage(Versioned::DRAFT);
|
||||||
$checkParentExists = Versioned::get_latest_version('SilverStripe\\CMS\\Model\\SiteTree', $deletedPageID);
|
$checkParentExists = Versioned::get_latest_version(SiteTree::class, $deletedPageID);
|
||||||
|
|
||||||
// Check deleted page is included
|
// Check deleted page is included
|
||||||
$f = new CMSSiteTreeFilter_StatusDeletedPages(array('Title' => 'Page'));
|
$f = new CMSSiteTreeFilter_StatusDeletedPages(array('Title' => 'Page'));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Control\HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Controllers\ContentController;
|
use SilverStripe\CMS\Controllers\ContentController;
|
||||||
use SilverStripe\ORM\Search\FulltextSearchable;
|
use SilverStripe\ORM\Search\FulltextSearchable;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Controllers\RootURLController;
|
use SilverStripe\CMS\Controllers\RootURLController;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\CMS\Controllers\ContentController;
|
use SilverStripe\CMS\Controllers\ContentController;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\CMS\Controllers\OldPageRedirector;
|
use SilverStripe\CMS\Controllers\OldPageRedirector;
|
||||||
use SilverStripe\CMS\Controllers\RootURLController;
|
use SilverStripe\CMS\Controllers\RootURLController;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
|
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
|
||||||
@ -25,7 +26,7 @@ class SilverStripeNavigatorTest extends SapphireTest
|
|||||||
$items = $navigator->getItems();
|
$items = $navigator->getItems();
|
||||||
$classes = array_map('get_class', $items->toArray());
|
$classes = array_map('get_class', $items->toArray());
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
'SilverStripe\\CMS\\Controllers\\SilverStripeNavigatorItem_StageLink',
|
SilverStripeNavigatorItem_StageLink::class,
|
||||||
$classes,
|
$classes,
|
||||||
'Adds default classes'
|
'Adds default classes'
|
||||||
);
|
);
|
||||||
@ -40,7 +41,7 @@ class SilverStripeNavigatorTest extends SapphireTest
|
|||||||
public function testCanView()
|
public function testCanView()
|
||||||
{
|
{
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$admin = $this->objFromFixture('SilverStripe\\Security\\Member', 'admin');
|
$admin = $this->objFromFixture(Member::class, 'admin');
|
||||||
$navigator = new SilverStripeNavigator($page);
|
$navigator = new SilverStripeNavigator($page);
|
||||||
|
|
||||||
// TODO Shouldn't be necessary but SapphireTest logs in as ADMIN by default
|
// TODO Shouldn't be necessary but SapphireTest logs in as ADMIN by default
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\Control\Session;
|
use SilverStripe\Control\Session;
|
||||||
use SilverStripe\View\Parsers\ShortcodeParser;
|
use SilverStripe\View\Parsers\ShortcodeParser;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\CMS\Model\ErrorPage;
|
use SilverStripe\CMS\Model\ErrorPage;
|
||||||
use SilverStripe\CMS\Controllers\ContentController;
|
use SilverStripe\CMS\Controllers\ContentController;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Assets\Folder;
|
||||||
|
use SilverStripe\Assets\Image;
|
||||||
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\CMS\Model\VirtualPage;
|
use SilverStripe\CMS\Model\VirtualPage;
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
@ -25,7 +27,7 @@ class FileLinkTrackingTest extends SapphireTest
|
|||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
// Write file contents
|
// Write file contents
|
||||||
$files = File::get()->exclude('ClassName', 'SilverStripe\\Assets\\Folder');
|
$files = File::get()->exclude('ClassName', Folder::class);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$destPath = TestAssetStore::getLocalPath($file);
|
$destPath = TestAssetStore::getLocalPath($file);
|
||||||
Filesystem::makeFolder(dirname($destPath));
|
Filesystem::makeFolder(dirname($destPath));
|
||||||
@ -35,7 +37,7 @@ class FileLinkTrackingTest extends SapphireTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Since we can't hard-code IDs, manually inject image tracking shortcode
|
// Since we can't hard-code IDs, manually inject image tracking shortcode
|
||||||
$imageID = $this->idFromFixture('SilverStripe\\Assets\\Image', 'file1');
|
$imageID = $this->idFromFixture(Image::class, 'file1');
|
||||||
$page = $this->objFromFixture('Page', 'page1');
|
$page = $this->objFromFixture('Page', 'page1');
|
||||||
$page->Content = sprintf(
|
$page->Content = sprintf(
|
||||||
'<p>[image src="/assets/FileLinkTrackingTest/55b443b601/testscript-test-file.jpg" id="%d"]</p>',
|
'<p>[image src="/assets/FileLinkTrackingTest/55b443b601/testscript-test-file.jpg" id="%d"]</p>',
|
||||||
@ -73,7 +75,7 @@ class FileLinkTrackingTest extends SapphireTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
$file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1');
|
$file = $this->objFromFixture(Image::class, 'file1');
|
||||||
$file->Name = 'renamed-test-file.jpg';
|
$file->Name = 'renamed-test-file.jpg';
|
||||||
$file->write();
|
$file->write();
|
||||||
|
|
||||||
@ -133,7 +135,7 @@ class FileLinkTrackingTest extends SapphireTest
|
|||||||
$svp->publishRecursive();
|
$svp->publishRecursive();
|
||||||
|
|
||||||
// Rename the file
|
// Rename the file
|
||||||
$file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1');
|
$file = $this->objFromFixture(Image::class, 'file1');
|
||||||
$file->Name = 'renamed-test-file.jpg';
|
$file->Name = 'renamed-test-file.jpg';
|
||||||
$file->write();
|
$file->write();
|
||||||
|
|
||||||
@ -164,7 +166,7 @@ class FileLinkTrackingTest extends SapphireTest
|
|||||||
$this->assertFalse($page->isModifiedOnDraft());
|
$this->assertFalse($page->isModifiedOnDraft());
|
||||||
|
|
||||||
// Rename the file
|
// Rename the file
|
||||||
$file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1');
|
$file = $this->objFromFixture(Image::class, 'file1');
|
||||||
$file->Name = 'renamed-test-file.jpg';
|
$file->Name = 'renamed-test-file.jpg';
|
||||||
$file->write();
|
$file->write();
|
||||||
|
|
||||||
@ -185,7 +187,7 @@ class FileLinkTrackingTest extends SapphireTest
|
|||||||
|
|
||||||
// Rename the file twice
|
// Rename the file twice
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
$file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'file1');
|
$file = $this->objFromFixture(Image::class, 'file1');
|
||||||
$file->Name = 'renamed-test-file.jpg';
|
$file->Name = 'renamed-test-file.jpg';
|
||||||
$file->write();
|
$file->write();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\Permission;
|
use SilverStripe\Security\Permission;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
use SilverStripe\Control\HTTP;
|
use SilverStripe\Control\HTTP;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\CMS\Model\VirtualPage;
|
use SilverStripe\CMS\Model\VirtualPage;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Security\Group;
|
||||||
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
@ -19,7 +21,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
protected static $fixture_file = "SiteTreePermissionsTest.yml";
|
protected static $fixture_file = "SiteTreePermissionsTest.yml";
|
||||||
|
|
||||||
protected $illegalExtensions = array(
|
protected $illegalExtensions = array(
|
||||||
'SilverStripe\\CMS\\Model\\SiteTree' => array('SiteTreeSubsites')
|
SiteTree::class => array('SiteTreeSubsites')
|
||||||
);
|
);
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
@ -87,7 +89,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
$page = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', "\"SiteTree\".\"ID\" = $pageID");
|
$page = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', "\"SiteTree\".\"ID\" = $pageID");
|
||||||
|
|
||||||
// subadmin has edit rights on that page
|
// subadmin has edit rights on that page
|
||||||
$member = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$member = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$member->logIn();
|
$member->logIn();
|
||||||
|
|
||||||
// Test can_edit_multiple
|
// Test can_edit_multiple
|
||||||
@ -110,7 +112,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
$page->doUnpublish();
|
$page->doUnpublish();
|
||||||
|
|
||||||
// subadmin has edit rights on that page
|
// subadmin has edit rights on that page
|
||||||
$member = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$member = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$member->logIn();
|
$member->logIn();
|
||||||
|
|
||||||
// Test can_edit_multiple
|
// Test can_edit_multiple
|
||||||
@ -137,7 +139,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
$page = Versioned::get_latest_version('SilverStripe\\CMS\\Model\\SiteTree', $pageID);
|
$page = Versioned::get_latest_version('SilverStripe\\CMS\\Model\\SiteTree', $pageID);
|
||||||
|
|
||||||
// subadmin had edit rights on that page, but now it's gone
|
// subadmin had edit rights on that page, but now it's gone
|
||||||
$member = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$member = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$member->logIn();
|
$member->logIn();
|
||||||
|
|
||||||
$this->assertFalse($page->canEdit());
|
$this->assertFalse($page->canEdit());
|
||||||
@ -155,8 +157,8 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
$page->Title = 1;
|
$page->Title = 1;
|
||||||
$page->write();
|
$page->write();
|
||||||
|
|
||||||
$editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'editor');
|
$editor = $this->objFromFixture(Member::class, 'editor');
|
||||||
$websiteuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'websiteuser');
|
$websiteuser = $this->objFromFixture(Member::class, 'websiteuser');
|
||||||
|
|
||||||
$this->assertTrue($page->canViewStage('Live', $websiteuser));
|
$this->assertTrue($page->canViewStage('Live', $websiteuser));
|
||||||
$this->assertFalse($page->canViewStage('Stage', $websiteuser));
|
$this->assertFalse($page->canViewStage('Stage', $websiteuser));
|
||||||
@ -171,7 +173,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
{
|
{
|
||||||
$page = $this->objFromFixture('Page', 'standardpage');
|
$page = $this->objFromFixture('Page', 'standardpage');
|
||||||
|
|
||||||
$subadminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$subadminuser = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$this->session()->inst_set('loggedInAs', $subadminuser->ID);
|
$this->session()->inst_set('loggedInAs', $subadminuser->ID);
|
||||||
$fields = $page->getSettingsFields();
|
$fields = $page->getSettingsFields();
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
@ -183,7 +185,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
'Users with SITETREE_GRANT_ACCESS permission can change "edit" permissions in cms fields'
|
'Users with SITETREE_GRANT_ACCESS permission can change "edit" permissions in cms fields'
|
||||||
);
|
);
|
||||||
|
|
||||||
$editoruser = $this->objFromFixture('SilverStripe\\Security\\Member', 'editor');
|
$editoruser = $this->objFromFixture(Member::class, 'editor');
|
||||||
$this->session()->inst_set('loggedInAs', $editoruser->ID);
|
$this->session()->inst_set('loggedInAs', $editoruser->ID);
|
||||||
$fields = $page->getSettingsFields();
|
$fields = $page->getSettingsFields();
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
@ -216,7 +218,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// website users
|
// website users
|
||||||
$websiteuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'websiteuser');
|
$websiteuser = $this->objFromFixture(Member::class, 'websiteuser');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$page->canView($websiteuser),
|
$page->canView($websiteuser),
|
||||||
'Authenticated members can view a page marked as "Viewable for any logged in users" even if they dont have access to the CMS'
|
'Authenticated members can view a page marked as "Viewable for any logged in users" even if they dont have access to the CMS'
|
||||||
@ -249,7 +251,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// subadmin users
|
// subadmin users
|
||||||
$subadminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$subadminuser = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$page->canView($subadminuser),
|
$page->canView($subadminuser),
|
||||||
'Authenticated members cant view a page marked as "Viewable by these groups" if theyre not in the listed groups'
|
'Authenticated members cant view a page marked as "Viewable by these groups" if theyre not in the listed groups'
|
||||||
@ -264,7 +266,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
$this->session()->inst_set('loggedInAs', null);
|
$this->session()->inst_set('loggedInAs', null);
|
||||||
|
|
||||||
// website users
|
// website users
|
||||||
$websiteuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'websiteuser');
|
$websiteuser = $this->objFromFixture(Member::class, 'websiteuser');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$page->canView($websiteuser),
|
$page->canView($websiteuser),
|
||||||
'Authenticated members can view a page marked as "Viewable by these groups" if theyre in the listed groups'
|
'Authenticated members can view a page marked as "Viewable by these groups" if theyre in the listed groups'
|
||||||
@ -290,7 +292,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// website users
|
// website users
|
||||||
$websiteuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'websiteuser');
|
$websiteuser = $this->objFromFixture(Member::class, 'websiteuser');
|
||||||
$websiteuser->logIn();
|
$websiteuser->logIn();
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$page->canEdit($websiteuser),
|
$page->canEdit($websiteuser),
|
||||||
@ -298,7 +300,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// subadmin users
|
// subadmin users
|
||||||
$subadminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$subadminuser = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$page->canEdit($subadminuser),
|
$page->canEdit($subadminuser),
|
||||||
'Authenticated members can edit a page marked as "Editable by logged in users" if they have cms permissions and belong to any of these groups'
|
'Authenticated members can edit a page marked as "Editable by logged in users" if they have cms permissions and belong to any of these groups'
|
||||||
@ -316,14 +318,14 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// subadmin users
|
// subadmin users
|
||||||
$subadminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$subadminuser = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$page->canEdit($subadminuser),
|
$page->canEdit($subadminuser),
|
||||||
'Authenticated members can view a page marked as "Editable by these groups" if theyre in the listed groups'
|
'Authenticated members can view a page marked as "Editable by these groups" if theyre in the listed groups'
|
||||||
);
|
);
|
||||||
|
|
||||||
// website users
|
// website users
|
||||||
$websiteuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'websiteuser');
|
$websiteuser = $this->objFromFixture(Member::class, 'websiteuser');
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
$page->canEdit($websiteuser),
|
$page->canEdit($websiteuser),
|
||||||
'Authenticated members cant edit a page marked as "Editable by these groups" if theyre not in the listed groups'
|
'Authenticated members cant edit a page marked as "Editable by these groups" if theyre not in the listed groups'
|
||||||
@ -349,7 +351,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// subadmin users
|
// subadmin users
|
||||||
$subadminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$subadminuser = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$childPage->canView($subadminuser),
|
$childPage->canView($subadminuser),
|
||||||
'Authenticated members can view a page marked as "Viewable by these groups" if theyre in the listed groups by inherited permission'
|
'Authenticated members can view a page marked as "Viewable by these groups" if theyre in the listed groups by inherited permission'
|
||||||
@ -376,7 +378,7 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// subadmin users
|
// subadmin users
|
||||||
$subadminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$subadminuser = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$childPage->canEdit($subadminuser),
|
$childPage->canEdit($subadminuser),
|
||||||
'Authenticated members can edit a page marked as "Editable by these groups" if theyre in the listed groups by inherited permission'
|
'Authenticated members can edit a page marked as "Editable by these groups" if theyre in the listed groups by inherited permission'
|
||||||
@ -410,11 +412,11 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
$page->deleteFromStage('Stage');
|
$page->deleteFromStage('Stage');
|
||||||
|
|
||||||
// Get the live version of the page
|
// Get the live version of the page
|
||||||
$page = Versioned::get_one_by_stage("SilverStripe\\CMS\\Model\\SiteTree", "Live", "\"SiteTree\".\"ID\" = $pageID");
|
$page = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, "\"SiteTree\".\"ID\" = $pageID");
|
||||||
$this->assertTrue(is_object($page), 'Versioned::get_one_by_stage() is returning an object');
|
$this->assertTrue(is_object($page), 'Versioned::get_one_by_stage() is returning an object');
|
||||||
|
|
||||||
// subadmin users
|
// subadmin users
|
||||||
$subadminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'subadmin');
|
$subadminuser = $this->objFromFixture(Member::class, 'subadmin');
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$page->canEdit($subadminuser),
|
$page->canEdit($subadminuser),
|
||||||
'Authenticated members can edit a page that was deleted from stage and marked as "Editable by logged in users" if they have cms permissions and belong to any of these groups'
|
'Authenticated members can edit a page that was deleted from stage and marked as "Editable by logged in users" if they have cms permissions and belong to any of these groups'
|
||||||
@ -424,9 +426,9 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
public function testInheritCanViewFromSiteConfig()
|
public function testInheritCanViewFromSiteConfig()
|
||||||
{
|
{
|
||||||
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
||||||
$siteconfig = $this->objFromFixture('SilverStripe\\SiteConfig\\SiteConfig', 'default');
|
$siteconfig = $this->objFromFixture(SiteConfig::class, 'default');
|
||||||
$editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'editor');
|
$editor = $this->objFromFixture(Member::class, 'editor');
|
||||||
$editorGroup = $this->objFromFixture('SilverStripe\\Security\\Group', 'editorgroup');
|
$editorGroup = $this->objFromFixture(Group::class, 'editorgroup');
|
||||||
|
|
||||||
$siteconfig->CanViewType = 'Anyone';
|
$siteconfig->CanViewType = 'Anyone';
|
||||||
$siteconfig->write();
|
$siteconfig->write();
|
||||||
@ -450,10 +452,10 @@ class SiteTreePermissionsTest extends FunctionalTest
|
|||||||
public function testInheritCanEditFromSiteConfig()
|
public function testInheritCanEditFromSiteConfig()
|
||||||
{
|
{
|
||||||
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
$page = $this->objFromFixture('Page', 'inheritWithNoParent');
|
||||||
$siteconfig = $this->objFromFixture('SilverStripe\\SiteConfig\\SiteConfig', 'default');
|
$siteconfig = $this->objFromFixture(SiteConfig::class, 'default');
|
||||||
$editor = $this->objFromFixture('SilverStripe\\Security\\Member', 'editor');
|
$editor = $this->objFromFixture(Member::class, 'editor');
|
||||||
$user = $this->objFromFixture('SilverStripe\\Security\\Member', 'websiteuser');
|
$user = $this->objFromFixture(Member::class, 'websiteuser');
|
||||||
$editorGroup = $this->objFromFixture('SilverStripe\\Security\\Group', 'editorgroup');
|
$editorGroup = $this->objFromFixture(Group::class, 'editorgroup');
|
||||||
|
|
||||||
$siteconfig->CanEditType = 'LoggedInUsers';
|
$siteconfig->CanEditType = 'LoggedInUsers';
|
||||||
$siteconfig->write();
|
$siteconfig->write();
|
||||||
|
@ -6,7 +6,7 @@ use SilverStripe\CMS\Model\VirtualPage;
|
|||||||
use SilverStripe\Control\ContentNegotiator;
|
use SilverStripe\Control\ContentNegotiator;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\ValidationException;
|
use SilverStripe\ORM\ValidationException;
|
||||||
use SilverStripe\ORM\DataExtension;
|
use SilverStripe\ORM\DataExtension;
|
||||||
@ -339,7 +339,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
Versioned::set_stage(Versioned::LIVE);
|
Versioned::set_stage(Versioned::LIVE);
|
||||||
$deletedPage = Versioned::get_latest_version(SiteTree::class, $page2ID);
|
$deletedPage = Versioned::get_latest_version(SiteTree::class, $page2ID);
|
||||||
$deletedPage->doRestoreToStage();
|
$deletedPage->doRestoreToStage();
|
||||||
$this->assertFalse((bool)Versioned::get_one_by_stage("Page", "Live", "\"SiteTree\".\"ID\" = " . $page2ID));
|
$this->assertFalse((bool)Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, "\"SiteTree\".\"ID\" = " . $page2ID));
|
||||||
|
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
$requeriedPage = DataObject::get_by_id("Page", $page2ID);
|
$requeriedPage = DataObject::get_by_id("Page", $page2ID);
|
||||||
@ -994,7 +994,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$sitetree->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
$sitetree->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
$sitetree = DataObject::get_by_id(SiteTree::class, $sitetree->ID, false);
|
$sitetree = DataObject::get_by_id(SiteTree::class, $sitetree->ID, false);
|
||||||
$this->assertEquals($sitetree->URLSegment, rawurlencode('brötchen'));
|
$this->assertEquals($sitetree->URLSegment, rawurlencode('brötchen'));
|
||||||
$sitetreeLive = Versioned::get_one_by_stage(SiteTree::class, 'Live', '"SiteTree"."ID" = ' .$sitetree->ID, false);
|
$sitetreeLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree"."ID" = ' .$sitetree->ID, false);
|
||||||
$this->assertEquals($sitetreeLive->URLSegment, rawurlencode('brötchen'));
|
$this->assertEquals($sitetreeLive->URLSegment, rawurlencode('brötchen'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\ValidationException;
|
use SilverStripe\ORM\ValidationException;
|
||||||
use SilverStripe\ORM\FieldType\DBVarchar;
|
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||||
@ -32,11 +32,11 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
protected $illegalExtensions = array(
|
protected $illegalExtensions = array(
|
||||||
'SilverStripe\\CMS\\Model\\SiteTree' => array('SiteTreeSubsites', 'Translatable')
|
SiteTree::class => array('SiteTreeSubsites', 'Translatable')
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $requiredExtensions = array(
|
protected $requiredExtensions = array(
|
||||||
'SilverStripe\\CMS\\Model\\SiteTree' => array('VirtualPageTest_PageExtension')
|
SiteTree::class => array('VirtualPageTest_PageExtension')
|
||||||
);
|
);
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
@ -90,16 +90,16 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$master->Content = "<p>New content</p>";
|
$master->Content = "<p>New content</p>";
|
||||||
$master->write();
|
$master->write();
|
||||||
|
|
||||||
$vp1 = DataObject::get_by_id("SilverStripe\\CMS\\Model\\VirtualPage", $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp1'));
|
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp1'));
|
||||||
$vp2 = DataObject::get_by_id("SilverStripe\\CMS\\Model\\VirtualPage", $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp2'));
|
$vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp2'));
|
||||||
$this->assertTrue($vp1->publishRecursive());
|
$this->assertTrue($vp1->publishRecursive());
|
||||||
$this->assertTrue($vp2->publishRecursive());
|
$this->assertTrue($vp2->publishRecursive());
|
||||||
|
|
||||||
$master->publishRecursive();
|
$master->publishRecursive();
|
||||||
|
|
||||||
Versioned::set_stage(Versioned::LIVE);
|
Versioned::set_stage(Versioned::LIVE);
|
||||||
$vp1 = DataObject::get_by_id("SilverStripe\\CMS\\Model\\VirtualPage", $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp1'));
|
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp1'));
|
||||||
$vp2 = DataObject::get_by_id("SilverStripe\\CMS\\Model\\VirtualPage", $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp2'));
|
$vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp2'));
|
||||||
|
|
||||||
$this->assertNotNull($vp1);
|
$this->assertNotNull($vp1);
|
||||||
$this->assertNotNull($vp2);
|
$this->assertNotNull($vp2);
|
||||||
@ -159,13 +159,13 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
|
|
||||||
// The draft content of the virtual page should say 'draft content'
|
// The draft content of the virtual page should say 'draft content'
|
||||||
/** @var VirtualPage $vpDraft */
|
/** @var VirtualPage $vpDraft */
|
||||||
$vpDraft = Versioned::get_by_stage("SilverStripe\\CMS\\Model\\VirtualPage", Versioned::DRAFT)->byID($vp->ID);
|
$vpDraft = Versioned::get_by_stage(VirtualPage::class, Versioned::DRAFT)->byID($vp->ID);
|
||||||
$this->assertEquals('draft content', $vpDraft->CopyContentFrom()->Content);
|
$this->assertEquals('draft content', $vpDraft->CopyContentFrom()->Content);
|
||||||
$this->assertEquals('draft content', $vpDraft->Content);
|
$this->assertEquals('draft content', $vpDraft->Content);
|
||||||
|
|
||||||
// The published content of the virtual page should say 'published content'
|
// The published content of the virtual page should say 'published content'
|
||||||
/** @var VirtualPage $vpLive */
|
/** @var VirtualPage $vpLive */
|
||||||
$vpLive = Versioned::get_by_stage("SilverStripe\\CMS\\Model\\VirtualPage", Versioned::LIVE)->byID($vp->ID);
|
$vpLive = Versioned::get_by_stage(VirtualPage::class, Versioned::LIVE)->byID($vp->ID);
|
||||||
$this->assertEquals('published content', $vpLive->CopyContentFrom()->Content);
|
$this->assertEquals('published content', $vpLive->CopyContentFrom()->Content);
|
||||||
$this->assertEquals('published content', $vpLive->Content);
|
$this->assertEquals('published content', $vpLive->Content);
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$vpDraft->publishRecursive();
|
$vpDraft->publishRecursive();
|
||||||
|
|
||||||
// Everything is published live
|
// Everything is published live
|
||||||
$vpLive = Versioned::get_by_stage("SilverStripe\\CMS\\Model\\VirtualPage", Versioned::LIVE)->byID($vp->ID);
|
$vpLive = Versioned::get_by_stage(VirtualPage::class, Versioned::LIVE)->byID($vp->ID);
|
||||||
$this->assertEquals('draft content', $vpLive->CopyContentFrom()->Content);
|
$this->assertEquals('draft content', $vpLive->CopyContentFrom()->Content);
|
||||||
$this->assertEquals('draft content', $vpLive->Content);
|
$this->assertEquals('draft content', $vpLive->Content);
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
// Delete the source page semi-manually, without triggering
|
// Delete the source page semi-manually, without triggering
|
||||||
// the cascade publish back to the virtual page.
|
// the cascade publish back to the virtual page.
|
||||||
Versioned::set_stage(Versioned::LIVE);
|
Versioned::set_stage(Versioned::LIVE);
|
||||||
$livePage = Versioned::get_by_stage('SilverStripe\\CMS\\Model\\SiteTree', Versioned::LIVE)->byID($pID);
|
$livePage = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE)->byID($pID);
|
||||||
$livePage->delete();
|
$livePage->delete();
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
|
|
||||||
@ -346,16 +346,16 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
|
|
||||||
// The draft VP still has the CopyContentFromID link
|
// The draft VP still has the CopyContentFromID link
|
||||||
$vp->flushCache();
|
$vp->flushCache();
|
||||||
$vp = DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $vp->ID);
|
$vp = DataObject::get_by_id(SiteTree::class, $vp->ID);
|
||||||
$this->assertEquals($p->ID, $vp->CopyContentFromID);
|
$this->assertEquals($p->ID, $vp->CopyContentFromID);
|
||||||
|
|
||||||
$vpLive = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', '"SiteTree"."ID" = ' . $vp->ID);
|
$vpLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree"."ID" = ' . $vp->ID);
|
||||||
$this->assertNull($vpLive);
|
$this->assertNull($vpLive);
|
||||||
|
|
||||||
// Delete from draft, confirm that the virtual page has a broken link on the draft site
|
// Delete from draft, confirm that the virtual page has a broken link on the draft site
|
||||||
$p->delete();
|
$p->delete();
|
||||||
$vp->flushCache();
|
$vp->flushCache();
|
||||||
$vp = DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $vp->ID);
|
$vp = DataObject::get_by_id(SiteTree::class, $vp->ID);
|
||||||
$this->assertEquals(1, $vp->HasBrokenLink);
|
$this->assertEquals(1, $vp->HasBrokenLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,19 +378,19 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$pID = $p->ID;
|
$pID = $p->ID;
|
||||||
$p->delete();
|
$p->delete();
|
||||||
$vp->flushCache();
|
$vp->flushCache();
|
||||||
$vp = DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $vp->ID);
|
$vp = DataObject::get_by_id(SiteTree::class, $vp->ID);
|
||||||
$this->assertEquals(1, $vp->HasBrokenLink);
|
$this->assertEquals(1, $vp->HasBrokenLink);
|
||||||
|
|
||||||
// Delete the source page form live, confirm that the virtual page has also been unpublished
|
// Delete the source page form live, confirm that the virtual page has also been unpublished
|
||||||
$pLive = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', '"SiteTree"."ID" = ' . $pID);
|
$pLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree"."ID" = ' . $pID);
|
||||||
$this->assertTrue($pLive->doUnpublish());
|
$this->assertTrue($pLive->doUnpublish());
|
||||||
$vpLive = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', '"SiteTree"."ID" = ' . $vp->ID);
|
$vpLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree"."ID" = ' . $vp->ID);
|
||||||
$this->assertNull($vpLive);
|
$this->assertNull($vpLive);
|
||||||
|
|
||||||
// Delete from draft, confirm that the virtual page has a broken link on the draft site
|
// Delete from draft, confirm that the virtual page has a broken link on the draft site
|
||||||
$pLive->delete();
|
$pLive->delete();
|
||||||
$vp->flushCache();
|
$vp->flushCache();
|
||||||
$vp = DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $vp->ID);
|
$vp = DataObject::get_by_id(SiteTree::class, $vp->ID);
|
||||||
$this->assertEquals(1, $vp->HasBrokenLink);
|
$this->assertEquals(1, $vp->HasBrokenLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$nonVirtual->write(); // not publishing the page type change here
|
$nonVirtual->write(); // not publishing the page type change here
|
||||||
|
|
||||||
// Stage record is changed to the new type and no longer acts as a virtual page
|
// Stage record is changed to the new type and no longer acts as a virtual page
|
||||||
$nonVirtualStage = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Stage', '"SiteTree"."ID" = ' . $nonVirtual->ID, false);
|
$nonVirtualStage = Versioned::get_one_by_stage(SiteTree::class, 'Stage', '"SiteTree"."ID" = ' . $nonVirtual->ID, false);
|
||||||
$this->assertNotNull($nonVirtualStage);
|
$this->assertNotNull($nonVirtualStage);
|
||||||
$this->assertEquals('VirtualPageTest_ClassA', $nonVirtualStage->ClassName);
|
$this->assertEquals('VirtualPageTest_ClassA', $nonVirtualStage->ClassName);
|
||||||
$this->assertEquals('changed on new type', $nonVirtualStage->MySharedNonVirtualField);
|
$this->assertEquals('changed on new type', $nonVirtualStage->MySharedNonVirtualField);
|
||||||
@ -541,7 +541,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Virtual page on live keeps working as it should
|
// Virtual page on live keeps working as it should
|
||||||
$virtualLive = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', '"SiteTree_Live"."ID" = ' . $virtual->ID, false);
|
$virtualLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree_Live"."ID" = ' . $virtual->ID, false);
|
||||||
$this->assertNotNull($virtualLive);
|
$this->assertNotNull($virtualLive);
|
||||||
$this->assertEquals('VirtualPageTest_VirtualPageSub', $virtualLive->ClassName);
|
$this->assertEquals('VirtualPageTest_VirtualPageSub', $virtualLive->ClassName);
|
||||||
$this->assertEquals('virtual published field', $virtualLive->MySharedNonVirtualField);
|
$this->assertEquals('virtual published field', $virtualLive->MySharedNonVirtualField);
|
||||||
@ -554,7 +554,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
|
|
||||||
// Virtual page only notices changes to virtualised fields (Title)
|
// Virtual page only notices changes to virtualised fields (Title)
|
||||||
$virtualLive = Versioned::get_one_by_stage('SilverStripe\\CMS\\Model\\SiteTree', 'Live', '"SiteTree_Live"."ID" = ' . $virtual->ID, false);
|
$virtualLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree_Live"."ID" = ' . $virtual->ID, false);
|
||||||
$this->assertEquals('virtual published field', $virtualLive->MySharedNonVirtualField);
|
$this->assertEquals('virtual published field', $virtualLive->MySharedNonVirtualField);
|
||||||
$this->assertEquals('title changed on original', $virtualLive->Title);
|
$this->assertEquals('title changed on original', $virtualLive->Title);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use SilverStripe\CMS\Model\SiteTree;
|
|||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\MSSQL\MSSQLDatabase;
|
use SilverStripe\MSSQL\MSSQLDatabase;
|
||||||
use SilverStripe\PostgreSQL\PostgreSQLDatabase;
|
use SilverStripe\PostgreSQL\PostgreSQLDatabase;
|
||||||
use SilverStripe\CMS\Controllers\ContentController;
|
use SilverStripe\CMS\Controllers\ContentController;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\Versioned\Versioned;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user