From 16b5120350eccb2f40c1eea6b2a854bdf9dc87bb Mon Sep 17 00:00:00 2001 From: webchick Date: Mon, 29 Aug 2011 23:12:18 -0700 Subject: Issue #943772 by jpsoto, yched, catch, bojanz, pillarsdotnet, steinmb: Fixed field_delete_field() and others fail for inactive fields. --- modules/forum/forum.install | 5 +++++ modules/forum/forum.test | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'modules/forum') diff --git a/modules/forum/forum.install b/modules/forum/forum.install index 60c408793..1bed2e34c 100644 --- a/modules/forum/forum.install +++ b/modules/forum/forum.install @@ -113,6 +113,11 @@ function forum_uninstall() { variable_del('forum_block_num_active'); variable_del('forum_block_num_new'); variable_del('node_options_forum'); + + field_delete_field('taxonomy_forums'); + // Purge field data now to allow taxonomy module to be uninstalled + // if this is the only field remaining. + field_purge_batch(10); } /** diff --git a/modules/forum/forum.test b/modules/forum/forum.test index 1dc45c6fd..c7c3d9c1b 100644 --- a/modules/forum/forum.test +++ b/modules/forum/forum.test @@ -31,6 +31,7 @@ class ForumTestCase extends DrupalWebTestCase { // Create users. $this->admin_user = $this->drupalCreateUser(array( 'access administration pages', + 'administer modules', 'administer blocks', 'administer forums', 'administer menu', @@ -51,6 +52,30 @@ class ForumTestCase extends DrupalWebTestCase { $this->web_user = $this->drupalCreateUser(array()); } + /** + * Tests disabling and re-enabling forum. + */ + function testEnableForumField() { + $this->drupalLogin($this->admin_user); + + // Disable the forum module. + $edit = array(); + $edit['modules[Core][forum][enable]'] = FALSE; + $this->drupalPost('admin/modules', $edit, t('Save configuration')); + $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + module_list(TRUE); + $this->assertFalse(module_exists('forum'), t('Forum module is not enabled.')); + + // Attempt to re-enable the forum module and ensure it does not try to + // recreate the taxonomy_forums field. + $edit = array(); + $edit['modules[Core][forum][enable]'] = 'forum'; + $this->drupalPost('admin/modules', $edit, t('Save configuration')); + $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + module_list(TRUE); + $this->assertTrue(module_exists('forum'), t('Forum module is enabled.')); + } + /** * Login users, create forum nodes, and test forum functionality through the admin and user interfaces. */ -- cgit v1.2.3