function ComponentKernelTestBase::setUp
Overrides KernelTestBase::setUp
File
- 
              core/
tests/ Drupal/ Tests/ Core/ Theme/ Component/ ComponentKernelTestBase.php, line 52  
Class
- ComponentKernelTestBase
 - Defines a base class for component kernel tests.
 
Namespace
Drupal\Tests\Core\Theme\ComponentCode
protected function setUp() : void {
  parent::setUp();
  if (empty(static::$themes)) {
    throw new \Exception('You need to set the protected static $themes property on your test class, with the first item being the default theme.');
  }
  $this->container
    ->get('theme_installer')
    ->install(static::$themes);
  $this->installConfig('system');
  $system_theme_config = $this->container
    ->get('config.factory')
    ->getEditable('system.theme');
  $theme_name = reset(static::$themes);
  $system_theme_config->set('default', $theme_name)
    ->save();
  $theme_manager = \Drupal::service('theme.manager');
  $active_theme = \Drupal::service('theme.initialization')->initTheme($theme_name);
  $theme_manager->setActiveTheme($active_theme);
  $this->negotiator = new ComponentNegotiator($theme_manager, \Drupal::service('extension.list.module'));
  $this->manager = \Drupal::service('plugin.manager.sdc');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.