Problem/Motivation

We have suffered numerous regressions in hook_help(), and issues like #2183113: Update hook_help signature to use route_name instead of path have made that all the more glaring.

Proposed resolution

Devise a way to sanely and automatically test hook_help()

Remaining tasks

Figure out how to do that

User interface changes

N/A

API changes

N/A

Comments

sun’s picture

The mere existence of this issue means that the existing (wildcard) HelpTest is useless, because it does not actually assert anything, despite enabling most core modules.

In turn, #2254185: Remove Drupal\help\Tests\HelpTest can be re-purposed to remove that test.


The maximum I could foresee for this issue here would be a test or test base class that

  1. Reads $module.routing.yml.
  2. Loads $module.module.
  3. Asserts that every defined route returns some non-empty help text when passed to $module_help().
  4. Optionally allowing final test classes to specify route names that are expected to have no help.
effulgentsia’s picture

Priority: Normal » Major

Raising to Major given that there is help text on many many pages and testing each one manually is tedious.

dawehner’s picture

Status: Active » Fixed

We actually have a test now which enables each modules separately and checks whether hook_help() works. Given that I think this covers the issue.

See \Drupal\help\Tests\HelpTest::verifyHelp

jhodgdon’s picture

Well. verifyHelp() actually does not do what is stated in #3. It just finds the list of currently enabled modules with hook_help() implementations, and verifies that they don't have double-escaping and some other stuff, which is good. It also verifies help permissions.

#2488032: Integrate help test into module uninstall test is actually attempting to do what is stated in #3, which is verifying that each module's help works without other non-required modules being enabled.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.