function GenericModuleTestBase::assertHookHelp

Same name in other branches
  1. 11.x core/modules/system/tests/src/Functional/Module/GenericModuleTestBase.php \Drupal\Tests\system\Functional\Module\GenericModuleTestBase::assertHookHelp()

Verifies hook_help() syntax.

Parameters

string $module: The module.

1 call to GenericModuleTestBase::assertHookHelp()
GenericModuleTestBase::testModuleGenericIssues in core/modules/system/tests/src/Functional/Module/GenericModuleTestBase.php
Checks some generic things about a module.

File

core/modules/system/tests/src/Functional/Module/GenericModuleTestBase.php, line 70

Class

GenericModuleTestBase
Runs a series of generic tests for one module.

Namespace

Drupal\Tests\system\Functional\Module

Code

protected function assertHookHelp(string $module) : void {
    $info = \Drupal::service('extension.list.module')->getExtensionInfo($module);
    if (empty($info['hidden'])) {
        $this->drupalGet('admin/help/' . $module);
        $this->assertSession()
            ->statusCodeEquals(200);
        $this->assertSession()
            ->pageTextContains($info['name'] . ' module');
        $this->assertSession()
            ->linkExists('online documentation for the ' . $info['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.