You are here

protected function StableLibraryOverrideTest::setUp in Drupal 8

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

Overrides KernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php, line 57

Class

StableLibraryOverrideTest
Tests Stable's library overrides.

Namespace

Drupal\KernelTests\Core\Theme

Code

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

  // 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['package'] == 'Core (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');
}