You are here

public function ForumTest::testForumTopicButton in Drupal 9

Evaluate whether "Add new Forum topic" button is present or not.

File

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

Class

ForumTest
Tests for forum.module.

Namespace

Drupal\Tests\forum\Functional

Code

public function testForumTopicButton() {
  $this
    ->drupalLogin($this->adminUser);

  // Validate that link doesn't exist on the forum container page.
  $forum_container = $this
    ->createForum('container');
  $this
    ->drupalGet('forum/' . $forum_container['tid']);
  $this
    ->assertSession()
    ->linkNotExists('Add new Forum topic');

  // Validate that link exists on forum page.
  $forum = $this
    ->createForum('forum');
  $this
    ->drupalGet('forum/' . $forum['tid']);
  $this
    ->assertSession()
    ->linkExists('Add new Forum topic');
}