You are here

public function LegacyThemeHandlerTest::testSetDefault in Drupal 8

Tests that a deprecation error is thrown when calling ::setDefault.

@expectedDeprecation Drupal\Core\Extension\ThemeHandler::setDefault is deprecated in drupal:8.2.0 and is removed from drupal:9.0.0. Use the configuration system to edit the system.theme config directly. See https://www.drupal.org/node/3082630

File

core/tests/Drupal/KernelTests/Core/Extension/LegacyThemeHandlerTest.php, line 25

Class

LegacyThemeHandlerTest
Tests deprecated theme handler methods.

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testSetDefault() {
  $theme_handler = \Drupal::service('theme_handler');
  $theme_handler
    ->install([
    'bartik',
  ]);
  \Drupal::service('theme_handler')
    ->setDefault('bartik');
  $this
    ->assertSame('bartik', \Drupal::config('system.theme')
    ->get('default'));
}