Score:1

Missing module error while running unit test

ae flag

I am trying to run a unit test for one of my contributed modules in my local development environment. But it keeps throwing an error:

$:/path/to/web$ sudo -u www-data -E phpunit -c core/phpunit.xml profiles/abc/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentTest.php
PHPUnit 6.5.9 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\entity_clone\Functional\EntityCloneContentTest
F                                                                   1 / 1 (100%)

Time: 8.49 seconds, Memory: 4.00MB

There was 1 failure:

1) Drupal\Tests\entity_clone\Functional\EntityCloneContentTest::testContentEntityClone
Unable to install modules entity_clone, block, node, datetime due to missing modules entity_clone.

/path/to/web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:481
/path/to/web/core/tests/Drupal/Tests/BrowserTestBase.php:578
/path/to/web/core/tests/Drupal/Tests/BrowserTestBase.php:406
/path/to/web/core/modules/node/tests/src/Functional/NodeTestBase.php:33
/path/to/web/profiles/abc/modules/contrib/entity_clone/tests/src/Functional/EntityCloneContentTest.php:50

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.

Any idea what is wrong here? I have tried with a few other modules also, same error. Do I have to do anything additional to add my profiles in the phpunit.xml?

BR/Pratip

Score:1
bb flag

We ran into the same issue with the 'cookies_etracker' submodule of 'etracker'.

I guess this happens, if you have a submodule AND a composer.json in your main module (not auto-generated by Drupal). Then I guess the dependencies for the tests are not auto-generated, while Drupal.org does it if no composer.json is present in the repo.

Someone had a similar problem described here: https://www.drupal.org/forum/support/module-development-and-code-questions/2018-06-21/sub-module-dependencies and here https://github.com/acquia/coding-standards-php/issues/6

I think it's a bug / conflict in the Drupal.org Testbot: https://www.drupal.org/project/drupalci_testbot/issues/3250126

Currently the only way to solve this is to remove the composer.json from the parent module entirely (which might not be wanted in most cases).

ae flag
Appreciate your help. Will test it in a few days.
JPustkuchen avatar
bb flag
@PratipGhosh have you been successful? Would be nice for others here to know, if it helped or how you fixed it.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.