function ForumTest::testForumTopicButton

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

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 <a href="/api/drupal/core%21modules%21forum%21forum.module/11.x" title="Provides discussion forums." class="local">forum.module</a>.

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

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