mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1920 from open-sausages/pulls/4.0/namespace-cms
Namespace and fix CMS tests
This commit is contained in:
commit
40b0fda915
@ -61,7 +61,7 @@ before_script:
|
||||
- if [[ $BEHAT_TEST ]]; then (vendor/bin/serve --bootstrap-file tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi
|
||||
|
||||
script:
|
||||
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests flush=1; fi
|
||||
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit tests/php/ flush=1; fi
|
||||
- if [[ $BEHAT_TEST ]]; then vendor/bin/behat @cms; fi
|
||||
- if [[ $NPM_TEST ]]; then git diff-files --quiet -w --relative=client; fi
|
||||
- if [[ $NPM_TEST ]]; then git diff -w --no-color --relative=client; fi
|
||||
|
70
.upgrade.yml
70
.upgrade.yml
@ -76,5 +76,75 @@ mappings:
|
||||
URLSegmentField: SilverStripe\CMS\Forms\SiteTreeURLSegmentField
|
||||
CMSPagesController_Tools_ss: SilverStripe\CMS\Controllers\CMSPagesController
|
||||
LeftAndMain: SilverStripe\Admin\LeftAndMain
|
||||
CMSBatchActionsTest: SilverStripe\CMS\Tests\CMSBatchActionsTest
|
||||
CMSMainTest: SilverStripe\CMS\Tests\CMSMainTest
|
||||
CMSMainTest_ClassA: SilverStripe\CMS\Tests\CMSMainTest_ClassA
|
||||
CMSMainTest_ClassB: SilverStripe\CMS\Tests\CMSMainTest_ClassB
|
||||
CMSMainTest_HiddenClass: SilverStripe\CMS\Tests\CMSMainTest_HiddenClass
|
||||
CMSMainTest_NotRoot: SilverStripe\CMS\Tests\CMSMainTest_NotRoot
|
||||
CMSPageHistoryControllerTest: SilverStripe\CMS\Tests\CMSPageHistoryControllerTest
|
||||
CMSSiteTreeFilterTest: SilverStripe\CMS\Tests\CMSSiteTreeFilterTest
|
||||
CMSTreeTest: SilverStripe\CMS\Tests\CMSTreeTest
|
||||
ContentControllerPermissionsTest: SilverStripe\CMS\Tests\ContentControllerPermissionsTest
|
||||
ContentControllerSearchExtensionTest: SilverStripe\CMS\Tests\ContentControllerSearchExtensionTest
|
||||
ContentControllerTest: SilverStripe\CMS\Tests\ContentControllerTest
|
||||
ContentControllerTest_Page: SilverStripe\CMS\Tests\ContentControllerTest_Page
|
||||
ContentControllerTest_PageController: SilverStripe\CMS\Tests\ContentControllerTest_PageController
|
||||
ContentControllerTestPage: SilverStripe\CMS\Tests\ContentControllerTestPage
|
||||
ContentControllerTestPageController: SilverStripe\CMS\Tests\ContentControllerTestPageController
|
||||
ContentControllerTestPageWithoutController: SilverStripe\CMS\Tests\ContentControllerTestPageWithoutController
|
||||
ModelAsControllerTest: SilverStripe\CMS\Tests\ModelAsControllerTest
|
||||
RootURLControllerTest: SilverStripe\CMS\Tests\RootURLControllerTest
|
||||
SilverStripeNavigatorTest: SilverStripe\CMS\Tests\SilverStripeNavigatorTest
|
||||
SilverStripeNavigatorTest_ProtectedTestItem: SilverStripe\CMS\Tests\SilverStripeNavigatorTest_ProtectedTestItem
|
||||
SilverStripeNavigatorTest_TestItem: SilverStripe\CMS\Tests\SilverStripeNavigatorTest_TestItem
|
||||
FileLinkTrackingTest: SilverStripe\CMS\Tests\FileLinkTrackingTest
|
||||
RedirectorPageTest: SilverStripe\CMS\Tests\RedirectorPageTest
|
||||
RedirectorPageTest_RedirectExtension: SilverStripe\CMS\Tests\RedirectorPageTest_RedirectExtension
|
||||
SiteTreeActionsTest: SilverStripe\CMS\Tests\SiteTreeActionsTest
|
||||
SiteTreeActionsTest_Page: SilverStripe\CMS\Tests\SiteTreeActionsTest_Page
|
||||
SiteTreeBacklinksTest: SilverStripe\CMS\Tests\SiteTreeBacklinksTest
|
||||
SiteTreeBacklinksTest_DOD: SilverStripe\CMS\Tests\SiteTreeBacklinksTest_DOD
|
||||
SiteTreeBrokenLinksTest: SilverStripe\CMS\Tests\SiteTreeBrokenLinksTest
|
||||
SiteTreeHTMLEditorFieldTest: SilverStripe\CMS\Tests\SiteTreeHTMLEditorFieldTest
|
||||
SiteTreeLinkTrackingTest: SilverStripe\CMS\Tests\SiteTreeLinkTrackingTest
|
||||
SiteTreePermissionsTest: SilverStripe\CMS\Tests\SiteTreePermissionsTest
|
||||
SiteTreeTest: SilverStripe\CMS\Tests\SiteTreeTest
|
||||
SiteTreeTest_AdminDenied: SilverStripe\CMS\Tests\SiteTreeTest_AdminDenied
|
||||
SiteTreeTest_AdminDeniedExtension: SilverStripe\CMS\Tests\SiteTreeTest_AdminDeniedExtension
|
||||
SiteTreeTest_ClassA: SilverStripe\CMS\Tests\SiteTreeTest_ClassA
|
||||
SiteTreeTest_ClassB: SilverStripe\CMS\Tests\SiteTreeTest_ClassB
|
||||
SiteTreeTest_ClassC: SilverStripe\CMS\Tests\SiteTreeTest_ClassC
|
||||
SiteTreeTest_ClassCext: SilverStripe\CMS\Tests\SiteTreeTest_ClassCext
|
||||
SiteTreeTest_ClassD: SilverStripe\CMS\Tests\SiteTreeTest_ClassD
|
||||
SiteTreeTest_ClassE: SilverStripe\CMS\Tests\SiteTreeTest_ClassE
|
||||
SiteTreeTest_Conflicted: SilverStripe\CMS\Tests\SiteTreeTest_Conflicted
|
||||
SiteTreeTest_ConflictedController: SilverStripe\CMS\Tests\SiteTreeTest_ConflictedController
|
||||
SiteTreeTest_DataObject: SilverStripe\CMS\Tests\SiteTreeTest_DataObject
|
||||
SiteTreeTest_Extension: SilverStripe\CMS\Tests\SiteTreeTest_Extension
|
||||
SiteTreeTest_ExtensionA: SilverStripe\CMS\Tests\SiteTreeTest_ExtensionA
|
||||
SiteTreeTest_ExtensionB: SilverStripe\CMS\Tests\SiteTreeTest_ExtensionB
|
||||
SiteTreeTest_LegacyControllerName: SilverStripe\CMS\Tests\SiteTreeTest_LegacyControllerName
|
||||
SiteTreeTest_LegacyControllerName_Controller: SilverStripe\CMS\Tests\SiteTreeTest_LegacyControllerName_Controller
|
||||
SiteTreeTest_NotRoot: SilverStripe\CMS\Tests\SiteTreeTest_NotRoot
|
||||
SiteTreeTest_NullHtmlCleaner: SilverStripe\CMS\Tests\SiteTreeTest_NullHtmlCleaner
|
||||
SiteTreeTest_PageNode: SilverStripe\CMS\Tests\SiteTreeTest_PageNode
|
||||
SiteTreeTest_PageNodeController: SilverStripe\CMS\Tests\SiteTreeTest_PageNodeController
|
||||
SiteTreeTest_StageStatusInherit: SilverStripe\CMS\Tests\SiteTreeTest_StageStatusInherit
|
||||
VirtualPageTest: SilverStripe\CMS\Tests\VirtualPageTest
|
||||
VirtualPageTest_ClassA: SilverStripe\CMS\Tests\VirtualPageTest_ClassA
|
||||
VirtualPageTest_ClassAController: SilverStripe\CMS\Tests\VirtualPageTest_ClassAController
|
||||
VirtualPageTest_ClassB: SilverStripe\CMS\Tests\VirtualPageTest_ClassB
|
||||
VirtualPageTest_ClassC: SilverStripe\CMS\Tests\VirtualPageTest_ClassC
|
||||
VirtualPageTest_NotRoot: SilverStripe\CMS\Tests\VirtualPageTest_NotRoot
|
||||
VirtualPageTest_PageExtension: SilverStripe\CMS\Tests\VirtualPageTest_PageExtension
|
||||
VirtualPageTest_PageWithAllowedChildren: SilverStripe\CMS\Tests\VirtualPageTest_PageWithAllowedChildren
|
||||
VirtualPageTest_TestDBField: SilverStripe\CMS\Tests\VirtualPageTest_TestDBField
|
||||
VirtualPageTest_VirtualPageSub: SilverStripe\CMS\Tests\VirtualPageTest_VirtualPageSub
|
||||
CmsReportsTest: SilverStripe\CMS\Tests\CmsReportsTest
|
||||
CMSMainSearchFormTest: SilverStripe\CMS\Tests\CMSMainSearchFormTest
|
||||
ZZZSearchFormTest: SilverStripe\CMS\Tests\ZZZSearchFormTest
|
||||
MigrateSiteTreeLinkingTaskTest: SilverStripe\CMS\Tests\MigrateSiteTreeLinkingTaskTest
|
||||
RemoveOrphanedPagesTaskTest: SilverStripe\CMS\Tests\RemoveOrphanedPagesTaskTest
|
||||
excludedPaths:
|
||||
- '*/_config/legacy.yml'
|
||||
|
@ -40,14 +40,16 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "phpcs -s code/ tests/"
|
||||
"lint": "phpcs -s code/ tests/php/ tests/behat/src/",
|
||||
"lint-clean": "phpcbf code/ tests/php/ tests/behat/src/"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"SilverStripe\\CMS\\": "code/",
|
||||
"SilverStripe\\CMS\\Tests\\": "code/php/",
|
||||
"SilverStripe\\CMS\\Tests\\Behaviour\\": "tests/behat/src/"
|
||||
}
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,6 @@
|
||||
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
|
||||
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
|
||||
<exclude name="Generic.Files.LineLength.TooLong" />
|
||||
|
||||
<!-- CMS specific exclusions (high priority to fix) -->
|
||||
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
|
||||
<exclude name="PSR1.Classes.ClassDeclaration.MultipleClasses" />
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class ContentControllerTestPage extends Page implements TestOnly
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class ContentControllerTest_Page extends Page implements TestOnly
|
||||
{
|
||||
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class SiteTreeTest_AdminDenied extends Page implements TestOnly
|
||||
{
|
||||
private static $extensions = array(
|
||||
'SiteTreeTest_AdminDeniedExtension'
|
||||
);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class SiteTreeTest_ClassB extends Page implements TestOnly
|
||||
{
|
||||
// Also allowed subclasses
|
||||
private static $allowed_children = array(SiteTreeTest_ClassC::class);
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class SiteTreeTest_ClassCext extends SiteTreeTest_ClassC implements TestOnly
|
||||
{
|
||||
// Override SiteTreeTest_ClassC definitions
|
||||
private static $allowed_children = array(SiteTreeTest_ClassB::class);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class SiteTreeTest_Conflicted extends Page implements TestOnly
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class SiteTreeTest_PageNode extends Page implements TestOnly
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class VirtualPageTest_ClassB extends Page implements TestOnly
|
||||
{
|
||||
private static $allowed_children = array('VirtualPageTest_ClassC');
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\BatchActions\CMSBatchAction_Archive;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\CMS\BatchActions\CMSBatchAction_Publish;
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use Page;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use SilverStripe\Admin\CMSBatchActionHandler;
|
||||
use SilverStripe\CMS\Controllers\CMSMain;
|
||||
@ -16,19 +19,13 @@ use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\HiddenClass;
|
||||
use SilverStripe\ORM\ValidationException;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class CMSMainTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected static $fixture_file = 'CMSMainTest.yml';
|
||||
|
||||
static protected $orig = array();
|
||||
@ -50,11 +47,11 @@ class CMSMainTest extends FunctionalTest
|
||||
{
|
||||
$cache = Injector::inst()->get(CacheInterface::class . '.CMSMain_SiteTreeHints');
|
||||
// Login as user with root creation privileges
|
||||
$user = $this->objFromFixture('SilverStripe\\Security\\Member', 'rootedituser');
|
||||
$user = $this->objFromFixture(Member::class, 'rootedituser');
|
||||
Security::setCurrentUser($user);
|
||||
$cache->clear();
|
||||
|
||||
$rawHints = singleton('SilverStripe\\CMS\\Controllers\\CMSMain')->SiteTreeHints();
|
||||
$rawHints = singleton(CMSMain::class)->SiteTreeHints();
|
||||
$this->assertNotNull($rawHints);
|
||||
|
||||
$rawHints = preg_replace('/^"(.*)"$/', '$1', Convert::xml2raw($rawHints));
|
||||
@ -65,25 +62,25 @@ class CMSMainTest extends FunctionalTest
|
||||
$this->assertArrayHasKey('All', $hints);
|
||||
|
||||
$this->assertArrayHasKey(
|
||||
'CMSMainTest_ClassA',
|
||||
CMSMainTest_ClassA::class,
|
||||
$hints['All'],
|
||||
'Global list shows allowed classes'
|
||||
);
|
||||
|
||||
$this->assertArrayNotHasKey(
|
||||
'CMSMainTest_HiddenClass',
|
||||
CMSMainTest_HiddenClass::class,
|
||||
$hints['All'],
|
||||
'Global list does not list hidden classes'
|
||||
);
|
||||
|
||||
$this->assertNotContains(
|
||||
'CMSMainTest_ClassA',
|
||||
CMSMainTest_ClassA::class,
|
||||
$hints['Root']['disallowedChildren'],
|
||||
'Limits root classes'
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'CMSMainTest_NotRoot',
|
||||
CMSMainTest_NotRoot::class,
|
||||
$hints['Root']['disallowedChildren'],
|
||||
'Limits root classes'
|
||||
);
|
||||
@ -113,7 +110,7 @@ class CMSMainTest extends FunctionalTest
|
||||
|
||||
// But it can create a ClassB
|
||||
$this->assertNotContains(
|
||||
'CMSMainTest_ClassB',
|
||||
CMSMainTest_ClassB::class,
|
||||
$children,
|
||||
'Limited parent omits explicitly allowed classes in disallowedChildren'
|
||||
);
|
||||
@ -126,7 +123,7 @@ class CMSMainTest extends FunctionalTest
|
||||
{
|
||||
$page1 = $this->objFromFixture(Page::class, "page1");
|
||||
$page2 = $this->objFromFixture(Page::class, "page2");
|
||||
$this->session()->set('loggedInAs', $this->idFromFixture('SilverStripe\\Security\\Member', 'admin'));
|
||||
$this->session()->set('loggedInAs', $this->idFromFixture(Member::class, 'admin'));
|
||||
|
||||
$response = $this->get('admin/pages/publishall?confirm=1');
|
||||
$this->assertContains(
|
||||
@ -278,8 +275,8 @@ class CMSMainTest extends FunctionalTest
|
||||
$origFollow = $this->autoFollowRedirection;
|
||||
$this->autoFollowRedirection = false;
|
||||
|
||||
$cmsUser = $this->objFromFixture('SilverStripe\\Security\\Member', 'allcmssectionsuser');
|
||||
$rootEditUser = $this->objFromFixture('SilverStripe\\Security\\Member', 'rootedituser');
|
||||
$cmsUser = $this->objFromFixture(Member::class, 'allcmssectionsuser');
|
||||
$rootEditUser = $this->objFromFixture(Member::class, 'rootedituser');
|
||||
|
||||
// with insufficient permissions
|
||||
Security::setCurrentUser($cmsUser);
|
||||
@ -332,7 +329,7 @@ class CMSMainTest extends FunctionalTest
|
||||
$origFollow = $this->autoFollowRedirection;
|
||||
$this->autoFollowRedirection = false;
|
||||
|
||||
$adminUser = $this->objFromFixture('SilverStripe\\Security\\Member', 'admin');
|
||||
$adminUser = $this->objFromFixture(Member::class, 'admin');
|
||||
Security::setCurrentUser($adminUser);
|
||||
|
||||
// Create toplevel page
|
||||
@ -341,7 +338,7 @@ class CMSMainTest extends FunctionalTest
|
||||
'admin/pages/add/AddForm',
|
||||
array(
|
||||
'ParentID' => '0',
|
||||
'PageType' => 'CMSMainTest_ClassA',
|
||||
'PageType' => CMSMainTest_ClassA::class,
|
||||
'Locale' => 'en_US',
|
||||
'action_doAdd' => 1,
|
||||
'ajax' => 1
|
||||
@ -361,7 +358,7 @@ class CMSMainTest extends FunctionalTest
|
||||
'admin/pages/add/AddForm',
|
||||
array(
|
||||
'ParentID' => $newPageId,
|
||||
'PageType' => 'CMSMainTest_ClassB',
|
||||
'PageType' => CMSMainTest_ClassB::class,
|
||||
'Locale' => 'en_US',
|
||||
'action_doAdd' => 1,
|
||||
'ajax' => 1
|
||||
@ -407,7 +404,7 @@ class CMSMainTest extends FunctionalTest
|
||||
{
|
||||
$page3 = $this->objFromFixture(Page::class, 'page3');
|
||||
$page31 = $this->objFromFixture(Page::class, 'page31');
|
||||
$adminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'admin');
|
||||
$adminuser = $this->objFromFixture(Member::class, 'admin');
|
||||
Security::setCurrentUser($adminuser);
|
||||
|
||||
$response = $this->get('admin/pages/edit/show/' . $page31->ID);
|
||||
@ -567,17 +564,17 @@ class CMSMainTest extends FunctionalTest
|
||||
$page->write();
|
||||
|
||||
$form = $cms->getEditForm($page->ID);
|
||||
$form->loadDataFrom(['ClassName' => 'CMSMainTest_ClassB']);
|
||||
$form->loadDataFrom(['ClassName' => CMSMainTest_ClassB::class]);
|
||||
$result = $cms->save([
|
||||
'ID' => $page->ID,
|
||||
'ClassName' => 'CMSMainTest_ClassB'
|
||||
'ClassName' => CMSMainTest_ClassB::class
|
||||
], $form);
|
||||
$this->assertEquals(200, $result->getStatusCode());
|
||||
|
||||
$newPage = SiteTree::get()->byID($page->ID);
|
||||
|
||||
$this->assertInstanceOf('CMSMainTest_ClassB', $newPage);
|
||||
$this->assertEquals('CMSMainTest_ClassB', $newPage->ClassName);
|
||||
$this->assertInstanceOf(CMSMainTest_ClassB::class, $newPage);
|
||||
$this->assertEquals(CMSMainTest_ClassB::class, $newPage->ClassName);
|
||||
$this->assertEquals('Class A', $newPage->Title);
|
||||
}
|
||||
}
|
@ -1,11 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\ValidationException;
|
||||
use Page;
|
||||
|
||||
class CMSMainTest_ClassA extends Page implements TestOnly
|
||||
{
|
||||
private static $allowed_children = array('CMSMainTest_ClassB');
|
||||
private static $table_name = 'CMSMainTest_ClassA';
|
||||
|
||||
private static $allowed_children = array(CMSMainTest_ClassB::class);
|
||||
|
||||
protected function onBeforeWrite()
|
||||
{
|
@ -1,10 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\ValidationException;
|
||||
use Page;
|
||||
|
||||
class CMSMainTest_ClassB extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'CMSMainTest_ClassB';
|
||||
|
||||
protected function onBeforeWrite()
|
||||
{
|
||||
parent::onBeforeWrite();
|
@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\HiddenClass;
|
||||
use Page;
|
||||
|
||||
class CMSMainTest_HiddenClass extends Page implements TestOnly, HiddenClass
|
||||
{
|
@ -1,8 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class CMSMainTest_NotRoot extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'CMSMainTest_NotRoot';
|
||||
|
||||
private static $can_be_root = false;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Forms\FieldGroup;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
@ -9,11 +11,8 @@ use SilverStripe\Forms\TextField;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\CMS\Controllers\CMSPageHistoryController;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class CMSPageHistoryControllerTest extends FunctionalTest
|
||||
{
|
||||
protected static $fixture_file = 'CMSPageHistoryControllerTest.yml';
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_Search;
|
||||
@ -108,7 +110,7 @@ class CMSSiteTreeFilterTest extends SapphireTest
|
||||
$deletedPageID = $deletedPage->ID;
|
||||
$deletedPage->delete();
|
||||
$deletedPage = Versioned::get_one_by_stage(
|
||||
'SilverStripe\\CMS\\Model\\SiteTree',
|
||||
SiteTree::class,
|
||||
'Live',
|
||||
array('"SiteTree_Live"."ID"' => $deletedPageID)
|
||||
);
|
||||
@ -125,7 +127,7 @@ class CMSSiteTreeFilterTest extends SapphireTest
|
||||
{
|
||||
$draftPage = $this->objFromFixture('Page', 'page4');
|
||||
$draftPage = Versioned::get_one_by_stage(
|
||||
'SilverStripe\\CMS\\Model\\SiteTree',
|
||||
SiteTree::class,
|
||||
'Stage',
|
||||
sprintf('"SiteTree"."ID" = %d', $draftPage->ID)
|
||||
);
|
||||
@ -163,7 +165,7 @@ class CMSSiteTreeFilterTest extends SapphireTest
|
||||
$removedDraftPage->publishRecursive();
|
||||
$removedDraftPage->deleteFromStage('Stage');
|
||||
$removedDraftPage = Versioned::get_one_by_stage(
|
||||
'SilverStripe\\CMS\\Model\\SiteTree',
|
||||
SiteTree::class,
|
||||
'Live',
|
||||
sprintf('"SiteTree"."ID" = %d', $removedDraftPage->ID)
|
||||
);
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\ORM\DataObject;
|
@ -1,17 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\Control\HTTPResponse_Exception;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class ContentControllerPermissionsTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected $autoFollowRedirection = false;
|
@ -1,11 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\CMS\Controllers\ContentController;
|
||||
use SilverStripe\CMS\Search\ContentControllerSearchExtension;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\ORM\Search\FulltextSearchable;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use Page;
|
||||
|
||||
class ContentControllerSearchExtensionTest extends SapphireTest
|
||||
{
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Controllers\ContentController;
|
||||
use SilverStripe\CMS\Controllers\RootURLController;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
@ -8,14 +10,10 @@ use SilverStripe\Control\HTTPResponse_Exception;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class ContentControllerTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected static $fixture_file = 'ContentControllerTest.yml';
|
||||
|
||||
protected static $use_draft_site = true;
|
||||
@ -100,7 +98,7 @@ class ContentControllerTest extends FunctionalTest
|
||||
|
||||
$page = new ContentControllerTest_Page();
|
||||
$page->ParentID = $parentID;
|
||||
$page->Title = "Page Level $i";
|
||||
$page->Title = "Page Level $i";
|
||||
$page->URLSegment = "level-$i";
|
||||
$page->write();
|
||||
|
||||
@ -154,13 +152,11 @@ class ContentControllerTest extends FunctionalTest
|
||||
/**
|
||||
* Tests that {@link ContentController::getViewer()} chooses the correct templates.
|
||||
*
|
||||
* @covers SilverStripe\CMS\Controllers\ContentController::getViewer()
|
||||
**/
|
||||
* @covers \SilverStripe\CMS\Controllers\ContentController::getViewer()
|
||||
**/
|
||||
public function testGetViewer()
|
||||
{
|
||||
|
||||
$self = $this;
|
||||
$this->useTestTheme(dirname(__FILE__), 'controllertest', function () use ($self) {
|
||||
$this->useTestTheme(__DIR__, 'controllertest', function () {
|
||||
|
||||
// Test a page without a controller (ContentControllerTest_PageWithoutController.ss)
|
||||
$page = new ContentControllerTestPageWithoutController();
|
||||
@ -168,8 +164,8 @@ class ContentControllerTest extends FunctionalTest
|
||||
$page->write();
|
||||
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||
|
||||
$response = $self->get($page->RelativeLink());
|
||||
$self->assertEquals("ContentControllerTestPageWithoutController", trim($response->getBody()));
|
||||
$response = $this->get($page->RelativeLink());
|
||||
$this->assertEquals("ContentControllerTestPageWithoutController", trim($response->getBody()));
|
||||
|
||||
// // This should fall over to user Page.ss
|
||||
$page = new ContentControllerTestPage();
|
||||
@ -177,8 +173,8 @@ class ContentControllerTest extends FunctionalTest
|
||||
$page->write();
|
||||
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||
|
||||
$response = $self->get($page->RelativeLink());
|
||||
$self->assertEquals("Page", trim($response->getBody()));
|
||||
$response = $this->get($page->RelativeLink());
|
||||
$this->assertEquals("Page", trim($response->getBody()));
|
||||
|
||||
|
||||
// Test that the action template is rendered.
|
||||
@ -187,20 +183,24 @@ class ContentControllerTest extends FunctionalTest
|
||||
$page->write();
|
||||
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||
|
||||
$response = $self->get($page->RelativeLink("test"));
|
||||
$self->assertEquals("ContentControllerTestPage_test", trim($response->getBody()));
|
||||
$response = $this->get($page->RelativeLink("test"));
|
||||
$this->assertEquals("ContentControllerTestPage_test", trim($response->getBody()));
|
||||
|
||||
// Test that an action without a template will default to the index template, which is
|
||||
// to say the default Page.ss template
|
||||
$response = $self->get($page->RelativeLink("testwithouttemplate"));
|
||||
$self->assertEquals("Page", trim($response->getBody()));
|
||||
$response = $this->get($page->RelativeLink("testwithouttemplate"));
|
||||
$this->assertEquals("Page", trim($response->getBody()));
|
||||
|
||||
// Test that an action with a template will render the both action template *and* the
|
||||
// correct parent template
|
||||
$controller = new ContentController($page);
|
||||
$viewer = $controller->getViewer('test');
|
||||
$templateList = array('ContentControllerTestPage_test', 'Page');
|
||||
$self->assertEquals(dirname(__FILE__).'/themes/controllertest/templates/ContentControllerTestPage_test.ss', $viewer->templates()['main']);
|
||||
$this->assertEquals(
|
||||
__DIR__
|
||||
. '/themes/controllertest/templates/SilverStripe/CMS/Tests/Controllers/'
|
||||
. 'ContentControllerTestPage_test.ss',
|
||||
$viewer->templates()['main']
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
@ -21,22 +21,22 @@ SilverStripe\Security\Member:
|
||||
Surname: Administrator
|
||||
Groups: =>SilverStripe\Security\Group.admins
|
||||
|
||||
ContentControllerTest_Page:
|
||||
SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page:
|
||||
root_page:
|
||||
Title: Home Page
|
||||
URLSegment: home
|
||||
second_level_page:
|
||||
Title: Second Level Page
|
||||
URLSegment: second-level
|
||||
Parent: =>ContentControllerTest_Page.root_page
|
||||
Parent: =>SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page.root_page
|
||||
third_level_page:
|
||||
Title: Third Level Page
|
||||
URLSegment: third-level
|
||||
Parent: =>ContentControllerTest_Page.second_level_page
|
||||
Parent: =>SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page.second_level_page
|
||||
third_level_page_2:
|
||||
Title: Third Level Page Two
|
||||
URLSegment: third-level-2
|
||||
Parent: =>ContentControllerTest_Page.second_level_page
|
||||
Parent: =>SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page.second_level_page
|
||||
contact_page:
|
||||
Title: Contact Page
|
||||
URLSegment: contact
|
11
tests/php/Controllers/ContentControllerTestPage.php
Normal file
11
tests/php/Controllers/ContentControllerTestPage.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class ContentControllerTestPage extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'ContentControllerTestPage';
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use PageController;
|
||||
|
||||
class ContentControllerTestPageController extends PageController implements TestOnly
|
||||
{
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class ContentControllerTestPageWithoutController extends Page implements TestOnly
|
||||
{
|
11
tests/php/Controllers/ContentControllerTest_Page.php
Normal file
11
tests/php/Controllers/ContentControllerTest_Page.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class ContentControllerTest_Page extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'ContentControllerTest_Page';
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use PageController;
|
||||
|
||||
class ContentControllerTest_PageController extends PageController implements TestOnly
|
||||
{
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Controllers\OldPageRedirector;
|
||||
@ -8,14 +10,10 @@ use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class ModelAsControllerTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected $usesDatabase = true;
|
||||
|
||||
protected $autoFollowRedirection = false;
|
@ -1,14 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Controllers\RootURLController;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class RootURLControllerTest extends SapphireTest
|
||||
{
|
||||
protected static $fixture_file = 'RootURLControllerTest.yml';
|
@ -1,22 +1,14 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Security\Security;
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigator;
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Security\Member;
|
||||
|
||||
class SilverStripeNavigatorTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected static $fixture_file = 'CMSMainTest.yml';
|
||||
|
||||
public function testGetItems()
|
||||
@ -33,7 +25,7 @@ class SilverStripeNavigatorTest extends SapphireTest
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
'SilverStripeNavigatorTest_TestItem',
|
||||
SilverStripeNavigatorTest_TestItem::class,
|
||||
$classes,
|
||||
'Autodiscovers new classes'
|
||||
);
|
||||
@ -49,11 +41,11 @@ class SilverStripeNavigatorTest extends SapphireTest
|
||||
$this->logInWithPermission('CMS_ACCESS_CMSMain');
|
||||
$items = $navigator->getItems();
|
||||
$classes = array_map('get_class', $items->toArray());
|
||||
$this->assertNotContains('SilverStripeNavigatorTest_ProtectedTestItem', $classes);
|
||||
$this->assertNotContains(SilverStripeNavigatorTest_ProtectedTestItem::class, $classes);
|
||||
|
||||
$this->logInWithPermission('ADMIN');
|
||||
$items = $navigator->getItems();
|
||||
$classes = array_map('get_class', $items->toArray());
|
||||
$this->assertContains('SilverStripeNavigatorTest_ProtectedTestItem', $classes);
|
||||
$this->assertContains(SilverStripeNavigatorTest_ProtectedTestItem::class, $classes);
|
||||
}
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Security\Permission;
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Controllers;
|
||||
|
||||
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Assets\Folder;
|
||||
use SilverStripe\Assets\Image;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
@ -9,10 +11,8 @@ use SilverStripe\Assets\File;
|
||||
use SilverStripe\Assets\Filesystem;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* Tests link tracking to files and images.
|
||||
*/
|
||||
class FileLinkTrackingTest extends SapphireTest
|
||||
{
|
||||
protected static $fixture_file = "FileLinkTrackingTest.yml";
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\RedirectorPage;
|
||||
use SilverStripe\CMS\Model\RedirectorPageController;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Core\Extension;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class RedirectorPageTest extends FunctionalTest
|
||||
{
|
||||
@ -91,13 +91,13 @@ class RedirectorPageTest extends FunctionalTest
|
||||
public function testRedirectRespectsFinishedResponse()
|
||||
{
|
||||
$page = $this->objFromFixture(RedirectorPage::class, 'goodinternal');
|
||||
RedirectorPageController::add_extension('RedirectorPageTest_RedirectExtension');
|
||||
RedirectorPageController::add_extension(RedirectorPageTest_RedirectExtension::class);
|
||||
|
||||
$response = $this->get($page->regularLink());
|
||||
$this->assertEquals(302, $response->getStatusCode());
|
||||
$this->assertEquals('http://www.mysite.com/foo', $response->getHeader('Location'));
|
||||
|
||||
RedirectorPageController::remove_extension('RedirectorPageTest_RedirectExtension');
|
||||
RedirectorPageController::remove_extension(RedirectorPageTest_RedirectExtension::class);
|
||||
}
|
||||
|
||||
public function testNoJSLinksAllowed()
|
@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Core\Extension;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class RedirectorPageTest_RedirectExtension extends Extension implements TestOnly
|
||||
{
|
||||
|
||||
public function onBeforeInit()
|
||||
{
|
||||
$this->owner->redirect('/foo');
|
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use Page;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
|
||||
/**
|
||||
* Possible actions:
|
||||
@ -17,9 +18,6 @@ use SilverStripe\Dev\TestOnly;
|
||||
* - action_archive
|
||||
* - action_rollback
|
||||
* - action_revert
|
||||
*
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class SiteTreeActionsTest extends FunctionalTest
|
||||
{
|
@ -1,7 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Security\Permission;
|
||||
use Page;
|
||||
|
||||
class SiteTreeActionsTest_Page extends Page implements TestOnly
|
||||
{
|
@ -1,14 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Control\HTTP;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Control\HTTP;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
|
||||
/**
|
||||
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
@ -9,12 +11,10 @@ use SilverStripe\CMS\Model\RedirectorPage;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking
|
||||
*
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class SiteTreeBrokenLinksTest extends SapphireTest
|
||||
{
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Assets\Filesystem;
|
||||
@ -37,11 +39,11 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
|
||||
|
||||
public function testLinkTracking()
|
||||
{
|
||||
$sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home');
|
||||
$sitetree = $this->objFromFixture(SiteTree::class, 'home');
|
||||
$editor = new HTMLEditorField('Content');
|
||||
|
||||
$aboutID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'about');
|
||||
$contactID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'contact');
|
||||
$aboutID = $this->idFromFixture(SiteTree::class, 'about');
|
||||
$contactID = $this->idFromFixture(SiteTree::class, 'contact');
|
||||
|
||||
$editor->setValue("<a href=\"[sitetree_link,id=$aboutID]\">Example Link</a>");
|
||||
$editor->saveInto($sitetree);
|
||||
@ -77,7 +79,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
|
||||
|
||||
public function testFileLinkTracking()
|
||||
{
|
||||
$sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home');
|
||||
$sitetree = $this->objFromFixture(SiteTree::class, 'home');
|
||||
$editor = new HTMLEditorField('Content');
|
||||
$fileID = $this->idFromFixture('SilverStripe\\Assets\\File', 'example_file');
|
||||
|
||||
@ -138,7 +140,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
|
||||
|
||||
public function testImageTracking()
|
||||
{
|
||||
$sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home');
|
||||
$sitetree = $this->objFromFixture(SiteTree::class, 'home');
|
||||
$editor = new HTMLEditorField('Content');
|
||||
$file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'example_image');
|
||||
|
||||
@ -175,7 +177,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
|
||||
|
||||
$editor->setValue(sprintf(
|
||||
'<p><a href="[sitetree_link,id=%d]">Working Link</a></p>',
|
||||
$this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home')
|
||||
$this->idFromFixture(SiteTree::class, 'home')
|
||||
));
|
||||
$sitetree->HasBrokenLink = false;
|
||||
$editor->saveInto($sitetree);
|
@ -1,9 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTreeLinkTracking_Parser;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\View\Parsers\HTMLValue;
|
||||
use Page;
|
||||
|
||||
class SiteTreeLinkTrackingTest extends SapphireTest
|
||||
{
|
@ -1,19 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Control\HTTPResponse_Exception;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Control\HTTPResponse_Exception;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*
|
||||
* @todo Test canAddChildren()
|
||||
* @todo Test canCreate()
|
||||
*/
|
@ -1,41 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use Page;
|
||||
use ReflectionMethod;
|
||||
use SilverStripe\CMS\Model\RedirectorPage;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\Control\ContentNegotiator;
|
||||
use SilverStripe\Control\Controller;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\Security\InheritedPermissions;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\i18n\i18n;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\ValidationException;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\ORM\HiddenClass;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\InheritedPermissions;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
use SilverStripe\Control\Session;
|
||||
use SilverStripe\View\Parsers\ShortcodeParser;
|
||||
use SilverStripe\Control\Director;
|
||||
use SilverStripe\i18n\i18n;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\View\Parsers\HTMLCleaner;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\View\Parsers\Diff;
|
||||
use SilverStripe\View\Parsers\ShortcodeParser;
|
||||
use SilverStripe\View\Parsers\URLSegmentFilter;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class SiteTreeTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected static $fixture_file = 'SiteTreeTest.yml';
|
||||
|
||||
protected static $illegal_extensions = array(
|
||||
@ -159,7 +152,7 @@ class SiteTreeTest extends SapphireTest
|
||||
$child = new SiteTreeTest_PageNode();
|
||||
|
||||
$child->setParent($parent);
|
||||
$this->assertInstanceOf('SiteTreeTest_PageNode', $child->Parent);
|
||||
$this->assertInstanceOf(SiteTreeTest_PageNode::class, $child->Parent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -635,7 +628,7 @@ class SiteTreeTest extends SapphireTest
|
||||
$this->assertTrue(singleton(SiteTree::class)->canCreate(null, array('Parent' => singleton(SiteTree::class))));
|
||||
|
||||
//Test we don't check for allowedChildren on parent context if it's not SiteTree instance
|
||||
$this->assertTrue(singleton(SiteTree::class)->canCreate(null, ['Parent' => $this->objFromFixture('SiteTreeTest_DataObject', 'relations')]));
|
||||
$this->assertTrue(singleton(SiteTree::class)->canCreate(null, ['Parent' => $this->objFromFixture(SiteTreeTest_DataObject::class, 'relations')]));
|
||||
}
|
||||
|
||||
public function testEditPermissionsOnDraftVsLive()
|
||||
@ -690,7 +683,7 @@ class SiteTreeTest extends SapphireTest
|
||||
{
|
||||
// Necessary to avoid
|
||||
$oldCleanerClass = Diff::$html_cleaner_class;
|
||||
Diff::$html_cleaner_class = 'SiteTreeTest_NullHtmlCleaner';
|
||||
Diff::$html_cleaner_class = SiteTreeTest_NullHtmlCleaner::class;
|
||||
|
||||
$page = new Page();
|
||||
$page->write();
|
||||
@ -947,7 +940,7 @@ class SiteTreeTest extends SapphireTest
|
||||
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||
|
||||
$sitetree = new SiteTree();
|
||||
$sitetree->ParentID = $this->idFromFixture('SiteTreeTest_Conflicted', 'parent');
|
||||
$sitetree->ParentID = $this->idFromFixture(SiteTreeTest_Conflicted::class, 'parent');
|
||||
|
||||
$sitetree->URLSegment = 'index';
|
||||
$this->assertFalse($sitetree->validURLSegment(), 'index is not a valid URLSegment');
|
||||
@ -968,11 +961,11 @@ class SiteTreeTest extends SapphireTest
|
||||
$sitetree->URLSegment = 'unique-segment';
|
||||
$this->assertTrue($sitetree->validURLSegment());
|
||||
|
||||
SiteTree::add_extension('SiteTreeTest_Extension');
|
||||
SiteTree::add_extension(SiteTreeTest_Extension::class);
|
||||
$sitetree = new SiteTree();
|
||||
$sitetree->URLSegment = 'unique-segment';
|
||||
$this->assertFalse($sitetree->validURLSegment());
|
||||
SiteTree::remove_extension('SiteTreeTest_Extension');
|
||||
SiteTree::remove_extension(SiteTreeTest_Extension::class);
|
||||
}
|
||||
|
||||
public function testURLSegmentMultiByte()
|
||||
@ -1424,6 +1417,6 @@ class SiteTreeTest extends SapphireTest
|
||||
public function testGetControllerNameWithUnderscoresIsSupported()
|
||||
{
|
||||
$class = new SiteTreeTest_LegacyControllerName;
|
||||
$this->assertSame('SiteTreeTest_LegacyControllerName_Controller', $class->getControllerName());
|
||||
$this->assertEquals(SiteTreeTest_LegacyControllerName_Controller::class, $class->getControllerName());
|
||||
}
|
||||
}
|
@ -113,7 +113,7 @@ Page:
|
||||
Title: 'Breadcrumbs 5'
|
||||
Parent: =>Page.breadcrumbs4
|
||||
|
||||
SiteTreeTest_Conflicted:
|
||||
SilverStripe\CMS\Tests\Model\SiteTreeTest_Conflicted:
|
||||
parent:
|
||||
Title: Parent
|
||||
|
||||
@ -124,7 +124,7 @@ SilverStripe\CMS\Model\RedirectorPage:
|
||||
RedirectionType: External
|
||||
ExternalURL: "http://www.google.com?a&b"
|
||||
|
||||
SiteTreeTest_DataObject:
|
||||
SilverStripe\CMS\Tests\Model\SiteTreeTest_DataObject:
|
||||
relations:
|
||||
Title: 'Linked DataObject'
|
||||
Pages: =>Page.home,=>Page.about,=>Page.staff
|
||||
Pages: =>Page.home,=>Page.about,=>Page.staff
|
15
tests/php/Model/SiteTreeTest_AdminDenied.php
Normal file
15
tests/php/Model/SiteTreeTest_AdminDenied.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_AdminDenied extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_AdminDenied';
|
||||
|
||||
private static $extensions = [
|
||||
SiteTreeTest_AdminDeniedExtension::class,
|
||||
];
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
|
@ -1,9 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_ClassA extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_ClassA';
|
||||
|
||||
private static $need_permission = [
|
||||
'ADMIN',
|
||||
'CMS_ACCESS_CMSMain'
|
16
tests/php/Model/SiteTreeTest_ClassB.php
Normal file
16
tests/php/Model/SiteTreeTest_ClassB.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_ClassB extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_ClassB';
|
||||
|
||||
// Also allowed subclasses
|
||||
private static $allowed_children = [
|
||||
SiteTreeTest_ClassC::class
|
||||
];
|
||||
}
|
@ -1,8 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_ClassC extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_ClassC';
|
||||
|
||||
private static $allowed_children = array();
|
||||
}
|
15
tests/php/Model/SiteTreeTest_ClassCext.php
Normal file
15
tests/php/Model/SiteTreeTest_ClassCext.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class SiteTreeTest_ClassCext extends SiteTreeTest_ClassC implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_ClassCext';
|
||||
|
||||
// Override SiteTreeTest_ClassC definitions
|
||||
private static $allowed_children = [
|
||||
SiteTreeTest_ClassB::class
|
||||
];
|
||||
}
|
@ -1,15 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_ClassD extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_ClassD';
|
||||
|
||||
// Only allows this class, no children classes
|
||||
private static $allowed_children = array('*SiteTreeTest_ClassC');
|
||||
private static $allowed_children = [
|
||||
'*' . SiteTreeTest_ClassC::class,
|
||||
];
|
||||
|
||||
private static $extensions = [
|
||||
'SiteTreeTest_ExtensionA',
|
||||
'SiteTreeTest_ExtensionB',
|
||||
SiteTreeTest_ExtensionA::class,
|
||||
SiteTreeTest_ExtensionB::class,
|
||||
];
|
||||
|
||||
public $canEditValue = null;
|
@ -1,9 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\HiddenClass;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_ClassE extends Page implements TestOnly, HiddenClass
|
||||
{
|
||||
|
||||
private static $table_name = 'SiteTreeTest_ClassE';
|
||||
}
|
11
tests/php/Model/SiteTreeTest_Conflicted.php
Normal file
11
tests/php/Model/SiteTreeTest_Conflicted.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_Conflicted extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_Conflicted';
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use PageController;
|
||||
|
||||
class SiteTreeTest_ConflictedController extends PageController implements TestOnly
|
||||
{
|
||||
|
||||
private static $allowed_actions = array(
|
||||
'conflicted-action'
|
||||
);
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
@ -12,6 +14,8 @@ use SilverStripe\ORM\DataObject;
|
||||
*/
|
||||
class SiteTreeTest_DataObject extends DataObject implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_DataObject';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTreeExtension;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
@ -1,11 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* An empty SiteTree instance with a controller to test that legacy controller names can still be loaded
|
||||
*/
|
||||
class SiteTreeTest_LegacyControllerName extends Page implements TestOnly
|
||||
{
|
||||
|
||||
private static $table_name = 'SiteTreeTest_LegacyControllerName';
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use PageController;
|
||||
|
||||
class SiteTreeTest_LegacyControllerName_Controller extends PageController implements TestOnly
|
||||
{
|
@ -1,8 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_NotRoot extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_NotRoot';
|
||||
|
||||
private static $can_be_root = false;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\View\Parsers\HTMLCleaner;
|
||||
|
11
tests/php/Model/SiteTreeTest_PageNode.php
Normal file
11
tests/php/Model/SiteTreeTest_PageNode.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class SiteTreeTest_PageNode extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_PageNode';
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use PageController;
|
||||
|
||||
class SiteTreeTest_PageNodeController extends PageController implements TestOnly
|
||||
{
|
@ -1,10 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class SiteTreeTest_StageStatusInherit extends SiteTree implements TestOnly
|
||||
{
|
||||
private static $table_name = 'SiteTreeTest_StageStatusInherit';
|
||||
|
||||
public function getStatusFlags($cached = true)
|
||||
{
|
||||
$flags = parent::getStatusFlags($cached);
|
@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use Page;
|
||||
use SilverStripe\CMS\Controllers\ModelAsController;
|
||||
use SilverStripe\CMS\Model\RedirectorPage;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
@ -7,7 +10,6 @@ use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\ValidationException;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
@ -18,23 +20,28 @@ class VirtualPageTest extends FunctionalTest
|
||||
protected static $use_draft_site = false;
|
||||
protected $autoFollowRedirection = false;
|
||||
|
||||
protected static $extra_dataobjects = array(
|
||||
'VirtualPageTest_ClassA',
|
||||
'VirtualPageTest_ClassB',
|
||||
'VirtualPageTest_ClassC',
|
||||
'VirtualPageTest_NotRoot',
|
||||
'VirtualPageTest_PageExtension',
|
||||
'VirtualPageTest_PageWithAllowedChildren',
|
||||
'VirtualPageTest_TestDBField',
|
||||
'VirtualPageTest_VirtualPageSub',
|
||||
);
|
||||
protected static $extra_dataobjects = [
|
||||
VirtualPageTest_ClassA::class,
|
||||
VirtualPageTest_ClassB::class,
|
||||
VirtualPageTest_ClassC::class,
|
||||
VirtualPageTest_NotRoot::class,
|
||||
VirtualPageTest_PageExtension::class,
|
||||
VirtualPageTest_PageWithAllowedChildren::class,
|
||||
VirtualPageTest_TestDBField::class,
|
||||
VirtualPageTest_VirtualPageSub::class,
|
||||
];
|
||||
|
||||
protected static $illegal_extensions = array(
|
||||
SiteTree::class => array('SiteTreeSubsites', 'Translatable'),
|
||||
SiteTree::class => [
|
||||
'SiteTreeSubsites',
|
||||
'Translatable'
|
||||
],
|
||||
);
|
||||
|
||||
protected static $required_extensions = array(
|
||||
SiteTree::class => array('VirtualPageTest_PageExtension')
|
||||
SiteTree::class => [
|
||||
VirtualPageTest_PageExtension::class
|
||||
]
|
||||
);
|
||||
|
||||
public function setUp()
|
||||
@ -46,7 +53,11 @@ class VirtualPageTest extends FunctionalTest
|
||||
|
||||
// Add extra fields
|
||||
Config::modify()->merge(VirtualPage::class, 'initially_copied_fields', array('MyInitiallyCopiedField'));
|
||||
Config::modify()->merge(VirtualPage::class, 'non_virtual_fields', array('MyNonVirtualField', 'MySharedNonVirtualField'));
|
||||
Config::modify()->merge(
|
||||
VirtualPage::class,
|
||||
'non_virtual_fields',
|
||||
array('MyNonVirtualField', 'MySharedNonVirtualField')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,6 +91,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
{
|
||||
$this->logInWithPermission('ADMIN');
|
||||
|
||||
/** @var Page $master */
|
||||
$master = $this->objFromFixture('Page', 'master');
|
||||
$master->publishRecursive();
|
||||
|
||||
@ -88,7 +100,9 @@ class VirtualPageTest extends FunctionalTest
|
||||
$master->Content = "<p>New content</p>";
|
||||
$master->write();
|
||||
|
||||
/** @var VirtualPage $vp1 */
|
||||
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, 'vp1'));
|
||||
/** @var VirtualPage $vp2 */
|
||||
$vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, 'vp2'));
|
||||
$this->assertTrue($vp1->publishRecursive());
|
||||
$this->assertTrue($vp2->publishRecursive());
|
||||
@ -221,6 +235,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
/** @var Page $parentPage */
|
||||
$parentPage = $this->objFromFixture('Page', 'master3');
|
||||
$parentPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||
/** @var VirtualPage $virtualPage */
|
||||
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp3');
|
||||
$virtualPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||
$cindy = $this->objFromFixture(Member::class, 'cindy');
|
||||
@ -309,10 +324,8 @@ class VirtualPageTest extends FunctionalTest
|
||||
$vp->flushCache();
|
||||
$vp = DataObject::get_by_id(SiteTree::class, $vpID);
|
||||
$this->assertEquals($p->ID, $vp->CopyContentFromID);
|
||||
|
||||
$vpLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree"."ID" = ' . $vpID);
|
||||
$vpLive = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE)->byID($vpID);
|
||||
$this->assertNull($vpLive);
|
||||
|
||||
// Delete from draft, ensure virtual page deletion cascades
|
||||
$p->delete();
|
||||
$vp->flushCache();
|
||||
@ -335,7 +348,6 @@ class VirtualPageTest extends FunctionalTest
|
||||
|
||||
// All is fine, the virtual page doesn't have a broken link
|
||||
$this->assertFalse($vp->HasBrokenLink);
|
||||
|
||||
// Delete the source page from draft, cascades to virtual page
|
||||
$pID = $p->ID;
|
||||
$p->delete();
|
||||
@ -343,8 +355,8 @@ class VirtualPageTest extends FunctionalTest
|
||||
$vpDraft = Versioned::get_by_stage(SiteTree::class, Versioned::DRAFT)
|
||||
->byID($pID);
|
||||
$this->assertNull($vpDraft);
|
||||
|
||||
// Delete the source page form live, confirm that the virtual page has also been unpublished
|
||||
/** @var Page $pLive */
|
||||
$pLive = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE)
|
||||
->byID($pID);
|
||||
$this->assertTrue($pLive->doUnpublish());
|
||||
@ -484,14 +496,19 @@ class VirtualPageTest extends FunctionalTest
|
||||
|
||||
|
||||
$nonVirtual = $virtual;
|
||||
$nonVirtual->ClassName = 'VirtualPageTest_ClassA';
|
||||
$nonVirtual->ClassName = VirtualPageTest_ClassA::class;
|
||||
$nonVirtual->MySharedNonVirtualField = 'changed on new type';
|
||||
$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
|
||||
$nonVirtualStage = Versioned::get_one_by_stage(SiteTree::class, 'Stage', '"SiteTree"."ID" = ' . $nonVirtual->ID, false);
|
||||
$nonVirtualStage = Versioned::get_one_by_stage(
|
||||
SiteTree::class,
|
||||
'Stage',
|
||||
'"SiteTree"."ID" = ' . $nonVirtual->ID,
|
||||
false
|
||||
);
|
||||
$this->assertNotNull($nonVirtualStage);
|
||||
$this->assertEquals('VirtualPageTest_ClassA', $nonVirtualStage->ClassName);
|
||||
$this->assertEquals(VirtualPageTest_ClassA::class, $nonVirtualStage->ClassName);
|
||||
$this->assertEquals('changed on new type', $nonVirtualStage->MySharedNonVirtualField);
|
||||
$this->assertEquals(
|
||||
'original',
|
||||
@ -500,9 +517,14 @@ class VirtualPageTest extends FunctionalTest
|
||||
);
|
||||
|
||||
// Virtual page on live keeps working as it should
|
||||
$virtualLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::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->assertEquals('VirtualPageTest_VirtualPageSub', $virtualLive->ClassName);
|
||||
$this->assertEquals(VirtualPageTest_VirtualPageSub::class, $virtualLive->ClassName);
|
||||
$this->assertEquals('virtual published field', $virtualLive->MySharedNonVirtualField);
|
||||
$this->assertEquals('published title', $virtualLive->Title);
|
||||
|
||||
@ -513,7 +535,12 @@ class VirtualPageTest extends FunctionalTest
|
||||
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||
|
||||
// Virtual page only notices changes to virtualised fields (Title)
|
||||
$virtualLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::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('title changed on original', $virtualLive->Title);
|
||||
}
|
||||
@ -527,7 +554,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
$virtual->CopyContentFromID = $page->ID;
|
||||
$virtual->write();
|
||||
|
||||
$this->assertEquals('VirtualPageTest_TestDBField', $virtual->castingHelper('CastingTest'));
|
||||
$this->assertEquals(VirtualPageTest_TestDBField::class, $virtual->castingHelper('CastingTest'));
|
||||
$this->assertEquals('SOME CONTENT', $virtual->obj('CastingTest')->forTemplate());
|
||||
}
|
||||
|
||||
@ -610,10 +637,11 @@ class VirtualPageTest extends FunctionalTest
|
||||
|
||||
public function testMethod()
|
||||
{
|
||||
/** @var VirtualPage $virtualPage */
|
||||
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
|
||||
/** @var VirtualPageTest_ClassAController $controller */
|
||||
$controller = ModelAsController::controller_for($virtualPage);
|
||||
|
||||
$this->assertInstanceOf('VirtualPageTest_ClassAController', $controller);
|
||||
$this->assertInstanceOf(VirtualPageTest_ClassAController::class, $controller);
|
||||
$this->assertTrue($controller->hasMethod('testMethod'));
|
||||
$this->assertEquals('hello', $controller->testMethod());
|
||||
$this->assertTrue($controller->hasMethod('modelMethod'));
|
||||
@ -622,6 +650,7 @@ class VirtualPageTest extends FunctionalTest
|
||||
|
||||
public function testAllowedActions()
|
||||
{
|
||||
/** @var VirtualPage $virtualPage */
|
||||
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
|
||||
$controller = ModelAsController::controller_for($virtualPage);
|
||||
$this->assertContains('testaction', $controller->allowedActions());
|
@ -45,7 +45,7 @@ Page:
|
||||
CanEditType: OnlyTheseUsers
|
||||
CanViewType: Inherit
|
||||
EditorGroups: =>SilverStripe\Security\Group.bobgroup
|
||||
VirtualPageTest_ClassA:
|
||||
SilverStripe\CMS\Tests\Model\VirtualPageTest_ClassA:
|
||||
pagea:
|
||||
Title: 'Page A'
|
||||
Content: '<p>Content</p>'
|
||||
@ -66,5 +66,5 @@ SilverStripe\CMS\Model\VirtualPage:
|
||||
EditorGroups: =>SilverStripe\Security\Group.andrewgroup
|
||||
ViewerGroups: =>SilverStripe\Security\Group.cindygroup
|
||||
vp4:
|
||||
CopyContentFrom: =>VirtualPageTest_ClassA.pagea
|
||||
CopyContentFrom: =>SilverStripe\CMS\Tests\Model\VirtualPageTest_ClassA.pagea
|
||||
Title: 'vp4'
|
@ -1,17 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class VirtualPageTest_ClassA extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'VirtualPageTest_ClassA';
|
||||
|
||||
private static $db = array(
|
||||
'MyInitiallyCopiedField' => 'Text',
|
||||
'MyVirtualField' => 'Text',
|
||||
'MyNonVirtualField' => 'Text',
|
||||
'CastingTest' => 'VirtualPageTest_TestDBField'
|
||||
'CastingTest' => VirtualPageTest_TestDBField::class,
|
||||
);
|
||||
|
||||
private static $allowed_children = array('VirtualPageTest_ClassB');
|
||||
private static $allowed_children = [
|
||||
VirtualPageTest_ClassB::class,
|
||||
];
|
||||
|
||||
public function modelMethod()
|
||||
{
|
@ -1,6 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use PageController;
|
||||
|
||||
class VirtualPageTest_ClassAController extends PageController implements TestOnly
|
||||
{
|
15
tests/php/Model/VirtualPageTest_ClassB.php
Normal file
15
tests/php/Model/VirtualPageTest_ClassB.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class VirtualPageTest_ClassB extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'VirtualPageTest_ClassB';
|
||||
|
||||
private static $allowed_children = [
|
||||
VirtualPageTest_ClassC::class,
|
||||
];
|
||||
}
|
@ -1,8 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class VirtualPageTest_ClassC extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'VirtualPageTest_ClassC';
|
||||
|
||||
private static $allowed_children = array();
|
||||
}
|
@ -1,8 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class VirtualPageTest_NotRoot extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'VirtualPageTest_NotRoot';
|
||||
|
||||
private static $can_be_root = false;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
|
@ -1,10 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use Page;
|
||||
|
||||
class VirtualPageTest_PageWithAllowedChildren extends Page implements TestOnly
|
||||
{
|
||||
private static $table_name = 'VirtualPageTest_PageWithAllowedChildren';
|
||||
|
||||
private static $allowed_children = array(
|
||||
VirtualPageTest_ClassA::class,
|
||||
VirtualPage::class,
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||
|
@ -1,10 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Model;
|
||||
|
||||
use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
|
||||
class VirtualPageTest_VirtualPageSub extends VirtualPage implements TestOnly
|
||||
{
|
||||
private static $table_name = 'VirtualPageTest_VirtualPageSub';
|
||||
|
||||
private static $db = array(
|
||||
'MyProperty' => 'Varchar',
|
||||
);
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Reports;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||
@ -13,11 +15,8 @@ use SilverStripe\CMS\Reports\BrokenRedirectorPagesReport;
|
||||
use SilverStripe\Reports\Report;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use Page;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class CmsReportsTest extends SapphireTest
|
||||
{
|
||||
|
||||
@ -43,14 +42,12 @@ class CmsReportsTest extends SapphireTest
|
||||
/**
|
||||
* ASSERT whether a report is returning the correct results, based on a broken "draft" and/or "published" page.
|
||||
*
|
||||
* @parameter ss_report
|
||||
* @parameter boolean
|
||||
* @parameter boolean
|
||||
* @param Report $report
|
||||
* @param bool $isDraftBroken
|
||||
* @param bool $isPublishedBroken
|
||||
*/
|
||||
|
||||
public function isReportBroken($report, $isDraftBroken, $isPublishedBroken)
|
||||
{
|
||||
|
||||
$class = get_class($report);
|
||||
|
||||
// ASSERT that the "draft" report is returning the correct results.
|
@ -1,15 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Search;
|
||||
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Security\Member;
|
||||
|
||||
class CMSMainSearchFormTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected static $fixture_file = '../controller/CMSMainTest.yml';
|
||||
protected static $fixture_file = '../Controllers/CMSMainTest.yml';
|
||||
|
||||
public function testTitleFilter()
|
||||
{
|
||||
$this->session()->set('loggedInAs', $this->idFromFixture('SilverStripe\\Security\\Member', 'admin'));
|
||||
$this->session()->set('loggedInAs', $this->idFromFixture(Member::class, 'admin'));
|
||||
|
||||
$response = $this->get(
|
||||
'admin/pages/SearchForm/?' .
|
@ -1,25 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Search;
|
||||
|
||||
use Page;
|
||||
use SilverStripe\Assets\File;
|
||||
use SilverStripe\CMS\Controllers\ContentController;
|
||||
use SilverStripe\CMS\Controllers\ModelAsController;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Search\SearchForm;
|
||||
use SilverStripe\Control\HTTPRequest;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\MSSQL\MSSQLDatabase;
|
||||
use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\Search\FulltextSearchable;
|
||||
use SilverStripe\PostgreSQL\PostgreSQLDatabase;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Security;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\MSSQL\MSSQLDatabase;
|
||||
use SilverStripe\PostgreSQL\PostgreSQLDatabase;
|
||||
use SilverStripe\CMS\Controllers\ContentController;
|
||||
use SilverStripe\CMS\Search\SearchForm;
|
||||
use SilverStripe\ORM\Search\FulltextSearchable;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
use SilverStripe\Security\Member;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage testing
|
||||
*
|
||||
* @todo Fix unpublished pages check in testPublishedPagesMatchedByTitle()
|
||||
* @todo All tests run on unpublished pages at the moment, due to the searchform not distinguishing between them
|
||||
*
|
@ -1,16 +1,14 @@
|
||||
<?php
|
||||
|
||||
use SilverStripe\ORM\DataObject;
|
||||
namespace SilverStripe\CMS\Tests\Tasks;
|
||||
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
use SilverStripe\CMS\Tasks\MigrateSiteTreeLinkingTask;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
|
||||
/**
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class MigrateSiteTreeLinkingTaskTest extends SapphireTest
|
||||
{
|
||||
|
||||
protected static $fixture_file = 'MigrateSiteTreeLinkingTaskTest.yml';
|
||||
|
||||
protected static $use_draft_site = true;
|
||||
@ -29,11 +27,11 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
|
||||
);
|
||||
ob_end_clean();
|
||||
|
||||
$homeID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home');
|
||||
$aboutID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'about');
|
||||
$staffID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'staff');
|
||||
$actionID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'action');
|
||||
$hashID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'hash_link');
|
||||
$homeID = $this->idFromFixture(SiteTree::class, 'home');
|
||||
$aboutID = $this->idFromFixture(SiteTree::class, 'about');
|
||||
$staffID = $this->idFromFixture(SiteTree::class, 'staff');
|
||||
$actionID = $this->idFromFixture(SiteTree::class, 'action');
|
||||
$hashID = $this->idFromFixture(SiteTree::class, 'hash_link');
|
||||
|
||||
$homeContent = sprintf(
|
||||
'<a href="[sitetree_link,id=%d]">About</a><a href="[sitetree_link,id=%d]">Staff</a><a href="http://silverstripe.org/">External Link</a><a name="anchor"></a>',
|
||||
@ -62,25 +60,25 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
|
||||
|
||||
$this->assertEquals(
|
||||
$homeContent,
|
||||
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $homeID)->Content,
|
||||
DataObject::get_by_id(SiteTree::class, $homeID)->Content,
|
||||
'HTML URLSegment links are rewritten.'
|
||||
);
|
||||
$this->assertEquals(
|
||||
$aboutContent,
|
||||
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $aboutID)->Content
|
||||
DataObject::get_by_id(SiteTree::class, $aboutID)->Content
|
||||
);
|
||||
$this->assertEquals(
|
||||
$staffContent,
|
||||
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $staffID)->Content
|
||||
DataObject::get_by_id(SiteTree::class, $staffID)->Content
|
||||
);
|
||||
$this->assertEquals(
|
||||
$actionContent,
|
||||
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $actionID)->Content,
|
||||
DataObject::get_by_id(SiteTree::class, $actionID)->Content,
|
||||
'Links to actions on pages are rewritten correctly.'
|
||||
);
|
||||
$this->assertEquals(
|
||||
$hashLinkContent,
|
||||
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $hashID)->Content,
|
||||
DataObject::get_by_id(SiteTree::class, $hashID)->Content,
|
||||
'Hash/anchor links are correctly handled.'
|
||||
);
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace SilverStripe\CMS\Tests\Tasks;
|
||||
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\Dev\FunctionalTest;
|
||||
|
||||
@ -30,13 +32,9 @@ use SilverStripe\Dev\FunctionalTest;
|
||||
* </code>
|
||||
*
|
||||
* @author Ingo Schommer (<firstname>@silverstripe.com), SilverStripe Ltd.
|
||||
*
|
||||
* @package cms
|
||||
* @subpackage tests
|
||||
*/
|
||||
class RemoveOrphanedPagesTaskTest extends FunctionalTest
|
||||
{
|
||||
|
||||
protected static $fixture_file = 'RemoveOrphanedPagesTaskTest.yml';
|
||||
|
||||
protected static $use_draft_site = false;
|
Loading…
Reference in New Issue
Block a user