You are here

public function ForumTest::deleteForum in Drupal 9

Same name and namespace in other branches
  1. 8 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 490

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