function ForumTest::testEnableForumField

Tests disabling and re-enabling the Forum module.

File

drupal/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php, line 103
Tests for forum.module.

Class

ForumTest
Provides automated tests for the Forum module.

Namespace

Drupal\forum\Tests

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.');
  system_list_reset();
  $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.');
  system_list_reset();
  $this
    ->assertTrue(module_exists('forum'), 'Forum module is enabled.');
}