function InstallUninstallTest::assertHelp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php \Drupal\Tests\system\Functional\Module\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.

Parameters

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

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

1 call to InstallUninstallTest::assertHelp()
InstallUninstallTest::testInstallUninstall in core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php
Tests that a fixed set of modules can be installed and uninstalled.

File

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

Class

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

Namespace

Drupal\Tests\system\Functional\Module

Code

protected function assertHelp($module, $name) {
    $this->drupalGet('admin/help/' . $module);
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->assertText($name . ' module', "'{$name} module' is on the help page for {$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.