You are here

public function ForumTest::deleteForum in Drupal 10

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

Deletes a forum.

Parameters

int $tid: The forum ID.

File

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

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