From 8659c274871b7a0681e0b4f8af06ed5394bd6116 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 23 Nov 2012 13:58:54 +0100 Subject: [PATCH] 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. --- tests/controller/CMSMainTest.php | 8 ++-- tests/model/SiteTreeActionsTest.php | 12 ------ tests/model/SiteTreeBacklinksTest.php | 12 ------ tests/model/SiteTreeBrokenLinksTest.php | 12 ------ tests/model/SiteTreePermissionsTest.php | 12 ------ tests/model/SiteTreeTest.php | 49 ------------------------- 6 files changed, 4 insertions(+), 101 deletions(-) diff --git a/tests/controller/CMSMainTest.php b/tests/controller/CMSMainTest.php index 01813b15..e3ea0cff 100644 --- a/tests/controller/CMSMainTest.php +++ b/tests/controller/CMSMainTest.php @@ -11,7 +11,7 @@ class CMSMainTest extends FunctionalTest { 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 +19,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(); } /** diff --git a/tests/model/SiteTreeActionsTest.php b/tests/model/SiteTreeActionsTest.php index 4a29ac62..e457d0b7 100644 --- a/tests/model/SiteTreeActionsTest.php +++ b/tests/model/SiteTreeActionsTest.php @@ -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; diff --git a/tests/model/SiteTreeBacklinksTest.php b/tests/model/SiteTreeBacklinksTest.php index ff5f089e..9a4b58e8 100644 --- a/tests/model/SiteTreeBacklinksTest.php +++ b/tests/model/SiteTreeBacklinksTest.php @@ -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(); diff --git a/tests/model/SiteTreeBrokenLinksTest.php b/tests/model/SiteTreeBrokenLinksTest.php index 5333f3ab..ee8e763e 100644 --- a/tests/model/SiteTreeBrokenLinksTest.php +++ b/tests/model/SiteTreeBrokenLinksTest.php @@ -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'); diff --git a/tests/model/SiteTreePermissionsTest.php b/tests/model/SiteTreePermissionsTest.php index 0992306e..582395c3 100644 --- a/tests/model/SiteTreePermissionsTest.php +++ b/tests/model/SiteTreePermissionsTest.php @@ -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(); diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php index 5f007040..54662877 100644 --- a/tests/model/SiteTreeTest.php +++ b/tests/model/SiteTreeTest.php @@ -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']) { - 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() { $remove = DataObject::get('SiteTree'); if($remove) foreach($remove as $page) $page->delete();