function ForumTest::deleteForum

Same name and namespace in other branches
  1. 9 core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::deleteForum()
  2. 10 core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::deleteForum()
  3. 11.x core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::deleteForum()

Deletes a forum.

Parameters

int $tid: The forum ID.

1 call to ForumTest::deleteForum()
ForumTest::doAdminTests in core/modules/forum/tests/src/Functional/ForumTest.php
Runs admin tests on the admin user.

File

core/modules/forum/tests/src/Functional/ForumTest.php, line 487

Class

ForumTest
Tests for <a href="/api/drupal/core%21modules%21forum%21forum.module/8.9.x" title="Provides discussion forums." class="local">forum.module</a>.

Namespace

Drupal\Tests\forum\Functional

Code

public function deleteForum($tid) {
    // Delete the forum.
    $this->drupalGet('admin/structure/forum/edit/forum/' . $tid);
    $this->clickLink(t('Delete'));
    $this->assertText('Are you sure you want to delete the forum');
    $this->assertNoText('Add forum');
    $this->assertNoText('Add forum container');
    $this->drupalPostForm(NULL, [], t('Delete'));
    // Assert that the forum no longer exists.
    $this->drupalGet('forum/' . $tid);
    $this->assertSession()
        ->statusCodeEquals(404);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.