function ForumTest::deleteForum

Deletes a forum.

Parameters

$tid: The forum ID.

1 call to ForumTest::deleteForum()
ForumTest::doAdminTests in drupal/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php
Runs admin tests on the admin user.

File

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

Class

ForumTest
Provides automated tests for the Forum module.

Namespace

Drupal\forum\Tests

Code

function deleteForum($tid) {

  // Delete the forum.
  $this
    ->drupalPost('admin/structure/forum/edit/forum/' . $tid, array(), t('Delete'));
  $this
    ->assertText('Are you sure you want to delete the forum');
  $this
    ->assertNoText('Add forum');
  $this
    ->assertNoText('Add forum container');
  $this
    ->drupalPost(NULL, array(), t('Delete'));

  // Assert that the forum no longer exists.
  $this
    ->drupalGet('forum/' . $tid);
  $this
    ->assertResponse(404, 'The forum was not found');

  // Assert that the associated term has been removed from the
  // forum_containers variable.
  $containers = config('forum.settings')
    ->get('containers');
  $this
    ->assertFalse(in_array($tid, $containers), 'The forum_containers variable has been updated.');
}