You are here

protected function Stable9LibraryOverrideTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php \Drupal\KernelTests\Core\Theme\Stable9LibraryOverrideTest::setUp()

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Theme/Stable9LibraryOverrideTest.php, line 58

Class

Stable9LibraryOverrideTest
Tests Stable 9's library overrides.

Namespace

Drupal\KernelTests\Core\Theme

Code

protected function setUp() : void {
  parent::setUp();
  $this->container
    ->get('theme_installer')
    ->install([
    'stable9',
  ]);

  // Enable all core modules.
  $all_modules = $this->container
    ->get('extension.list.module')
    ->getList();
  $all_modules = array_filter($all_modules, function ($module) {

    // Filter contrib, hidden, experimental, 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) {
      return FALSE;
    }
    return TRUE;
  });
  $this->allModules = array_keys($all_modules);
  $this->allModules[] = 'system';
  $this->allModules[] = 'user';
  $this->allModules[] = 'path_alias';
  sort($this->allModules);
  $this->container
    ->get('module_installer')
    ->install($this->allModules);
  $this->themeManager = $this->container
    ->get('theme.manager');
  $this->themeInitialization = $this->container
    ->get('theme.initialization');
  $this->libraryDiscovery = $this->container
    ->get('library.discovery');
}