function StableLibraryOverrideTestBase::enableVisibleAndStableCoreModules

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php \Drupal\KernelTests\Core\Theme\StableLibraryOverrideTestBase::enableVisibleAndStableCoreModules()
  2. 11.x core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTestBase.php \Drupal\KernelTests\Core\Theme\StableLibraryOverrideTestBase::enableVisibleAndStableCoreModules()

Enable all core modules that are not hidden or experimental.

2 calls to StableLibraryOverrideTestBase::enableVisibleAndStableCoreModules()
Stable9LibraryOverrideTest::setUp in core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php
StableLibraryOverrideTest::setUp in core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php

File

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

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.