Problem/Motivation

Part of #2649768: [meta] No definition of "Experimental" & not nearly enough warning. Site builders using experimental modules might struggle with troubleshooting or understanding the functionality of experimental modules, or with understanding why their help information is not complete.

Proposed resolution

Display a warning on the module help page when the module is experimental.

Remaining tasks

Patch needs review. Also see note in #3 about a potential followup.

User interface changes

Experimental modules display a warning message on their help page.

API changes

N/A

Data model changes

N/A

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm created an issue. See original summary.

xjm’s picture

Assigned: Unassigned » xjm
Status: Needs review » Needs work

Working on tests.

xjm’s picture

Assigned: xjm » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs tests
Related issues: +#2560597: Mark Migrate* modules as Experimental
FileSize
2.57 KB
3.59 KB
3.62 KB

Attached adds a test and also fixes a sloppy copy. The test module itself is added to system since it will be useful for other tests (e.g. #2560597: Mark Migrate* modules as Experimental itself did not add any test coverage).

I have some concern that we're making the "Core (Experimental)" package name very magical (in the original issue and again here). It might be better to add a boolean flag to the module info? That would not really have been a good choice in #2560597: Mark Migrate* modules as Experimental right before RC, but we could do it in a minor. Out of scope for this issue, but could be a followup.

xjm’s picture

Hm, assuming the test-only patch passed because of #2657482: Test bot doesn't apply the patch; we'll see what the next run reports.

The last submitted patch, experimental_help.patch, failed testing.

alexpott’s picture

  1. +++ b/core/modules/help/src/Tests/ExperimentalHelpTest.php
    @@ -0,0 +1,51 @@
    +class ExperimentalHelpTest extends WebTestBase {
    ...
    +    $this->assertText('This module is experimental.');
    

    Seems a shame to make install Drupal just to make one assertion. Couldn't this be part of Drupal\help\Tests\HelpTest::testHelp()?

  2. +++ b/core/modules/help/src/Tests/ExperimentalHelpTest.php
    @@ -0,0 +1,51 @@
    +
    +  protected function setUp() {
    

    Super minor nit... missing a docblock...

    /**
     * {@inheritdoc}
     */
    

    Would be good enough.

  3. +++ b/core/modules/system/tests/modules/experimental_module_test/experimental_module_test.info.yml
    @@ -0,0 +1,6 @@
    +package: Core (Experimental)
    

    Nice to see an test module for this... one day the three experimental modules in core might no longer be experimental :)

    And also nice the help has it's own and doesn't use system's test experimental module since we're testing help module functionality.

The last submitted patch, 3: help_experimental_2657178-3-FAIL.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 3: help_experimental_2657178-3.patch, failed testing.

xjm’s picture

Seems a shame to make install Drupal just to make one assertion. Couldn't this be part of Drupal\help\Tests\HelpTest::testHelp()?

No, I looked into that. HelpTest installs a load of crap, including standard and like all the things. Plus then we would need to add the experimental module to be installed in that test as well. Separate environment needed for the test, so separate installation makes sense.

Super minor nit... missing a docblock...

We have, or had, a standard that setUp() methods do not have docblocks. Has this changed? If it has, core is not compliant with the changed standard.

xjm’s picture

fail: [Other] Line 131 of core/modules/system/src/Tests/Module/InstallUninstallTest.php:
'Test Experimental Module module' is on the help page for experimental_module_test

fail: [Other] Line 131 of core/modules/system/src/Tests/Module/InstallUninstallTest.php:
Correct online documentation link is in the help page for experimental_module_test

Oh FFS. :P

xjm’s picture

Re: #6 point 2, I forgot that #338403: Use {@inheritdoc} on all class methods (including tests) got reopened and the policy changed. :)

alexpott’s picture

I didn't mean add another test method I meant just add it to the existing testHelp() method. In fact we could even make the help_test module an experimental module. Because that module just exists to test help... Hmmm... but actually that gets to another point - we should also test that message does not appear because it's the logic we want to test - not the message contents. So we do need 2 test modules.

xjm’s picture

Status: Needs work » Needs review
FileSize
3.95 KB
2.36 KB

Attached adds the {@inheritdoc} per #11, properly marks the experimental module as hidden, and makes it conform to the expected help documentation standards. I also made the version number match #2656994: Experimental modules should have their own version numbers. (Naturally, since we are testing the "Core (Experimental)" package, it can't be in the "Testing" package.)

xjm’s picture

Per #12, adding another assertion for a non-experimental module. We can't use help_test.module because that module is not actually for testing help -- it's for testing empty help. :P It should maybe be empty_help_test.module. But that's not in scope here, so I just added a separate test module.

I looked again at HelpTest and it really did not seem like a good fit in this case. There are many times when adding an assertion to an existing test is the best thing to do, but I don't think this is one of them.

Also adding a missing typehint to the first test module.

The last submitted patch, 14: help-2657178-14-FAIL.patch, failed testing.

xjm’s picture

+++ b/core/modules/help/src/Tests/ExperimentalHelpTest.php
@@ -49,6 +49,10 @@ public function testExperimentalHelp() {
+    // Regular modules should not display the message.
+    $this->drupalGet('admin/help/help_page_test');
+    $this->assertNoText('This module is experimental.');

This set of assertions isn't strong enough to avoid a false positive (or is it false negative?); it could be a 403/404/etc. I'll add assertions.

xjm’s picture

Fixed in attached.

xjm’s picture

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

I've manually tested the patch by enabling migrate and visiting the migrate help page and the message shows. This looks ready.

xjm’s picture

+++ b/core/modules/help/src/Tests/ExperimentalHelpTest.php
@@ -0,0 +1,62 @@
+   * overview page.

Leftover line from a copy/paste. Removed in attached. Leaving at RTBC since this is trivial/docs.

  • catch committed 7ab932f on 8.1.x
    Issue #2657178 by xjm: Warn about experimental modules on their help...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x, thanks!

Status: Fixed » Closed (fixed)

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