You are here

protected function StableLibraryOverrideTestBase::enableVisibleAndStableCoreModules in Drupal 10

Enable all core modules that are not hidden or experimental.

File

core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php, line 53

Class

StableLibraryOverrideTestBase
Tests the behavior of a theme when base_theme info key is missing.

Namespace

Drupal\KernelTests\Core\Theme

Code

protected function enableVisibleAndStableCoreModules() : void {
  $all_modules = $this->container
    ->get('extension.list.module')
    ->getList();
  $all_modules = array_filter($all_modules, function ($module) {

    // Filter contrib, hidden, experimental, deprecated, and already enabled
    // modules, and modules in the Testing package.
    if ($module->origin !== 'core' || !empty($module->info['hidden']) || $module->status == TRUE || $module->info['package'] == 'Testing' || $module->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::EXPERIMENTAL || $module->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) {
      return FALSE;
    }
    return TRUE;
  });
  $this->allModules = array_keys($all_modules);
  $this->allModules[] = 'system';
  $this->allModules[] = 'user';
  $this->allModules[] = 'path_alias';
  $database_module = \Drupal::database()
    ->getProvider();
  if ($database_module !== 'core') {
    $this->allModules[] = $database_module;
  }
  sort($this->allModules);
  $this->container
    ->get('module_installer')
    ->install($this->allModules);
}