Problem/Motivation
As a spin-off from #3037228: Add more test coverage to Help Topics, we would like to ensure that all topics written for the new Help Topics Core module have proper syntax, for all non-test modules in Core.
Proposed resolution
Add checks for the following syntax issues:
- Meta tag for the title (label) must be present (help_topic:label)
- Topic must be either top-level or related to a top-level topic
- HTML syntax is valid (without the Twig stuff and meta tags)
- All text in the topic is wrapped in Twig translation tags.
- No H1 tag
- If there is an H3, there should be an H2, and so on
- The topics can be viewed at their URL
Things we are not explicitly testing in this test:
- The discovery process already reads label, related, and top-level from the meta tags, so this test can use the result instead of verifying the meta tags itself.
- The discovery process throws an exception if any other meta tags are encountered
- We are only testing Core. It would be desirable to also test Contrib but I'm not sure how we could accomplish this... but as a note, if a particular contrib module is in the file system when you run these tests, it will be discovered and tested.
Remaining tasks
Add the checks.
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
Added new checks to ensure Help Topic Twig files have proper syntax.
ISSUE CREDIT
This was spun off from #3037228: Add more test coverage to Help Topics and a patch there was the starting point:
https://www.drupal.org/files/issues/2019-07-08/core-add-more-test-covera...
Please credit scott_euser on this issue, who created that patch, and jhodgdon, who reviewed it.