mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge remote-tracking branch 'origin/3.0'
Conflicts: tests/model/SiteTreeTest.php
This commit is contained in:
commit
26bdee4f08
@ -7,11 +7,9 @@ class CMSMainTest extends FunctionalTest {
|
||||
|
||||
static $fixture_file = 'CMSMainTest.yml';
|
||||
|
||||
protected $autoFollowRedirection = false;
|
||||
|
||||
static protected $orig = array();
|
||||
|
||||
static public function set_up_once() {
|
||||
public function setUpOnce() {
|
||||
self::$orig['CMSBatchActionHandler_batch_actions'] = CMSBatchActionHandler::$batch_actions;
|
||||
CMSBatchActionHandler::$batch_actions = array(
|
||||
'publish' => 'CMSBatchAction_Publish',
|
||||
@ -19,13 +17,13 @@ class CMSMainTest extends FunctionalTest {
|
||||
'deletefromlive' => 'CMSBatchAction_DeleteFromLive',
|
||||
);
|
||||
|
||||
parent::set_up_once();
|
||||
parent::setUpOnce();
|
||||
}
|
||||
|
||||
static public function tear_down_once() {
|
||||
public function tearDownOnce() {
|
||||
CMSBatchActionHandler::$batch_actions = self::$orig['CMSBatchActionHandler_batch_actions'];
|
||||
|
||||
parent::tear_down_once();
|
||||
parent::tearDownOnce();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -37,7 +35,6 @@ class CMSMainTest extends FunctionalTest {
|
||||
$this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin'));
|
||||
|
||||
$response = $this->get('admin/pages/publishall?confirm=1');
|
||||
|
||||
$this->assertContains(
|
||||
'Done: Published 30 pages',
|
||||
$response->getBody()
|
||||
@ -45,7 +42,7 @@ class CMSMainTest extends FunctionalTest {
|
||||
|
||||
// Some modules (e.g., cmsworkflow) will remove this action
|
||||
if(isset(CMSBatchActionHandler::$batch_actions['publish'])) {
|
||||
$response = Director::test('admin/pages/batchactions/publish', array('csvIDs' => implode(',', array($page1->ID, $page2->ID)), 'ajax' => 1), $this->session());
|
||||
$response = $this->get('admin/pages/batchactions/publish?ajax=1&csvIDs=' . implode(',', array($page1->ID, $page2->ID)));
|
||||
$responseData = Convert::json2array($response->getBody());
|
||||
$this->assertArrayHasKey($page1->ID, $responseData['modified']);
|
||||
$this->assertArrayHasKey($page2->ID, $responseData['modified']);
|
||||
@ -193,6 +190,9 @@ class CMSMainTest extends FunctionalTest {
|
||||
}
|
||||
|
||||
public function testCreationOfTopLevelPage(){
|
||||
$origFollow = $this->autoFollowRedirection;
|
||||
$this->autoFollowRedirection = false;
|
||||
|
||||
$cmsUser = $this->objFromFixture('Member', 'allcmssectionsuser');
|
||||
$rootEditUser = $this->objFromFixture('Member', 'rootedituser');
|
||||
|
||||
@ -220,9 +220,14 @@ class CMSMainTest extends FunctionalTest {
|
||||
$this->assertContains('/show/',$location, 'Must redirect to /show/ the new page');
|
||||
// TODO Logout
|
||||
$this->session()->inst_set('loggedInAs', NULL);
|
||||
|
||||
$this->autoFollowRedirection = $origFollow;
|
||||
}
|
||||
|
||||
public function testCreationOfRestrictedPage(){
|
||||
$origFollow = $this->autoFollowRedirection;
|
||||
$this->autoFollowRedirection = false;
|
||||
|
||||
$adminUser = $this->objFromFixture('Member', 'admin');
|
||||
$adminUser->logIn();
|
||||
|
||||
@ -258,6 +263,8 @@ class CMSMainTest extends FunctionalTest {
|
||||
);
|
||||
|
||||
$this->session()->inst_set('loggedInAs', NULL);
|
||||
|
||||
$this->autoFollowRedirection = $origFollow;
|
||||
}
|
||||
|
||||
public function testBreadcrumbs() {
|
||||
|
@ -16,18 +16,6 @@ class SiteTreeActionsTest extends FunctionalTest {
|
||||
|
||||
static $fixture_file = 'SiteTreeActionsTest.yml';
|
||||
|
||||
static public function set_up_once() {
|
||||
SiteTreeTest::set_up_once();
|
||||
|
||||
parent::set_up_once();
|
||||
}
|
||||
|
||||
static public function tear_down_once() {
|
||||
SiteTreeTest::tear_down_once();
|
||||
|
||||
parent::tear_down_once();
|
||||
}
|
||||
|
||||
public function testActionsReadonly() {
|
||||
if(class_exists('SiteTreeCMSWorkflow')) return true;
|
||||
|
||||
|
@ -7,18 +7,6 @@ class SiteTreeBacklinksTest extends SapphireTest {
|
||||
'SiteTree' => array('SiteTreeBacklinksTest_DOD'),
|
||||
);
|
||||
|
||||
static public function set_up_once() {
|
||||
SiteTreeTest::set_up_once();
|
||||
|
||||
parent::set_up_once();
|
||||
}
|
||||
|
||||
static public function tear_down_once() {
|
||||
SiteTreeTest::tear_down_once();
|
||||
|
||||
parent::tear_down_once();
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
|
@ -6,18 +6,6 @@
|
||||
class SiteTreeBrokenLinksTest extends SapphireTest {
|
||||
static $fixture_file = 'SiteTreeBrokenLinksTest.yml';
|
||||
|
||||
static public function set_up_once() {
|
||||
SiteTreeTest::set_up_once();
|
||||
|
||||
parent::set_up_once();
|
||||
}
|
||||
|
||||
static public function tear_down_once() {
|
||||
SiteTreeTest::tear_down_once();
|
||||
|
||||
parent::tear_down_once();
|
||||
}
|
||||
|
||||
public function testBrokenLinksBetweenPages() {
|
||||
$obj = $this->objFromFixture('Page','content');
|
||||
|
||||
|
@ -13,18 +13,6 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
||||
'SiteTree' => array('SiteTreeSubsites')
|
||||
);
|
||||
|
||||
static public function set_up_once() {
|
||||
SiteTreeTest::set_up_once();
|
||||
|
||||
parent::set_up_once();
|
||||
}
|
||||
|
||||
static public function tear_down_once() {
|
||||
SiteTreeTest::tear_down_once();
|
||||
|
||||
parent::tear_down_once();
|
||||
}
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
|
@ -20,55 +20,6 @@ class SiteTreeTest extends SapphireTest {
|
||||
'SiteTreeTest_StageStatusInherit',
|
||||
);
|
||||
|
||||
/**
|
||||
* @todo Necessary because of monolithic Translatable design
|
||||
*/
|
||||
static protected $origTranslatableSettings = array();
|
||||
|
||||
static public function set_up_once() {
|
||||
// needs to recreate the database schema with language properties
|
||||
self::kill_temp_db();
|
||||
|
||||
// store old defaults
|
||||
if(class_exists('Translatable')) {
|
||||
self::$origTranslatableSettings['has_extension'] = singleton('SiteTree')->hasExtension('Translatable');
|
||||
self::$origTranslatableSettings['default_locale'] = Translatable::default_locale();
|
||||
|
||||
// overwrite locale
|
||||
Translatable::set_default_locale("en_US");
|
||||
|
||||
// refresh the extended statics - different fields in $db with Translatable enabled
|
||||
if(self::$origTranslatableSettings['has_extension']) {
|
||||
SiteTree::remove_extension('Translatable');
|
||||
SiteConfig::remove_extension('Translatable');
|
||||
}
|
||||
}
|
||||
|
||||
// recreate database with new settings
|
||||
$dbname = self::create_temp_db();
|
||||
DB::set_alternative_database_name($dbname);
|
||||
|
||||
parent::set_up_once();
|
||||
}
|
||||
|
||||
static public function tear_down_once() {
|
||||
if(class_exists('Translatable')) {
|
||||
if(self::$origTranslatableSettings['has_extension']) {
|
||||
SiteTree::add_extension('Translatable');
|
||||
SiteConfig::add_extension('Translatable');
|
||||
}
|
||||
|
||||
|
||||
Translatable::set_default_locale(self::$origTranslatableSettings['default_locale']);
|
||||
Translatable::set_current_locale(self::$origTranslatableSettings['default_locale']);
|
||||
}
|
||||
|
||||
self::kill_temp_db();
|
||||
self::create_temp_db();
|
||||
|
||||
parent::tear_down_once();
|
||||
}
|
||||
|
||||
public function testCreateDefaultpages() {
|
||||
$remove = DataObject::get('SiteTree');
|
||||
if($remove) foreach($remove as $page) $page->delete();
|
||||
|
Loading…
Reference in New Issue
Block a user