Manual fixes to automatic namespacing

This commit is contained in:
Damian Mooyman 2017-08-09 14:53:38 +12:00
parent 9f268a18b5
commit 4f6af36369
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
79 changed files with 313 additions and 493 deletions

View File

@ -61,7 +61,7 @@ before_script:
- if [[ $BEHAT_TEST ]]; then (vendor/bin/serve --bootstrap-file tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi - if [[ $BEHAT_TEST ]]; then (vendor/bin/serve --bootstrap-file tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi
script: 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 [[ $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-files --quiet -w --relative=client; fi
- if [[ $NPM_TEST ]]; then git diff -w --no-color --relative=client; fi - if [[ $NPM_TEST ]]; then git diff -w --no-color --relative=client; fi

View File

@ -40,11 +40,13 @@
} }
}, },
"scripts": { "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": { "autoload": {
"psr-4": { "psr-4": {
"SilverStripe\\CMS\\": "code/", "SilverStripe\\CMS\\": "code/",
"SilverStripe\\CMS\\Tests\\": "code/php/",
"SilverStripe\\CMS\\Tests\\Behaviour\\": "tests/behat/src/" "SilverStripe\\CMS\\Tests\\Behaviour\\": "tests/behat/src/"
} }
}, },

View File

@ -9,10 +9,6 @@
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore" /> <exclude name="PSR2.Classes.PropertyDeclaration.Underscore" />
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" /> <exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />
<exclude name="Generic.Files.LineLength.TooLong" /> <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> </rule>
</ruleset> </ruleset>

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\BatchActions\CMSBatchAction_Archive; use SilverStripe\CMS\BatchActions\CMSBatchAction_Archive;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
@ -11,8 +10,6 @@ use SilverStripe\CMS\BatchActions\CMSBatchAction_Restore;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
/** /**
* Tests CMS Specific subclasses of {@see CMSBatchAction} * Tests CMS Specific subclasses of {@see CMSBatchAction}
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use Page;
use Psr\SimpleCache\CacheInterface; use Psr\SimpleCache\CacheInterface;
use SilverStripe\Admin\CMSBatchActionHandler; use SilverStripe\Admin\CMSBatchActionHandler;
use SilverStripe\CMS\Controllers\CMSMain; use SilverStripe\CMS\Controllers\CMSMain;
@ -19,21 +19,13 @@ use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\HiddenClass; use SilverStripe\Security\Member;
use SilverStripe\ORM\ValidationException;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use Page;
/**
* @package cms
* @subpackage tests
*/
class CMSMainTest extends FunctionalTest class CMSMainTest extends FunctionalTest
{ {
protected static $fixture_file = 'CMSMainTest.yml'; protected static $fixture_file = 'CMSMainTest.yml';
static protected $orig = array(); static protected $orig = array();
@ -55,11 +47,11 @@ class CMSMainTest extends FunctionalTest
{ {
$cache = Injector::inst()->get(CacheInterface::class . '.CMSMain_SiteTreeHints'); $cache = Injector::inst()->get(CacheInterface::class . '.CMSMain_SiteTreeHints');
// Login as user with root creation privileges // Login as user with root creation privileges
$user = $this->objFromFixture('SilverStripe\\Security\\Member', 'rootedituser'); $user = $this->objFromFixture(Member::class, 'rootedituser');
Security::setCurrentUser($user); Security::setCurrentUser($user);
$cache->clear(); $cache->clear();
$rawHints = singleton('SilverStripe\\CMS\\Controllers\\CMSMain')->SiteTreeHints(); $rawHints = singleton(CMSMain::class)->SiteTreeHints();
$this->assertNotNull($rawHints); $this->assertNotNull($rawHints);
$rawHints = preg_replace('/^"(.*)"$/', '$1', Convert::xml2raw($rawHints)); $rawHints = preg_replace('/^"(.*)"$/', '$1', Convert::xml2raw($rawHints));
@ -70,25 +62,25 @@ class CMSMainTest extends FunctionalTest
$this->assertArrayHasKey('All', $hints); $this->assertArrayHasKey('All', $hints);
$this->assertArrayHasKey( $this->assertArrayHasKey(
'CMSMainTest_ClassA', CMSMainTest_ClassA::class,
$hints['All'], $hints['All'],
'Global list shows allowed classes' 'Global list shows allowed classes'
); );
$this->assertArrayNotHasKey( $this->assertArrayNotHasKey(
'CMSMainTest_HiddenClass', CMSMainTest_HiddenClass::class,
$hints['All'], $hints['All'],
'Global list does not list hidden classes' 'Global list does not list hidden classes'
); );
$this->assertNotContains( $this->assertNotContains(
'CMSMainTest_ClassA', CMSMainTest_ClassA::class,
$hints['Root']['disallowedChildren'], $hints['Root']['disallowedChildren'],
'Limits root classes' 'Limits root classes'
); );
$this->assertContains( $this->assertContains(
'CMSMainTest_NotRoot', CMSMainTest_NotRoot::class,
$hints['Root']['disallowedChildren'], $hints['Root']['disallowedChildren'],
'Limits root classes' 'Limits root classes'
); );
@ -118,7 +110,7 @@ class CMSMainTest extends FunctionalTest
// But it can create a ClassB // But it can create a ClassB
$this->assertNotContains( $this->assertNotContains(
'CMSMainTest_ClassB', CMSMainTest_ClassB::class,
$children, $children,
'Limited parent omits explicitly allowed classes in disallowedChildren' 'Limited parent omits explicitly allowed classes in disallowedChildren'
); );
@ -131,7 +123,7 @@ class CMSMainTest extends FunctionalTest
{ {
$page1 = $this->objFromFixture(Page::class, "page1"); $page1 = $this->objFromFixture(Page::class, "page1");
$page2 = $this->objFromFixture(Page::class, "page2"); $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'); $response = $this->get('admin/pages/publishall?confirm=1');
$this->assertContains( $this->assertContains(
@ -283,8 +275,8 @@ class CMSMainTest extends FunctionalTest
$origFollow = $this->autoFollowRedirection; $origFollow = $this->autoFollowRedirection;
$this->autoFollowRedirection = false; $this->autoFollowRedirection = false;
$cmsUser = $this->objFromFixture('SilverStripe\\Security\\Member', 'allcmssectionsuser'); $cmsUser = $this->objFromFixture(Member::class, 'allcmssectionsuser');
$rootEditUser = $this->objFromFixture('SilverStripe\\Security\\Member', 'rootedituser'); $rootEditUser = $this->objFromFixture(Member::class, 'rootedituser');
// with insufficient permissions // with insufficient permissions
Security::setCurrentUser($cmsUser); Security::setCurrentUser($cmsUser);
@ -337,7 +329,7 @@ class CMSMainTest extends FunctionalTest
$origFollow = $this->autoFollowRedirection; $origFollow = $this->autoFollowRedirection;
$this->autoFollowRedirection = false; $this->autoFollowRedirection = false;
$adminUser = $this->objFromFixture('SilverStripe\\Security\\Member', 'admin'); $adminUser = $this->objFromFixture(Member::class, 'admin');
Security::setCurrentUser($adminUser); Security::setCurrentUser($adminUser);
// Create toplevel page // Create toplevel page
@ -346,7 +338,7 @@ class CMSMainTest extends FunctionalTest
'admin/pages/add/AddForm', 'admin/pages/add/AddForm',
array( array(
'ParentID' => '0', 'ParentID' => '0',
'PageType' => 'CMSMainTest_ClassA', 'PageType' => CMSMainTest_ClassA::class,
'Locale' => 'en_US', 'Locale' => 'en_US',
'action_doAdd' => 1, 'action_doAdd' => 1,
'ajax' => 1 'ajax' => 1
@ -366,7 +358,7 @@ class CMSMainTest extends FunctionalTest
'admin/pages/add/AddForm', 'admin/pages/add/AddForm',
array( array(
'ParentID' => $newPageId, 'ParentID' => $newPageId,
'PageType' => 'CMSMainTest_ClassB', 'PageType' => CMSMainTest_ClassB::class,
'Locale' => 'en_US', 'Locale' => 'en_US',
'action_doAdd' => 1, 'action_doAdd' => 1,
'ajax' => 1 'ajax' => 1
@ -412,7 +404,7 @@ class CMSMainTest extends FunctionalTest
{ {
$page3 = $this->objFromFixture(Page::class, 'page3'); $page3 = $this->objFromFixture(Page::class, 'page3');
$page31 = $this->objFromFixture(Page::class, 'page31'); $page31 = $this->objFromFixture(Page::class, 'page31');
$adminuser = $this->objFromFixture('SilverStripe\\Security\\Member', 'admin'); $adminuser = $this->objFromFixture(Member::class, 'admin');
Security::setCurrentUser($adminuser); Security::setCurrentUser($adminuser);
$response = $this->get('admin/pages/edit/show/' . $page31->ID); $response = $this->get('admin/pages/edit/show/' . $page31->ID);
@ -572,17 +564,17 @@ class CMSMainTest extends FunctionalTest
$page->write(); $page->write();
$form = $cms->getEditForm($page->ID); $form = $cms->getEditForm($page->ID);
$form->loadDataFrom(['ClassName' => 'CMSMainTest_ClassB']); $form->loadDataFrom(['ClassName' => CMSMainTest_ClassB::class]);
$result = $cms->save([ $result = $cms->save([
'ID' => $page->ID, 'ID' => $page->ID,
'ClassName' => 'CMSMainTest_ClassB' 'ClassName' => CMSMainTest_ClassB::class
], $form); ], $form);
$this->assertEquals(200, $result->getStatusCode()); $this->assertEquals(200, $result->getStatusCode());
$newPage = SiteTree::get()->byID($page->ID); $newPage = SiteTree::get()->byID($page->ID);
$this->assertInstanceOf('CMSMainTest_ClassB', $newPage); $this->assertInstanceOf(CMSMainTest_ClassB::class, $newPage);
$this->assertEquals('CMSMainTest_ClassB', $newPage->ClassName); $this->assertEquals(CMSMainTest_ClassB::class, $newPage->ClassName);
$this->assertEquals('Class A', $newPage->Title); $this->assertEquals('Class A', $newPage->Title);
} }
} }

View File

@ -1,16 +1,16 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\ValidationException; use SilverStripe\ORM\ValidationException;
use Page; use Page;
class CMSMainTest_ClassA extends Page implements TestOnly 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() protected function onBeforeWrite()
{ {

View File

@ -1,15 +1,15 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\ValidationException; use SilverStripe\ORM\ValidationException;
use Page; use Page;
class CMSMainTest_ClassB extends Page implements TestOnly class CMSMainTest_ClassB extends Page implements TestOnly
{ {
private static $table_name = 'CMSMainTest_ClassB';
protected function onBeforeWrite() protected function onBeforeWrite()
{ {
parent::onBeforeWrite(); parent::onBeforeWrite();

View File

@ -1,13 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\HiddenClass; use SilverStripe\ORM\HiddenClass;
use Page; use Page;
class CMSMainTest_HiddenClass extends Page implements TestOnly, HiddenClass class CMSMainTest_HiddenClass extends Page implements TestOnly, HiddenClass
{ {

View File

@ -1,13 +1,13 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class CMSMainTest_NotRoot extends Page implements TestOnly class CMSMainTest_NotRoot extends Page implements TestOnly
{ {
private static $table_name = 'CMSMainTest_NotRoot';
private static $can_be_root = false; private static $can_be_root = false;
} }

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\Forms\FieldGroup; use SilverStripe\Forms\FieldGroup;
@ -14,11 +13,6 @@ use SilverStripe\CMS\Controllers\CMSPageHistoryController;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use Page; use Page;
/**
* @package cms
* @subpackage tests
*/
class CMSPageHistoryControllerTest extends FunctionalTest class CMSPageHistoryControllerTest extends FunctionalTest
{ {
protected static $fixture_file = 'CMSPageHistoryControllerTest.yml'; protected static $fixture_file = 'CMSPageHistoryControllerTest.yml';

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
@ -13,8 +12,6 @@ use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusRemovedFromDraftPages;
use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusDeletedPages; use SilverStripe\CMS\Controllers\CMSSiteTreeFilter_StatusDeletedPages;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
class CMSSiteTreeFilterTest extends SapphireTest class CMSSiteTreeFilterTest extends SapphireTest
{ {
@ -113,7 +110,7 @@ class CMSSiteTreeFilterTest extends SapphireTest
$deletedPageID = $deletedPage->ID; $deletedPageID = $deletedPage->ID;
$deletedPage->delete(); $deletedPage->delete();
$deletedPage = Versioned::get_one_by_stage( $deletedPage = Versioned::get_one_by_stage(
'SilverStripe\\CMS\\Model\\SiteTree', SiteTree::class,
'Live', 'Live',
array('"SiteTree_Live"."ID"' => $deletedPageID) array('"SiteTree_Live"."ID"' => $deletedPageID)
); );
@ -130,7 +127,7 @@ class CMSSiteTreeFilterTest extends SapphireTest
{ {
$draftPage = $this->objFromFixture('Page', 'page4'); $draftPage = $this->objFromFixture('Page', 'page4');
$draftPage = Versioned::get_one_by_stage( $draftPage = Versioned::get_one_by_stage(
'SilverStripe\\CMS\\Model\\SiteTree', SiteTree::class,
'Stage', 'Stage',
sprintf('"SiteTree"."ID" = %d', $draftPage->ID) sprintf('"SiteTree"."ID" = %d', $draftPage->ID)
); );
@ -168,7 +165,7 @@ class CMSSiteTreeFilterTest extends SapphireTest
$removedDraftPage->publishRecursive(); $removedDraftPage->publishRecursive();
$removedDraftPage->deleteFromStage('Stage'); $removedDraftPage->deleteFromStage('Stage');
$removedDraftPage = Versioned::get_one_by_stage( $removedDraftPage = Versioned::get_one_by_stage(
'SilverStripe\\CMS\\Model\\SiteTree', SiteTree::class,
'Live', 'Live',
sprintf('"SiteTree"."ID" = %d', $removedDraftPage->ID) sprintf('"SiteTree"."ID" = %d', $removedDraftPage->ID)
); );

View File

@ -1,14 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
/** /**
* Tests for tree-operations refactored out of LeftAndMain * Tests for tree-operations refactored out of LeftAndMain
*/ */

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\Control\HTTPResponse_Exception; use SilverStripe\Control\HTTPResponse_Exception;
@ -9,14 +8,8 @@ use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use Page; use Page;
/**
* @package cms
* @subpackage tests
*/
class ContentControllerPermissionsTest extends FunctionalTest class ContentControllerPermissionsTest extends FunctionalTest
{ {
protected $usesDatabase = true; protected $usesDatabase = true;
protected $autoFollowRedirection = false; protected $autoFollowRedirection = false;

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
use SilverStripe\CMS\Controllers\ContentController; use SilverStripe\CMS\Controllers\ContentController;
@ -11,7 +10,6 @@ use SilverStripe\ORM\Search\FulltextSearchable;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use Page; use Page;
class ContentControllerSearchExtensionTest extends SapphireTest class ContentControllerSearchExtensionTest extends SapphireTest
{ {
protected static $required_extensions = array( protected static $required_extensions = array(

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\Controllers\ContentController; use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Controllers\RootURLController; use SilverStripe\CMS\Controllers\RootURLController;
@ -13,14 +12,8 @@ use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use Page; use Page;
/**
* @package cms
* @subpackage tests
*/
class ContentControllerTest extends FunctionalTest class ContentControllerTest extends FunctionalTest
{ {
protected static $fixture_file = 'ContentControllerTest.yml'; protected static $fixture_file = 'ContentControllerTest.yml';
protected static $use_draft_site = true; protected static $use_draft_site = true;
@ -159,13 +152,11 @@ class ContentControllerTest extends FunctionalTest
/** /**
* Tests that {@link ContentController::getViewer()} chooses the correct templates. * Tests that {@link ContentController::getViewer()} chooses the correct templates.
* *
* @covers SilverStripe\CMS\Controllers\ContentController::getViewer() * @covers \SilverStripe\CMS\Controllers\ContentController::getViewer()
**/ **/
public function testGetViewer() public function testGetViewer()
{ {
$this->useTestTheme(__DIR__, 'controllertest', function () {
$self = $this;
$this->useTestTheme(dirname(__FILE__), 'controllertest', function () use ($self) {
// Test a page without a controller (ContentControllerTest_PageWithoutController.ss) // Test a page without a controller (ContentControllerTest_PageWithoutController.ss)
$page = new ContentControllerTestPageWithoutController(); $page = new ContentControllerTestPageWithoutController();
@ -173,8 +164,8 @@ class ContentControllerTest extends FunctionalTest
$page->write(); $page->write();
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
$response = $self->get($page->RelativeLink()); $response = $this->get($page->RelativeLink());
$self->assertEquals("ContentControllerTestPageWithoutController", trim($response->getBody())); $this->assertEquals("ContentControllerTestPageWithoutController", trim($response->getBody()));
// // This should fall over to user Page.ss // // This should fall over to user Page.ss
$page = new ContentControllerTestPage(); $page = new ContentControllerTestPage();
@ -182,8 +173,8 @@ class ContentControllerTest extends FunctionalTest
$page->write(); $page->write();
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
$response = $self->get($page->RelativeLink()); $response = $this->get($page->RelativeLink());
$self->assertEquals("Page", trim($response->getBody())); $this->assertEquals("Page", trim($response->getBody()));
// Test that the action template is rendered. // Test that the action template is rendered.
@ -192,20 +183,24 @@ class ContentControllerTest extends FunctionalTest
$page->write(); $page->write();
$page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
$response = $self->get($page->RelativeLink("test")); $response = $this->get($page->RelativeLink("test"));
$self->assertEquals("ContentControllerTestPage_test", trim($response->getBody())); $this->assertEquals("ContentControllerTestPage_test", trim($response->getBody()));
// Test that an action without a template will default to the index template, which is // Test that an action without a template will default to the index template, which is
// to say the default Page.ss template // to say the default Page.ss template
$response = $self->get($page->RelativeLink("testwithouttemplate")); $response = $this->get($page->RelativeLink("testwithouttemplate"));
$self->assertEquals("Page", trim($response->getBody())); $this->assertEquals("Page", trim($response->getBody()));
// Test that an action with a template will render the both action template *and* the // Test that an action with a template will render the both action template *and* the
// correct parent template // correct parent template
$controller = new ContentController($page); $controller = new ContentController($page);
$viewer = $controller->getViewer('test'); $viewer = $controller->getViewer('test');
$templateList = array('ContentControllerTestPage_test', 'Page'); $this->assertEquals(
$self->assertEquals(dirname(__FILE__).'/themes/controllertest/templates/ContentControllerTestPage_test.ss', $viewer->templates()['main']); __DIR__
. '/themes/controllertest/templates/SilverStripe/CMS/Tests/Controllers/'
. 'ContentControllerTestPage_test.ss',
$viewer->templates()['main']
);
}); });
} }
} }

View File

@ -21,22 +21,22 @@ SilverStripe\Security\Member:
Surname: Administrator Surname: Administrator
Groups: =>SilverStripe\Security\Group.admins Groups: =>SilverStripe\Security\Group.admins
ContentControllerTest_Page: SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page:
root_page: root_page:
Title: Home Page Title: Home Page
URLSegment: home URLSegment: home
second_level_page: second_level_page:
Title: Second Level Page Title: Second Level Page
URLSegment: second-level URLSegment: second-level
Parent: =>ContentControllerTest_Page.root_page Parent: =>SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page.root_page
third_level_page: third_level_page:
Title: Third Level Page Title: Third Level Page
URLSegment: third-level URLSegment: third-level
Parent: =>ContentControllerTest_Page.second_level_page Parent: =>SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page.second_level_page
third_level_page_2: third_level_page_2:
Title: Third Level Page Two Title: Third Level Page Two
URLSegment: third-level-2 URLSegment: third-level-2
Parent: =>ContentControllerTest_Page.second_level_page Parent: =>SilverStripe\CMS\Tests\Controllers\ContentControllerTest_Page.second_level_page
contact_page: contact_page:
Title: Contact Page Title: Contact Page
URLSegment: contact URLSegment: contact

View File

@ -1,13 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class ContentControllerTestPage extends Page implements TestOnly class ContentControllerTestPage extends Page implements TestOnly
{ {
private static $table_name = 'ContentControllerTestPage';
} }

View File

@ -1,12 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use PageController; use PageController;
class ContentControllerTestPageController extends PageController implements TestOnly class ContentControllerTestPageController extends PageController implements TestOnly
{ {
private static $allowed_actions = array( private static $allowed_actions = array(

View File

@ -1,12 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class ContentControllerTestPageWithoutController extends Page implements TestOnly class ContentControllerTestPageWithoutController extends Page implements TestOnly
{ {

View File

@ -1,13 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class ContentControllerTest_Page extends Page implements TestOnly class ContentControllerTest_Page extends Page implements TestOnly
{ {
private static $table_name = 'ContentControllerTest_Page';
} }

View File

@ -1,12 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use PageController; use PageController;
class ContentControllerTest_PageController extends PageController implements TestOnly class ContentControllerTest_PageController extends PageController implements TestOnly
{ {

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
@ -13,14 +12,8 @@ use SilverStripe\Control\Controller;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use Page; use Page;
/**
* @package cms
* @subpackage tests
*/
class ModelAsControllerTest extends FunctionalTest class ModelAsControllerTest extends FunctionalTest
{ {
protected $usesDatabase = true; protected $usesDatabase = true;
protected $autoFollowRedirection = false; protected $autoFollowRedirection = false;

View File

@ -1,19 +1,12 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Controllers\RootURLController; use SilverStripe\CMS\Controllers\RootURLController;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
/**
* @package cms
* @subpackage tests
*/
class RootURLControllerTest extends SapphireTest class RootURLControllerTest extends SapphireTest
{ {
protected static $fixture_file = 'RootURLControllerTest.yml'; protected static $fixture_file = 'RootURLControllerTest.yml';

View File

@ -1,27 +1,14 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\CMS\Controllers\SilverStripeNavigator; use SilverStripe\CMS\Controllers\SilverStripeNavigator;
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem; use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem_StageLink;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Dev\TestOnly; use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
/**
* @package cms
* @subpackage tests
*/
class SilverStripeNavigatorTest extends SapphireTest class SilverStripeNavigatorTest extends SapphireTest
{ {
protected static $fixture_file = 'CMSMainTest.yml'; protected static $fixture_file = 'CMSMainTest.yml';
public function testGetItems() public function testGetItems()
@ -38,7 +25,7 @@ class SilverStripeNavigatorTest extends SapphireTest
); );
$this->assertContains( $this->assertContains(
'SilverStripeNavigatorTest_TestItem', SilverStripeNavigatorTest_TestItem::class,
$classes, $classes,
'Autodiscovers new classes' 'Autodiscovers new classes'
); );
@ -54,11 +41,11 @@ class SilverStripeNavigatorTest extends SapphireTest
$this->logInWithPermission('CMS_ACCESS_CMSMain'); $this->logInWithPermission('CMS_ACCESS_CMSMain');
$items = $navigator->getItems(); $items = $navigator->getItems();
$classes = array_map('get_class', $items->toArray()); $classes = array_map('get_class', $items->toArray());
$this->assertNotContains('SilverStripeNavigatorTest_ProtectedTestItem', $classes); $this->assertNotContains(SilverStripeNavigatorTest_ProtectedTestItem::class, $classes);
$this->logInWithPermission('ADMIN'); $this->logInWithPermission('ADMIN');
$items = $navigator->getItems(); $items = $navigator->getItems();
$classes = array_map('get_class', $items->toArray()); $classes = array_map('get_class', $items->toArray());
$this->assertContains('SilverStripeNavigatorTest_ProtectedTestItem', $classes); $this->assertContains(SilverStripeNavigatorTest_ProtectedTestItem::class, $classes);
} }
} }

View File

@ -1,14 +1,12 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem; use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
class SilverStripeNavigatorTest_ProtectedTestItem extends SilverStripeNavigatorItem implements TestOnly class SilverStripeNavigatorTest_ProtectedTestItem extends SilverStripeNavigatorItem implements TestOnly
{ {

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Controllers;
use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem; use SilverStripe\CMS\Controllers\SilverStripeNavigatorItem;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class SilverStripeNavigatorTest_TestItem extends SilverStripeNavigatorItem implements TestOnly class SilverStripeNavigatorTest_TestItem extends SilverStripeNavigatorItem implements TestOnly
{ {
public function getTitle() public function getTitle()

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Assets\Folder; use SilverStripe\Assets\Folder;
use SilverStripe\Assets\Image; use SilverStripe\Assets\Image;
@ -14,10 +13,6 @@ use SilverStripe\Dev\SapphireTest;
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore; use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
use Page; use Page;
/**
* Tests link tracking to files and images.
*/
class FileLinkTrackingTest extends SapphireTest class FileLinkTrackingTest extends SapphireTest
{ {
protected static $fixture_file = "FileLinkTrackingTest.yml"; protected static $fixture_file = "FileLinkTrackingTest.yml";

View File

@ -1,16 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\RedirectorPage; use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Model\RedirectorPageController; use SilverStripe\CMS\Model\RedirectorPageController;
use SilverStripe\Control\Director; use SilverStripe\Control\Director;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Core\Extension;
use SilverStripe\Dev\TestOnly;
class RedirectorPageTest extends FunctionalTest class RedirectorPageTest extends FunctionalTest
{ {
@ -96,13 +91,13 @@ class RedirectorPageTest extends FunctionalTest
public function testRedirectRespectsFinishedResponse() public function testRedirectRespectsFinishedResponse()
{ {
$page = $this->objFromFixture(RedirectorPage::class, 'goodinternal'); $page = $this->objFromFixture(RedirectorPage::class, 'goodinternal');
RedirectorPageController::add_extension('RedirectorPageTest_RedirectExtension'); RedirectorPageController::add_extension(RedirectorPageTest_RedirectExtension::class);
$response = $this->get($page->regularLink()); $response = $this->get($page->regularLink());
$this->assertEquals(302, $response->getStatusCode()); $this->assertEquals(302, $response->getStatusCode());
$this->assertEquals('http://www.mysite.com/foo', $response->getHeader('Location')); $this->assertEquals('http://www.mysite.com/foo', $response->getHeader('Location'));
RedirectorPageController::remove_extension('RedirectorPageTest_RedirectExtension'); RedirectorPageController::remove_extension(RedirectorPageTest_RedirectExtension::class);
} }
public function testNoJSLinksAllowed() public function testNoJSLinksAllowed()

View File

@ -1,16 +1,12 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Core\Extension; use SilverStripe\Core\Extension;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class RedirectorPageTest_RedirectExtension extends Extension implements TestOnly class RedirectorPageTest_RedirectExtension extends Extension implements TestOnly
{ {
public function onBeforeInit() public function onBeforeInit()
{ {
$this->owner->redirect('/foo'); $this->owner->redirect('/foo');

View File

@ -1,18 +1,14 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use Page;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Security\Security; use SilverStripe\Dev\FunctionalTest;
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\Security;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Versioned\Versioned;
use SilverStripe\Dev\TestOnly;
use Page;
/** /**
* Possible actions: * Possible actions:
@ -22,9 +18,6 @@ use Page;
* - action_archive * - action_archive
* - action_rollback * - action_rollback
* - action_revert * - action_revert
*
* @package cms
* @subpackage tests
*/ */
class SiteTreeActionsTest extends FunctionalTest class SiteTreeActionsTest extends FunctionalTest
{ {

View File

@ -1,13 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use Page; use Page;
class SiteTreeActionsTest_Page extends Page implements TestOnly class SiteTreeActionsTest_Page extends Page implements TestOnly
{ {
public function canEdit($member = null) public function canEdit($member = null)

View File

@ -1,19 +1,12 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Versioned\Versioned;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Control\HTTP;
use SilverStripe\Control\Director; use SilverStripe\Control\Director;
use SilverStripe\Control\HTTP;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\FieldList; use SilverStripe\Versioned\Versioned;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\Dev\TestOnly;
/** /**
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking * Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking

View File

@ -1,15 +1,12 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField; use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly
{ {
private static $db = array( private static $db = array(

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
@ -14,12 +13,8 @@ use SilverStripe\Dev\SapphireTest;
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore; use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
use Page; use Page;
/** /**
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking * Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking
*
* @package cms
* @subpackage tests
*/ */
class SiteTreeBrokenLinksTest extends SapphireTest class SiteTreeBrokenLinksTest extends SapphireTest
{ {

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
@ -11,8 +10,6 @@ use SilverStripe\Dev\CSSContentParser;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore; use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore;
class SiteTreeHTMLEditorFieldTest extends FunctionalTest class SiteTreeHTMLEditorFieldTest extends FunctionalTest
{ {
protected static $fixture_file = 'SiteTreeHTMLEditorFieldTest.yml'; protected static $fixture_file = 'SiteTreeHTMLEditorFieldTest.yml';
@ -42,11 +39,11 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
public function testLinkTracking() public function testLinkTracking()
{ {
$sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home'); $sitetree = $this->objFromFixture(SiteTree::class, 'home');
$editor = new HTMLEditorField('Content'); $editor = new HTMLEditorField('Content');
$aboutID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'about'); $aboutID = $this->idFromFixture(SiteTree::class, 'about');
$contactID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'contact'); $contactID = $this->idFromFixture(SiteTree::class, 'contact');
$editor->setValue("<a href=\"[sitetree_link,id=$aboutID]\">Example Link</a>"); $editor->setValue("<a href=\"[sitetree_link,id=$aboutID]\">Example Link</a>");
$editor->saveInto($sitetree); $editor->saveInto($sitetree);
@ -82,7 +79,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
public function testFileLinkTracking() public function testFileLinkTracking()
{ {
$sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home'); $sitetree = $this->objFromFixture(SiteTree::class, 'home');
$editor = new HTMLEditorField('Content'); $editor = new HTMLEditorField('Content');
$fileID = $this->idFromFixture('SilverStripe\\Assets\\File', 'example_file'); $fileID = $this->idFromFixture('SilverStripe\\Assets\\File', 'example_file');
@ -143,7 +140,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
public function testImageTracking() public function testImageTracking()
{ {
$sitetree = $this->objFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home'); $sitetree = $this->objFromFixture(SiteTree::class, 'home');
$editor = new HTMLEditorField('Content'); $editor = new HTMLEditorField('Content');
$file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'example_image'); $file = $this->objFromFixture('SilverStripe\\Assets\\Image', 'example_image');
@ -180,7 +177,7 @@ class SiteTreeHTMLEditorFieldTest extends FunctionalTest
$editor->setValue(sprintf( $editor->setValue(sprintf(
'<p><a href="[sitetree_link,id=%d]">Working Link</a></p>', '<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; $sitetree->HasBrokenLink = false;
$editor->saveInto($sitetree); $editor->saveInto($sitetree);

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTreeLinkTracking_Parser; use SilverStripe\CMS\Model\SiteTreeLinkTracking_Parser;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
@ -9,7 +8,6 @@ use SilverStripe\Dev\SapphireTest;
use SilverStripe\View\Parsers\HTMLValue; use SilverStripe\View\Parsers\HTMLValue;
use Page; use Page;
class SiteTreeLinkTrackingTest extends SapphireTest class SiteTreeLinkTrackingTest extends SapphireTest
{ {

View File

@ -1,24 +1,17 @@
<?php <?php
namespace SilverStripe\CMS\Tests; 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\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Versioned\Versioned; 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 canAddChildren()
* @todo Test canCreate() * @todo Test canCreate()
*/ */

View File

@ -1,47 +1,34 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use Page;
use ReflectionMethod;
use SilverStripe\CMS\Model\RedirectorPage; use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Model\VirtualPage; 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\Control\Director;
use SilverStripe\Security\InheritedPermissions; use SilverStripe\Core\Config\Config;
use SilverStripe\Security\Security; use SilverStripe\Dev\SapphireTest;
use SilverStripe\Versioned\Versioned; use SilverStripe\i18n\i18n;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\ValidationException; use SilverStripe\ORM\ValidationException;
use SilverStripe\ORM\DataExtension; use SilverStripe\Security\Group;
use SilverStripe\ORM\HiddenClass; use SilverStripe\Security\InheritedPermissions;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Security\Group; use SilverStripe\Security\Security;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Model\SiteTreeExtension;
use SilverStripe\Core\Config\Config;
use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Control\Session; use SilverStripe\Versioned\Versioned;
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\View\Parsers\Diff; use SilverStripe\View\Parsers\Diff;
use SilverStripe\View\Parsers\ShortcodeParser;
use SilverStripe\View\Parsers\URLSegmentFilter; use SilverStripe\View\Parsers\URLSegmentFilter;
use Page;
use ReflectionMethod;
/**
* @package cms
* @subpackage tests
*/
class SiteTreeTest extends SapphireTest class SiteTreeTest extends SapphireTest
{ {
protected static $fixture_file = 'SiteTreeTest.yml'; protected static $fixture_file = 'SiteTreeTest.yml';
protected static $illegal_extensions = array( protected static $illegal_extensions = array(
@ -165,7 +152,7 @@ class SiteTreeTest extends SapphireTest
$child = new SiteTreeTest_PageNode(); $child = new SiteTreeTest_PageNode();
$child->setParent($parent); $child->setParent($parent);
$this->assertInstanceOf('SiteTreeTest_PageNode', $child->Parent); $this->assertInstanceOf(SiteTreeTest_PageNode::class, $child->Parent);
} }
/** /**
@ -641,7 +628,7 @@ class SiteTreeTest extends SapphireTest
$this->assertTrue(singleton(SiteTree::class)->canCreate(null, array('Parent' => singleton(SiteTree::class)))); $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 //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() public function testEditPermissionsOnDraftVsLive()
@ -696,7 +683,7 @@ class SiteTreeTest extends SapphireTest
{ {
// Necessary to avoid // Necessary to avoid
$oldCleanerClass = Diff::$html_cleaner_class; $oldCleanerClass = Diff::$html_cleaner_class;
Diff::$html_cleaner_class = 'SiteTreeTest_NullHtmlCleaner'; Diff::$html_cleaner_class = SiteTreeTest_NullHtmlCleaner::class;
$page = new Page(); $page = new Page();
$page->write(); $page->write();
@ -953,7 +940,7 @@ class SiteTreeTest extends SapphireTest
Config::modify()->set(SiteTree::class, 'nested_urls', true); Config::modify()->set(SiteTree::class, 'nested_urls', true);
$sitetree = new SiteTree(); $sitetree = new SiteTree();
$sitetree->ParentID = $this->idFromFixture('SiteTreeTest_Conflicted', 'parent'); $sitetree->ParentID = $this->idFromFixture(SiteTreeTest_Conflicted::class, 'parent');
$sitetree->URLSegment = 'index'; $sitetree->URLSegment = 'index';
$this->assertFalse($sitetree->validURLSegment(), 'index is not a valid URLSegment'); $this->assertFalse($sitetree->validURLSegment(), 'index is not a valid URLSegment');
@ -974,11 +961,11 @@ class SiteTreeTest extends SapphireTest
$sitetree->URLSegment = 'unique-segment'; $sitetree->URLSegment = 'unique-segment';
$this->assertTrue($sitetree->validURLSegment()); $this->assertTrue($sitetree->validURLSegment());
SiteTree::add_extension('SiteTreeTest_Extension'); SiteTree::add_extension(SiteTreeTest_Extension::class);
$sitetree = new SiteTree(); $sitetree = new SiteTree();
$sitetree->URLSegment = 'unique-segment'; $sitetree->URLSegment = 'unique-segment';
$this->assertFalse($sitetree->validURLSegment()); $this->assertFalse($sitetree->validURLSegment());
SiteTree::remove_extension('SiteTreeTest_Extension'); SiteTree::remove_extension(SiteTreeTest_Extension::class);
} }
public function testURLSegmentMultiByte() public function testURLSegmentMultiByte()
@ -1430,6 +1417,6 @@ class SiteTreeTest extends SapphireTest
public function testGetControllerNameWithUnderscoresIsSupported() public function testGetControllerNameWithUnderscoresIsSupported()
{ {
$class = new SiteTreeTest_LegacyControllerName; $class = new SiteTreeTest_LegacyControllerName;
$this->assertSame('SiteTreeTest_LegacyControllerName_Controller', $class->getControllerName()); $this->assertEquals(SiteTreeTest_LegacyControllerName_Controller::class, $class->getControllerName());
} }
} }

View File

@ -113,7 +113,7 @@ Page:
Title: 'Breadcrumbs 5' Title: 'Breadcrumbs 5'
Parent: =>Page.breadcrumbs4 Parent: =>Page.breadcrumbs4
SiteTreeTest_Conflicted: SilverStripe\CMS\Tests\Model\SiteTreeTest_Conflicted:
parent: parent:
Title: Parent Title: Parent
@ -124,7 +124,7 @@ SilverStripe\CMS\Model\RedirectorPage:
RedirectionType: External RedirectionType: External
ExternalURL: "http://www.google.com?a&b" ExternalURL: "http://www.google.com?a&b"
SiteTreeTest_DataObject: SilverStripe\CMS\Tests\Model\SiteTreeTest_DataObject:
relations: relations:
Title: 'Linked DataObject' Title: 'Linked DataObject'
Pages: =>Page.home,=>Page.about,=>Page.staff Pages: =>Page.home,=>Page.about,=>Page.staff

View File

@ -1,15 +1,15 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_AdminDenied extends Page implements TestOnly class SiteTreeTest_AdminDenied extends Page implements TestOnly
{ {
private static $extensions = array( private static $table_name = 'SiteTreeTest_AdminDenied';
'SiteTreeTest_AdminDeniedExtension'
); private static $extensions = [
SiteTreeTest_AdminDeniedExtension::class,
];
} }

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
/** /**
* An extension that can even deny actions to admins * An extension that can even deny actions to admins
*/ */

View File

@ -1,14 +1,14 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_ClassA extends Page implements TestOnly class SiteTreeTest_ClassA extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_ClassA';
private static $need_permission = [ private static $need_permission = [
'ADMIN', 'ADMIN',
'CMS_ACCESS_CMSMain' 'CMS_ACCESS_CMSMain'

View File

@ -1,14 +1,16 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_ClassB extends Page implements TestOnly class SiteTreeTest_ClassB extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_ClassB';
// Also allowed subclasses // Also allowed subclasses
private static $allowed_children = array(SiteTreeTest_ClassC::class); private static $allowed_children = [
SiteTreeTest_ClassC::class
];
} }

View File

@ -1,13 +1,13 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_ClassC extends Page implements TestOnly class SiteTreeTest_ClassC extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_ClassC';
private static $allowed_children = array(); private static $allowed_children = array();
} }

View File

@ -1,14 +1,15 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class SiteTreeTest_ClassCext extends SiteTreeTest_ClassC implements TestOnly class SiteTreeTest_ClassCext extends SiteTreeTest_ClassC implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_ClassCext';
// Override SiteTreeTest_ClassC definitions // Override SiteTreeTest_ClassC definitions
private static $allowed_children = array(SiteTreeTest_ClassB::class); private static $allowed_children = [
SiteTreeTest_ClassB::class
];
} }

View File

@ -1,20 +1,22 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_ClassD extends Page implements TestOnly class SiteTreeTest_ClassD extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_ClassD';
// Only allows this class, no children classes // Only allows this class, no children classes
private static $allowed_children = array('*SiteTreeTest_ClassC'); private static $allowed_children = [
'*' . SiteTreeTest_ClassC::class,
];
private static $extensions = [ private static $extensions = [
'SiteTreeTest_ExtensionA', SiteTreeTest_ExtensionA::class,
'SiteTreeTest_ExtensionB', SiteTreeTest_ExtensionB::class,
]; ];
public $canEditValue = null; public $canEditValue = null;

View File

@ -1,14 +1,12 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\HiddenClass; use SilverStripe\ORM\HiddenClass;
use Page; use Page;
class SiteTreeTest_ClassE extends Page implements TestOnly, HiddenClass class SiteTreeTest_ClassE extends Page implements TestOnly, HiddenClass
{ {
private static $table_name = 'SiteTreeTest_ClassE';
} }

View File

@ -1,13 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_Conflicted extends Page implements TestOnly class SiteTreeTest_Conflicted extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_Conflicted';
} }

View File

@ -1,15 +1,12 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use PageController; use PageController;
class SiteTreeTest_ConflictedController extends PageController implements TestOnly class SiteTreeTest_ConflictedController extends PageController implements TestOnly
{ {
private static $allowed_actions = array( private static $allowed_actions = array(
'conflicted-action' 'conflicted-action'
); );

View File

@ -1,14 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
/** /**
* Class SiteTreeTest_DataObject * Class SiteTreeTest_DataObject
* *
@ -17,6 +14,8 @@ use SilverStripe\ORM\DataObject;
*/ */
class SiteTreeTest_DataObject extends DataObject implements TestOnly class SiteTreeTest_DataObject extends DataObject implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_DataObject';
/** /**
* @var array * @var array
*/ */

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
class SiteTreeTest_Extension extends DataExtension implements TestOnly class SiteTreeTest_Extension extends DataExtension implements TestOnly
{ {
public function augmentValidURLSegment() public function augmentValidURLSegment()

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTreeExtension; use SilverStripe\CMS\Model\SiteTreeExtension;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class SiteTreeTest_ExtensionA extends SiteTreeExtension implements TestOnly class SiteTreeTest_ExtensionA extends SiteTreeExtension implements TestOnly
{ {
public static $can_publish = true; public static $can_publish = true;

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTreeExtension; use SilverStripe\CMS\Model\SiteTreeExtension;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class SiteTreeTest_ExtensionB extends SiteTreeExtension implements TestOnly class SiteTreeTest_ExtensionB extends SiteTreeExtension implements TestOnly
{ {
public static $can_publish = true; public static $can_publish = true;

View File

@ -1,16 +1,14 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
/** /**
* An empty SiteTree instance with a controller to test that legacy controller names can still be loaded * An empty SiteTree instance with a controller to test that legacy controller names can still be loaded
*/ */
class SiteTreeTest_LegacyControllerName extends Page implements TestOnly class SiteTreeTest_LegacyControllerName extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_LegacyControllerName';
} }

View File

@ -1,12 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use PageController; use PageController;
class SiteTreeTest_LegacyControllerName_Controller extends PageController implements TestOnly class SiteTreeTest_LegacyControllerName_Controller extends PageController implements TestOnly
{ {

View File

@ -1,13 +1,13 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_NotRoot extends Page implements TestOnly class SiteTreeTest_NotRoot extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_NotRoot';
private static $can_be_root = false; private static $can_be_root = false;
} }

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\View\Parsers\HTMLCleaner; use SilverStripe\View\Parsers\HTMLCleaner;
class SiteTreeTest_NullHtmlCleaner extends HTMLCleaner implements TestOnly class SiteTreeTest_NullHtmlCleaner extends HTMLCleaner implements TestOnly
{ {
public function cleanHTML($html) public function cleanHTML($html)

View File

@ -1,13 +1,11 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class SiteTreeTest_PageNode extends Page implements TestOnly class SiteTreeTest_PageNode extends Page implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_PageNode';
} }

View File

@ -1,12 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use PageController; use PageController;
class SiteTreeTest_PageNodeController extends PageController implements TestOnly class SiteTreeTest_PageNodeController extends PageController implements TestOnly
{ {
} }

View File

@ -1,15 +1,14 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class SiteTreeTest_StageStatusInherit extends SiteTree implements TestOnly class SiteTreeTest_StageStatusInherit extends SiteTree implements TestOnly
{ {
private static $table_name = 'SiteTreeTest_StageStatusInherit';
public function getStatusFlags($cached = true) public function getStatusFlags($cached = true)
{ {
$flags = parent::getStatusFlags($cached); $flags = parent::getStatusFlags($cached);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use Page; use Page;
use SilverStripe\CMS\Controllers\ModelAsController; use SilverStripe\CMS\Controllers\ModelAsController;
@ -11,6 +11,7 @@ use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ValidationException; use SilverStripe\ORM\ValidationException;
use SilverStripe\Security\Member;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
class VirtualPageTest extends FunctionalTest class VirtualPageTest extends FunctionalTest
@ -19,23 +20,28 @@ class VirtualPageTest extends FunctionalTest
protected static $use_draft_site = false; protected static $use_draft_site = false;
protected $autoFollowRedirection = false; protected $autoFollowRedirection = false;
protected static $extra_dataobjects = array( protected static $extra_dataobjects = [
'VirtualPageTest_ClassA', VirtualPageTest_ClassA::class,
'VirtualPageTest_ClassB', VirtualPageTest_ClassB::class,
'VirtualPageTest_ClassC', VirtualPageTest_ClassC::class,
'VirtualPageTest_NotRoot', VirtualPageTest_NotRoot::class,
'VirtualPageTest_PageExtension', VirtualPageTest_PageExtension::class,
'VirtualPageTest_PageWithAllowedChildren', VirtualPageTest_PageWithAllowedChildren::class,
'VirtualPageTest_TestDBField', VirtualPageTest_TestDBField::class,
'VirtualPageTest_VirtualPageSub', VirtualPageTest_VirtualPageSub::class,
); ];
protected static $illegal_extensions = array( protected static $illegal_extensions = array(
SiteTree::class => array('SiteTreeSubsites', 'Translatable'), SiteTree::class => [
'SiteTreeSubsites',
'Translatable'
],
); );
protected static $required_extensions = array( protected static $required_extensions = array(
SiteTree::class => array('VirtualPageTest_PageExtension') SiteTree::class => [
VirtualPageTest_PageExtension::class
]
); );
public function setUp() public function setUp()
@ -47,7 +53,11 @@ class VirtualPageTest extends FunctionalTest
// Add extra fields // Add extra fields
Config::modify()->merge(VirtualPage::class, 'initially_copied_fields', array('MyInitiallyCopiedField')); 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')
);
} }
/** /**
@ -81,6 +91,7 @@ class VirtualPageTest extends FunctionalTest
{ {
$this->logInWithPermission('ADMIN'); $this->logInWithPermission('ADMIN');
/** @var Page $master */
$master = $this->objFromFixture('Page', 'master'); $master = $this->objFromFixture('Page', 'master');
$master->publishRecursive(); $master->publishRecursive();
@ -89,7 +100,9 @@ class VirtualPageTest extends FunctionalTest
$master->Content = "<p>New content</p>"; $master->Content = "<p>New content</p>";
$master->write(); $master->write();
/** @var VirtualPage $vp1 */
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, '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')); $vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, 'vp2'));
$this->assertTrue($vp1->publishRecursive()); $this->assertTrue($vp1->publishRecursive());
$this->assertTrue($vp2->publishRecursive()); $this->assertTrue($vp2->publishRecursive());
@ -222,6 +235,7 @@ class VirtualPageTest extends FunctionalTest
/** @var Page $parentPage */ /** @var Page $parentPage */
$parentPage = $this->objFromFixture('Page', 'master3'); $parentPage = $this->objFromFixture('Page', 'master3');
$parentPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $parentPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
/** @var VirtualPage $virtualPage */
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp3'); $virtualPage = $this->objFromFixture(VirtualPage::class, 'vp3');
$virtualPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE); $virtualPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
$cindy = $this->objFromFixture(Member::class, 'cindy'); $cindy = $this->objFromFixture(Member::class, 'cindy');
@ -310,10 +324,8 @@ class VirtualPageTest extends FunctionalTest
$vp->flushCache(); $vp->flushCache();
$vp = DataObject::get_by_id(SiteTree::class, $vpID); $vp = DataObject::get_by_id(SiteTree::class, $vpID);
$this->assertEquals($p->ID, $vp->CopyContentFromID); $this->assertEquals($p->ID, $vp->CopyContentFromID);
$vpLive = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE)->byID($vpID);
$vpLive = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, '"SiteTree"."ID" = ' . $vpID);
$this->assertNull($vpLive); $this->assertNull($vpLive);
// Delete from draft, ensure virtual page deletion cascades // Delete from draft, ensure virtual page deletion cascades
$p->delete(); $p->delete();
$vp->flushCache(); $vp->flushCache();
@ -336,7 +348,6 @@ class VirtualPageTest extends FunctionalTest
// All is fine, the virtual page doesn't have a broken link // All is fine, the virtual page doesn't have a broken link
$this->assertFalse($vp->HasBrokenLink); $this->assertFalse($vp->HasBrokenLink);
// Delete the source page from draft, cascades to virtual page // Delete the source page from draft, cascades to virtual page
$pID = $p->ID; $pID = $p->ID;
$p->delete(); $p->delete();
@ -344,8 +355,8 @@ class VirtualPageTest extends FunctionalTest
$vpDraft = Versioned::get_by_stage(SiteTree::class, Versioned::DRAFT) $vpDraft = Versioned::get_by_stage(SiteTree::class, Versioned::DRAFT)
->byID($pID); ->byID($pID);
$this->assertNull($vpDraft); $this->assertNull($vpDraft);
// 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
/** @var Page $pLive */
$pLive = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE) $pLive = Versioned::get_by_stage(SiteTree::class, Versioned::LIVE)
->byID($pID); ->byID($pID);
$this->assertTrue($pLive->doUnpublish()); $this->assertTrue($pLive->doUnpublish());
@ -485,14 +496,19 @@ class VirtualPageTest extends FunctionalTest
$nonVirtual = $virtual; $nonVirtual = $virtual;
$nonVirtual->ClassName = 'VirtualPageTest_ClassA'; $nonVirtual->ClassName = VirtualPageTest_ClassA::class;
$nonVirtual->MySharedNonVirtualField = 'changed on new type'; $nonVirtual->MySharedNonVirtualField = 'changed on new type';
$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(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->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('changed on new type', $nonVirtualStage->MySharedNonVirtualField);
$this->assertEquals( $this->assertEquals(
'original', 'original',
@ -501,9 +517,14 @@ 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(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->assertNotNull($virtualLive);
$this->assertEquals('VirtualPageTest_VirtualPageSub', $virtualLive->ClassName); $this->assertEquals(VirtualPageTest_VirtualPageSub::class, $virtualLive->ClassName);
$this->assertEquals('virtual published field', $virtualLive->MySharedNonVirtualField); $this->assertEquals('virtual published field', $virtualLive->MySharedNonVirtualField);
$this->assertEquals('published title', $virtualLive->Title); $this->assertEquals('published title', $virtualLive->Title);
@ -514,7 +535,12 @@ 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(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('virtual published field', $virtualLive->MySharedNonVirtualField);
$this->assertEquals('title changed on original', $virtualLive->Title); $this->assertEquals('title changed on original', $virtualLive->Title);
} }
@ -528,7 +554,7 @@ class VirtualPageTest extends FunctionalTest
$virtual->CopyContentFromID = $page->ID; $virtual->CopyContentFromID = $page->ID;
$virtual->write(); $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()); $this->assertEquals('SOME CONTENT', $virtual->obj('CastingTest')->forTemplate());
} }
@ -611,10 +637,11 @@ class VirtualPageTest extends FunctionalTest
public function testMethod() public function testMethod()
{ {
/** @var VirtualPage $virtualPage */
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4'); $virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
/** @var VirtualPageTest_ClassAController $controller */
$controller = ModelAsController::controller_for($virtualPage); $controller = ModelAsController::controller_for($virtualPage);
$this->assertInstanceOf(VirtualPageTest_ClassAController::class, $controller);
$this->assertInstanceOf('VirtualPageTest_ClassAController', $controller);
$this->assertTrue($controller->hasMethod('testMethod')); $this->assertTrue($controller->hasMethod('testMethod'));
$this->assertEquals('hello', $controller->testMethod()); $this->assertEquals('hello', $controller->testMethod());
$this->assertTrue($controller->hasMethod('modelMethod')); $this->assertTrue($controller->hasMethod('modelMethod'));
@ -623,6 +650,7 @@ class VirtualPageTest extends FunctionalTest
public function testAllowedActions() public function testAllowedActions()
{ {
/** @var VirtualPage $virtualPage */
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4'); $virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
$controller = ModelAsController::controller_for($virtualPage); $controller = ModelAsController::controller_for($virtualPage);
$this->assertContains('testaction', $controller->allowedActions()); $this->assertContains('testaction', $controller->allowedActions());

View File

@ -45,7 +45,7 @@ Page:
CanEditType: OnlyTheseUsers CanEditType: OnlyTheseUsers
CanViewType: Inherit CanViewType: Inherit
EditorGroups: =>SilverStripe\Security\Group.bobgroup EditorGroups: =>SilverStripe\Security\Group.bobgroup
VirtualPageTest_ClassA: SilverStripe\CMS\Tests\Model\VirtualPageTest_ClassA:
pagea: pagea:
Title: 'Page A' Title: 'Page A'
Content: '<p>Content</p>' Content: '<p>Content</p>'
@ -66,5 +66,5 @@ SilverStripe\CMS\Model\VirtualPage:
EditorGroups: =>SilverStripe\Security\Group.andrewgroup EditorGroups: =>SilverStripe\Security\Group.andrewgroup
ViewerGroups: =>SilverStripe\Security\Group.cindygroup ViewerGroups: =>SilverStripe\Security\Group.cindygroup
vp4: vp4:
CopyContentFrom: =>VirtualPageTest_ClassA.pagea CopyContentFrom: =>SilverStripe\CMS\Tests\Model\VirtualPageTest_ClassA.pagea
Title: 'vp4' Title: 'vp4'

View File

@ -1,22 +1,24 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class VirtualPageTest_ClassA extends Page implements TestOnly class VirtualPageTest_ClassA extends Page implements TestOnly
{ {
private static $table_name = 'VirtualPageTest_ClassA';
private static $db = array( private static $db = array(
'MyInitiallyCopiedField' => 'Text', 'MyInitiallyCopiedField' => 'Text',
'MyVirtualField' => 'Text', 'MyVirtualField' => 'Text',
'MyNonVirtualField' => '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() public function modelMethod()
{ {

View File

@ -1,12 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use PageController; use PageController;
class VirtualPageTest_ClassAController extends PageController implements TestOnly class VirtualPageTest_ClassAController extends PageController implements TestOnly
{ {
private static $allowed_actions = [ private static $allowed_actions = [

View File

@ -1,13 +1,15 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class VirtualPageTest_ClassB extends Page implements TestOnly class VirtualPageTest_ClassB extends Page implements TestOnly
{ {
private static $allowed_children = array('VirtualPageTest_ClassC'); private static $table_name = 'VirtualPageTest_ClassB';
private static $allowed_children = [
VirtualPageTest_ClassC::class,
];
} }

View File

@ -1,13 +1,13 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class VirtualPageTest_ClassC extends Page implements TestOnly class VirtualPageTest_ClassC extends Page implements TestOnly
{ {
private static $table_name = 'VirtualPageTest_ClassC';
private static $allowed_children = array(); private static $allowed_children = array();
} }

View File

@ -1,13 +1,13 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class VirtualPageTest_NotRoot extends Page implements TestOnly class VirtualPageTest_NotRoot extends Page implements TestOnly
{ {
private static $table_name = 'VirtualPageTest_NotRoot';
private static $can_be_root = false; private static $can_be_root = false;
} }

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
class VirtualPageTest_PageExtension extends DataExtension implements TestOnly class VirtualPageTest_PageExtension extends DataExtension implements TestOnly
{ {
private static $db = array( private static $db = array(

View File

@ -1,15 +1,15 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\VirtualPage; use SilverStripe\CMS\Model\VirtualPage;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use Page; use Page;
class VirtualPageTest_PageWithAllowedChildren extends Page implements TestOnly class VirtualPageTest_PageWithAllowedChildren extends Page implements TestOnly
{ {
private static $table_name = 'VirtualPageTest_PageWithAllowedChildren';
private static $allowed_children = array( private static $allowed_children = array(
VirtualPageTest_ClassA::class, VirtualPageTest_ClassA::class,
VirtualPage::class, VirtualPage::class,

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\FieldType\DBVarchar; use SilverStripe\ORM\FieldType\DBVarchar;
class VirtualPageTest_TestDBField extends DBVarchar implements TestOnly class VirtualPageTest_TestDBField extends DBVarchar implements TestOnly
{ {
public function forTemplate() public function forTemplate()

View File

@ -1,15 +1,14 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Model;
use SilverStripe\CMS\Model\VirtualPage; use SilverStripe\CMS\Model\VirtualPage;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
class VirtualPageTest_VirtualPageSub extends VirtualPage implements TestOnly class VirtualPageTest_VirtualPageSub extends VirtualPage implements TestOnly
{ {
private static $table_name = 'VirtualPageTest_VirtualPageSub';
private static $db = array( private static $db = array(
'MyProperty' => 'Varchar', 'MyProperty' => 'Varchar',
); );

View File

@ -1,7 +1,6 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Reports;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
@ -18,11 +17,6 @@ use SilverStripe\Assets\File;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use Page; use Page;
/**
* @package cms
* @subpackage tests
*/
class CmsReportsTest extends SapphireTest class CmsReportsTest extends SapphireTest
{ {
@ -48,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. * ASSERT whether a report is returning the correct results, based on a broken "draft" and/or "published" page.
* *
* @parameter ss_report * @param Report $report
* @parameter boolean * @param bool $isDraftBroken
* @parameter boolean * @param bool $isPublishedBroken
*/ */
public function isReportBroken($report, $isDraftBroken, $isPublishedBroken) public function isReportBroken($report, $isDraftBroken, $isPublishedBroken)
{ {
$class = get_class($report); $class = get_class($report);
// ASSERT that the "draft" report is returning the correct results. // ASSERT that the "draft" report is returning the correct results.

View File

@ -1,20 +1,17 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Search;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
use SilverStripe\Security\Member;
class CMSMainSearchFormTest extends FunctionalTest class CMSMainSearchFormTest extends FunctionalTest
{ {
protected static $fixture_file = '../Controllers/CMSMainTest.yml';
protected static $fixture_file = '../controller/CMSMainTest.yml';
public function testTitleFilter() 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( $response = $this->get(
'admin/pages/SearchForm/?' . 'admin/pages/SearchForm/?' .

View File

@ -1,30 +1,25 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Search;
use Page;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Controllers\ModelAsController; use SilverStripe\CMS\Controllers\ModelAsController;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Search\SearchForm;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\MSSQL\MSSQLDatabase;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
use SilverStripe\ORM\Search\FulltextSearchable;
use SilverStripe\PostgreSQL\PostgreSQLDatabase;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security; use SilverStripe\Security\Security;
use SilverStripe\Versioned\Versioned; 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 Fix unpublished pages check in testPublishedPagesMatchedByTitle()
* @todo All tests run on unpublished pages at the moment, due to the searchform not distinguishing between them * @todo All tests run on unpublished pages at the moment, due to the searchform not distinguishing between them
* *

View File

@ -1,21 +1,14 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Tasks;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\DataObject;
use SilverStripe\CMS\Tasks\MigrateSiteTreeLinkingTask; use SilverStripe\CMS\Tasks\MigrateSiteTreeLinkingTask;
use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\DataObject;
/**
* @package cms
* @subpackage tests
*/
class MigrateSiteTreeLinkingTaskTest extends SapphireTest class MigrateSiteTreeLinkingTaskTest extends SapphireTest
{ {
protected static $fixture_file = 'MigrateSiteTreeLinkingTaskTest.yml'; protected static $fixture_file = 'MigrateSiteTreeLinkingTaskTest.yml';
protected static $use_draft_site = true; protected static $use_draft_site = true;
@ -34,11 +27,11 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
); );
ob_end_clean(); ob_end_clean();
$homeID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'home'); $homeID = $this->idFromFixture(SiteTree::class, 'home');
$aboutID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'about'); $aboutID = $this->idFromFixture(SiteTree::class, 'about');
$staffID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'staff'); $staffID = $this->idFromFixture(SiteTree::class, 'staff');
$actionID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'action'); $actionID = $this->idFromFixture(SiteTree::class, 'action');
$hashID = $this->idFromFixture('SilverStripe\\CMS\\Model\\SiteTree', 'hash_link'); $hashID = $this->idFromFixture(SiteTree::class, 'hash_link');
$homeContent = sprintf( $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>', '<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>',
@ -67,25 +60,25 @@ class MigrateSiteTreeLinkingTaskTest extends SapphireTest
$this->assertEquals( $this->assertEquals(
$homeContent, $homeContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $homeID)->Content, DataObject::get_by_id(SiteTree::class, $homeID)->Content,
'HTML URLSegment links are rewritten.' 'HTML URLSegment links are rewritten.'
); );
$this->assertEquals( $this->assertEquals(
$aboutContent, $aboutContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $aboutID)->Content DataObject::get_by_id(SiteTree::class, $aboutID)->Content
); );
$this->assertEquals( $this->assertEquals(
$staffContent, $staffContent,
DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $staffID)->Content DataObject::get_by_id(SiteTree::class, $staffID)->Content
); );
$this->assertEquals( $this->assertEquals(
$actionContent, $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.' 'Links to actions on pages are rewritten correctly.'
); );
$this->assertEquals( $this->assertEquals(
$hashLinkContent, $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.' 'Hash/anchor links are correctly handled.'
); );
} }

View File

@ -1,13 +1,10 @@
<?php <?php
namespace SilverStripe\CMS\Tests; namespace SilverStripe\CMS\Tests\Tasks;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\Dev\FunctionalTest; use SilverStripe\Dev\FunctionalTest;
/** /**
* <h2>Fixture tree</h2> * <h2>Fixture tree</h2>
* <code> * <code>
@ -35,13 +32,9 @@ use SilverStripe\Dev\FunctionalTest;
* </code> * </code>
* *
* @author Ingo Schommer (<firstname>@silverstripe.com), SilverStripe Ltd. * @author Ingo Schommer (<firstname>@silverstripe.com), SilverStripe Ltd.
*
* @package cms
* @subpackage tests
*/ */
class RemoveOrphanedPagesTaskTest extends FunctionalTest class RemoveOrphanedPagesTaskTest extends FunctionalTest
{ {
protected static $fixture_file = 'RemoveOrphanedPagesTaskTest.yml'; protected static $fixture_file = 'RemoveOrphanedPagesTaskTest.yml';
protected static $use_draft_site = false; protected static $use_draft_site = false;