You are here

public function HelpBlockTest::testHelp in Drupal 9

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

Class

HelpBlockTest
Tests display of help block.

Namespace

Drupal\Tests\help\Functional

Code

public function testHelp() {
  $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.');
}