function ForumTest::verifyForumView

Same name in other branches
  1. 9 core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::verifyForumView()
  2. 8.9.x core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::verifyForumView()
  3. 11.x core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::verifyForumView()

Verifies the display of a forum page.

Parameters

array $forum: A row from the taxonomy_term_data table in an array.

array $parent: (optional) An array representing the forum's parent.

1 call to ForumTest::verifyForumView()
ForumTest::verifyForums in core/modules/forum/tests/src/Functional/ForumTest.php
Verifies that the logged in user has access to a forum node.

File

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

Class

ForumTest
Tests for forum.module.

Namespace

Drupal\Tests\forum\Functional

Code

private function verifyForumView($forum, $parent = NULL) {
    // View forum page.
    $this->drupalGet('forum/' . $forum['tid']);
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertSession()
        ->titleEquals($forum['name'] . ' | Drupal');
    $breadcrumb_build = [
        Link::createFromRoute('Home', '<front>'),
        Link::createFromRoute('Forums', 'forum.index'),
    ];
    if (isset($parent)) {
        $breadcrumb_build[] = Link::createFromRoute($parent['name'], 'forum.page', [
            'taxonomy_term' => $parent['tid'],
        ]);
    }
    $breadcrumb = [
        '#theme' => 'breadcrumb',
        '#links' => $breadcrumb_build,
    ];
    $this->assertSession()
        ->responseContains(\Drupal::service('renderer')->renderRoot($breadcrumb));
}

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