function HelpTopicTest::verifyHelp
Same name in other branches
- 9 core/modules/help_topics/tests/src/Functional/HelpTopicTest.php \Drupal\Tests\help_topics\Functional\HelpTopicTest::verifyHelp()
- 10 core/modules/help/tests/src/Functional/HelpTopicTest.php \Drupal\Tests\help\Functional\HelpTopicTest::verifyHelp()
- 11.x core/modules/help/tests/src/Functional/HelpTopicTest.php \Drupal\Tests\help\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\FunctionalCode
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);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.