In Drupal 7, tests module can be added with hidden = TRUE property in .info file to not to display on modules list page, but tests can find and enable them using protected $modules property.

But Drupal 8 doesn't have this property and the test modules don't appear in modules list page. How does it work?


Test modules are under module_name/tests/ or module_name/tests/directory and can be enabled by TestDiscovery service. As ExtensionDiscovery::scan() calls TestDiscovery::getExtensions() method with $include_test flag TRUE.

The flag can be overridden by settings: if (!isset($include_tests)) { $include_tests = Settings::get('extension_discovery_scan_tests') || drupal_valid_test_ua(); }

See also ExtensionDiscovery::scanDirectory and RecursiveExtensionFilterIterator::acceptTests()

For manually enabling and testing a test module, it could be moved under modules directory (from /tests) and move back once development done to enable it via test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.