function ForumTest::deleteForum

Same name in other branches
  1. 9 core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::deleteForum()
  2. 8.9.x 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 491

Class

ForumTest
Tests for forum.module.

Namespace

Drupal\Tests\forum\Functional

Code

public function deleteForum($tid) {
    // Delete the forum.
    $this->drupalGet('admin/structure/forum/edit/forum/' . $tid);
    $this->clickLink('Delete');
    $this->assertSession()
        ->pageTextContains('Are you sure you want to delete the forum');
    $this->assertSession()
        ->pageTextNotContains('Add forum');
    $this->assertSession()
        ->pageTextNotContains('Add forum container');
    $this->submitForm([], '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.