You are here

protected function MonitoringTestTrait::uninstallModules in Monitoring 8

Uninstall modules and fix test container.

Parameters

string[] $module_list: The modules to uninstall.

bool $uninstall_dependents: (optional) If TRUE, dependent modules will automatically be uninstalled 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::installModules()

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

4 calls to MonitoringTestTrait::uninstallModules()
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.
MonitoringUITest::testSensorDisappearedSensorsUI in tests/src/Functional/MonitoringUITest.php
UI Tests for disappearing sensors.

File

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

Class

MonitoringTestTrait
Monitoring test helper trait.

Namespace

Drupal\Tests\monitoring\Functional

Code

protected function uninstallModules(array $module_list, $uninstall_dependents = TRUE) {

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

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

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