The test calls \Drupal::service('module_installer')->install(...) and does not check the result to see that the module was installed correctly.

This patch from #1719648: ModuleInstaller::install() should provide more information than simply returning FALSE when a module isn't in the file system shows the installation in fact fails.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

joachim’s picture

Status: Active » Needs review

Oops.

Test should fail.

Status: Needs review » Needs work
almaudoh’s picture

  1. +++ b/core/modules/config/src/Tests/ConfigInstallWebTest.php
    @@ -132,7 +132,8 @@ function testInstallProfileConfigOverwrite() {
         // Turn on the test module, which will attempt to replace the
         // configuration data. This attempt to replace the active configuration
         // should be ignored.
    

    This comment doesn't match the code, the test module referred to is empty. This fails because the config_existing_default_config_test.yml is wrongly named, should be config_existing_default_config_test.info.yml. I don't know if this is intentional or not. CMI folks may want to take a look at this.

  2. +++ b/core/modules/config/src/Tests/ConfigInstallWebTest.php
    @@ -132,7 +132,8 @@ function testInstallProfileConfigOverwrite() {
    -    \Drupal::service('module_installer')->install(array('config_existing_default_config_test'));
    +    $status = \Drupal::service('module_installer')->install(array('config_existing_default_config_test'));
    +    $this->assertTrue($status, "The module config_existing_default_config_test was installed.");
    

    Another test in the class (::testIntegrationModuleReinstallation) also does similar ModuleInstaller::install(), maybe we can extend this check to include those.

Berdir’s picture

Issue tags: +Novice

1. That is wrong, it should be renamed. Tagging Novice to do exactly that, provide a patch with that rename and the test change from the initial patch and then it should be green.

tadityar’s picture

Status: Needs work » Needs review
FileSize
941 bytes

Is this the file that should be renamed?

Berdir’s picture

Status: Needs review » Needs work

I can't say, the patch doesn't contain it :)

rpayanm’s picture

Status: Needs work » Needs review
FileSize
1.97 KB

Trying...

Berdir’s picture

Rename looks correct, have a look at https://www.drupal.org/documentation/git/configure for configuring git diff so that it picks up the rename as a rename and not a delete/add of a new file.

I believe we no longer add explicit hidden: true to modules in tests/modules folders, as they are automatically hidden (or non-existent, actually) when you're not within a test.

rpayanm’s picture

FileSize
575 bytes
1.72 KB

Config git successfully ! Thank you :)

Berdir’s picture

Assigned: Unassigned » alexpott
Status: Needs review » Reviewed & tested by the community

I think this is good to go, we could also check the other install() call, but I think #1719648: ModuleInstaller::install() should provide more information than simply returning FALSE when a module isn't in the file system will take care of that in a more generic and better way.

RTBC, alexpott will probably want to see this, so assigning to him.

joachim’s picture

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Nice find. Committed 8e7f24f and pushed to 8.0.x. Thanks!

  • alexpott committed 8e7f24f on 8.0.x
    Issue #2387669 by rpayanm, joachim, tadityar: ConfigInstallWebTest is...

Status: Fixed » Closed (fixed)

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