You are here

function ForumTestCase::testEnableForumField in Drupal 7

Tests disabling and re-enabling the Forum module.

File

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.');
}