function InstallUninstallTest::assertHelp

Verifies a module's help.

Verifies that the module help page from hook_help() exists and can be displayed, and that it contains the phrase "Foo Bar module", where "Foo Bar" is the name of the module from the .info.yml file.

@internal

Parameters

string $module: Machine name of the module to verify.

string $name: Human-readable name of the module to verify.

File

core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php, line 409

Class

InstallUninstallTest
Install/uninstall core module and confirm table creation/deletion.

Namespace

Drupal\Tests\system\Functional\Module

Code

protected function assertHelp(string $module, string $name) : void {
  $this->drupalGet('admin/help/' . $module);
  $this->assertSession()
    ->statusCodeEquals(200);
  $this->assertSession()
    ->pageTextContains($name . ' module');
  $this->assertSession()
    ->linkExists('online documentation for the ' . $name . ' module', 0, "Correct online documentation link is in the help page for {$module}");
}

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