function HelpBlockTest::testHelp

Same name in other branches
  1. 9 core/modules/help/tests/src/Functional/HelpBlockTest.php \Drupal\Tests\help\Functional\HelpBlockTest::testHelp()
  2. 8.9.x core/modules/help/tests/src/Functional/HelpBlockTest.php \Drupal\Tests\help\Functional\HelpBlockTest::testHelp()
  3. 11.x core/modules/help/tests/src/Functional/HelpBlockTest.php \Drupal\Tests\help\Functional\HelpBlockTest::testHelp()

Logs in users, tests help pages.

File

core/modules/help/tests/src/Functional/HelpBlockTest.php, line 49

Class

HelpBlockTest
Tests display of help block.

Namespace

Drupal\Tests\help\Functional

Code

public function testHelp() : void {
    $this->drupalGet('help_page_test/has_help');
    $this->assertSession()
        ->pageTextContains('I have help!');
    $this->assertSession()
        ->pageTextContains($this->helpBlock
        ->label());
    $this->drupalGet('help_page_test/no_help');
    // The help block should not appear when there is no help.
    $this->assertSession()
        ->pageTextNotContains($this->helpBlock
        ->label());
    // Ensure that if two hook_help() implementations both return a render array
    // the output is as expected.
    $this->drupalGet('help_page_test/test_array');
    $this->assertSession()
        ->pageTextContains('Help text from more_help_page_test_help module.');
    $this->assertSession()
        ->pageTextContains('Help text from help_page_test_help module.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.