You are here

protected function MonitoringTestTrait::installModules in Monitoring 8

Install modules and fix test container.

Parameters

string[] $module_list: An array of module names.

bool $enable_dependencies: (optional) If TRUE, dependencies will automatically be installed in the correct order. This incurs a significant performance cost, so use FALSE if you know $module_list is already complete.

Return value

bool FALSE if one or more dependencies are missing, TRUE otherwise.

See also

\Drupal\Tests\monitoring\Functional\MonitoringTestBase::uninstallModules()

\Drupal\Core\Extension\ModuleInstallerInterface::install()

5 calls to MonitoringTestTrait::installModules()
MonitoringCoreWebTest::testSensorDisappearedSensors in tests/src/Functional/MonitoringCoreWebTest.php
Tests for disappearing sensors.
MonitoringCoreWebTest::testSensorInstalledModulesAPI in tests/src/Functional/MonitoringCoreWebTest.php
Tests enabled modules sensor.
MonitoringCoreWebTest::testUpdateRequirementsSensors in tests/src/Functional/MonitoringCoreWebTest.php
Tests that requirements sensors are properly updated when installing and uninstalling a module.
MonitoringUiJavascriptTest::testSensorInstalledModulesUI in tests/src/FunctionalJavascript/MonitoringUiJavascriptTest.php
Tests the UI/settings of the installed modules sensor.
MonitoringUITest::testSensorDisappearedSensorsUI in tests/src/Functional/MonitoringUITest.php
UI Tests for disappearing sensors.

File

tests/src/Functional/MonitoringTestTrait.php, line 43

Class

MonitoringTestTrait
Monitoring test helper trait.

Namespace

Drupal\Tests\monitoring\Functional

Code

protected function installModules(array $module_list, $enable_dependencies = TRUE) {

  /** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_handler */
  $module_handler = \Drupal::service('module_installer');

  // Install the modules requested.
  $return = $module_handler
    ->install($module_list, $enable_dependencies);

  // The container is rebuilt, thus reassign it.
  $this->container = \Drupal::getContainer();
  return $return;
}