You are here

protected function HelpTopicTest::verifyHelp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/help_topics/tests/src/Functional/HelpTopicTest.php \Drupal\Tests\help_topics\Functional\HelpTopicTest::verifyHelp()

Verifies the logged in user has access to various help links and pages.

Parameters

int $response: (optional) The HTTP response code to test for. If it's 200 (default), the test verifies the user sees the help; if it's not, it verifies they are denied access.

1 call to HelpTopicTest::verifyHelp()
HelpTopicTest::testHelp in core/modules/help_topics/tests/src/Functional/HelpTopicTest.php
Tests the main help page and individual pages for topics.

File

core/modules/help_topics/tests/src/Functional/HelpTopicTest.php, line 150

Class

HelpTopicTest
Verifies help topic display and user access to help based on permissions.

Namespace

Drupal\Tests\help_topics\Functional

Code

protected function verifyHelp($response = 200) {

  // Verify access to help topic pages.
  foreach ($this
    ->getTopicList() as $topic => $info) {

    // View help topic page.
    $this
      ->drupalGet('admin/help/topic/' . $topic);
    $session = $this
      ->assertSession();
    $session
      ->statusCodeEquals($response);
    if ($response == 200) {

      // Verify page information.
      $name = $info['name'];
      $session
        ->titleEquals($name . ' | Drupal');
      $session
        ->responseContains('<h1 class="page-title">' . $name . '</h1>');
      foreach ($info['tags'] as $tag) {
        $session
          ->responseHeaderContains('X-Drupal-Cache-Tags', $tag);
      }
    }
  }
}