Remove unused set_up_once() invocations from various tests

SapphireTest method name was changed to instance method
and setUpOnce() naming in mid 2010 already (093da759).
Since those methods were never invoked, they're obsolete.
Checked that the SiteTree-related tests pass with
Translatable enabled.
This commit is contained in:
Ingo Schommer 2012-11-23 13:58:54 +01:00
parent 1529cd1539
commit 8659c27487
6 changed files with 4 additions and 101 deletions

View File

@ -11,7 +11,7 @@ class CMSMainTest extends FunctionalTest {
static protected $orig = array(); static protected $orig = array();
static public function set_up_once() { public function setUpOnce() {
self::$orig['CMSBatchActionHandler_batch_actions'] = CMSBatchActionHandler::$batch_actions; self::$orig['CMSBatchActionHandler_batch_actions'] = CMSBatchActionHandler::$batch_actions;
CMSBatchActionHandler::$batch_actions = array( CMSBatchActionHandler::$batch_actions = array(
'publish' => 'CMSBatchAction_Publish', 'publish' => 'CMSBatchAction_Publish',
@ -19,13 +19,13 @@ class CMSMainTest extends FunctionalTest {
'deletefromlive' => 'CMSBatchAction_DeleteFromLive', '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']; CMSBatchActionHandler::$batch_actions = self::$orig['CMSBatchActionHandler_batch_actions'];
parent::tear_down_once(); parent::tearDownOnce();
} }
/** /**

View File

@ -16,18 +16,6 @@ class SiteTreeActionsTest extends FunctionalTest {
static $fixture_file = 'SiteTreeActionsTest.yml'; 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() { public function testActionsReadonly() {
if(class_exists('SiteTreeCMSWorkflow')) return true; if(class_exists('SiteTreeCMSWorkflow')) return true;

View File

@ -7,18 +7,6 @@ class SiteTreeBacklinksTest extends SapphireTest {
'SiteTree' => array('SiteTreeBacklinksTest_DOD'), '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() { public function setUp() {
parent::setUp(); parent::setUp();

View File

@ -6,18 +6,6 @@
class SiteTreeBrokenLinksTest extends SapphireTest { class SiteTreeBrokenLinksTest extends SapphireTest {
static $fixture_file = 'SiteTreeBrokenLinksTest.yml'; 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() { public function testBrokenLinksBetweenPages() {
$obj = $this->objFromFixture('Page','content'); $obj = $this->objFromFixture('Page','content');

View File

@ -13,18 +13,6 @@ class SiteTreePermissionsTest extends FunctionalTest {
'SiteTree' => array('SiteTreeSubsites') '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() { public function setUp() {
parent::setUp(); parent::setUp();

View File

@ -20,55 +20,6 @@ class SiteTreeTest extends SapphireTest {
'SiteTreeTest_StageStatusInherit', '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']) {
Object::remove_extension('SiteTree', 'Translatable');
Object::remove_extension('SiteConfig', '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']) {
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', '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() { public function testCreateDefaultpages() {
$remove = DataObject::get('SiteTree'); $remove = DataObject::get('SiteTree');
if($remove) foreach($remove as $page) $page->delete(); if($remove) foreach($remove as $page) $page->delete();