You are here

private function ForumTest::verifyForumView in Drupal 9

Same name and namespace in other branches
  1. 8 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(t('Home'), '<front>'),
    Link::createFromRoute(t('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));
}