function ForumTestCase::testEnableForumField

7.x forum.test ForumTestCase::testEnableForumField()

Tests disabling and re-enabling the Forum module.

File

drupal-7.x/modules/forum/forum.test, line 90
Tests for forum.module.

Class

ForumTestCase
Provides automated tests for the Forum module.

Code

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.'), 'Modules status has been updated.');
  module_list(TRUE);
  $this->assertFalse(module_exists('forum'), '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.'), 'Modules status has been updated.');
  module_list(TRUE);
  $this->assertTrue(module_exists('forum'), 'Forum module is enabled.');
}