You are here

private function ForumTest::verifyForumView in Drupal 8

Same name and namespace in other branches
  1. 9 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 698

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
    ->assertTitle($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
    ->assertRaw(\Drupal::service('renderer')
    ->renderRoot($breadcrumb), 'Breadcrumbs were displayed');
}