You are here

private function ForumTest::verifyForumView in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/forum/tests/src/Functional/ForumTest.php \Drupal\Tests\forum\Functional\ForumTest::verifyForumView()
  2. 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.

File

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

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