Issue #3183739: Functional tests are installing all default farmOS modules

This is a temporary first step, but not a proper solution to the issue.
This commit is contained in:
Michael Stenta 2020-11-20 11:32:44 -05:00
parent 8419dc530e
commit 11c2f324e1
2 changed files with 23 additions and 0 deletions

View File

@ -55,6 +55,14 @@ function farm_install_modules(array &$install_state) {
// the \Drupal\farm\Form\FarmModulesForm submit method.
$modules = \Drupal::state()->get('farm.install_modules') ?: [];
// If this is running in the context of a functional test, do not install any
// additional modules. This is a temporary hack.
// @see Drupal\Tests\farm\Functional\FarmBrowserTestBase::setUp()
// @todo https://www.drupal.org/project/farm/issues/3183739
if (!empty($GLOBALS['farm_test'])) {
$modules = [];
}
// Load a list of all available modules, so that we can display their names.
$module_handler = \Drupal::service('module_handler');

View File

@ -13,4 +13,19 @@ class FarmBrowserTestBase extends BrowserTestBase {
* {@inheritdoc}
*/
protected $profile = 'farm';
/**
* {@inheritdoc}
*/
protected function setUp(): void {
// Set a global farm_test variable and then delegate to the parent setUp().
// This is a temporary hack to prevent optional default farmOS modules from
// being installed via the profile's hook_install_tasks().
// @see farm_install_modules()
// @todo https://www.drupal.org/project/farm/issues/3183739
$GLOBALS['farm_test'] = TRUE;
parent::setUp();
}
}