function ForumTest::testForumTopicButton

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

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

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