diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php
index 59cfd99..be356ae 100644
--- a/core/lib/Drupal/Core/Extension/ThemeHandler.php
+++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php
@@ -149,20 +149,6 @@ public function getDefault() {
   /**
    * {@inheritdoc}
    */
-  public function setDefault($name) {
-    $list = $this->listInfo();
-    if (!isset($list[$name])) {
-      throw new \InvalidArgumentException("$name theme is not installed.");
-    }
-    $this->configFactory->getEditable('system.theme')
-      ->set('default', $name)
-      ->save();
-    return $this;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function install(array $theme_list, $install_dependencies = TRUE) {
     // We keep the old install() method as BC layer but redirect directly to the
     // theme installer.
diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php
index 5ac3a04..7cd976f 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php
@@ -278,7 +278,7 @@ function testBuildContentsCssJSSetting() {
 
     // Enable the Bartik theme, which specifies a CKEditor stylesheet.
     \Drupal::service('theme_handler')->install(['bartik']);
-    \Drupal::service('theme_handler')->setDefault('bartik');
+    $this->config('system.theme')->set('default', 'bartik')->save();
     $expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/base/elements.css'));
     $expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/components/captions.css'));
     $expected[] = file_url_transform_relative(file_create_url('core/themes/bartik/css/components/table.css'));
diff --git a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
index a53a2fb..b216578 100644
--- a/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
+++ b/core/modules/field/src/Tests/EntityReference/EntityReferenceFormatterTest.php
@@ -68,7 +68,7 @@ protected function setUp() {
 
     // Use Classy theme for testing markup output.
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
 
     // Grant the 'view test entity' permission.
     $this->installConfig(array('user'));
diff --git a/core/modules/field/tests/src/Kernel/DisplayApiTest.php b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
index 66bf1e9..24986ef 100644
--- a/core/modules/field/tests/src/Kernel/DisplayApiTest.php
+++ b/core/modules/field/tests/src/Kernel/DisplayApiTest.php
@@ -128,7 +128,7 @@ function testFieldItemListView() {
     $items = $this->entity->get($this->fieldName);
 
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
 
     // No display settings: check that default display settings are used.
     $build = $items->view();
diff --git a/core/modules/rdf/src/Tests/StandardProfileTest.php b/core/modules/rdf/src/Tests/StandardProfileTest.php
index e5b42ac..f20fe89 100644
--- a/core/modules/rdf/src/Tests/StandardProfileTest.php
+++ b/core/modules/rdf/src/Tests/StandardProfileTest.php
@@ -112,7 +112,7 @@ protected function setUp() {
 
     // Use Classy theme for testing markup output.
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
 
     $this->baseUri = \Drupal::url('<front>', [], ['absolute' => TRUE]);
 
diff --git a/core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php b/core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
index 52553a9..7111334 100644
--- a/core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
+++ b/core/modules/rdf/tests/src/Kernel/Field/NumberFieldRdfaTest.php
@@ -35,7 +35,7 @@ public function testIntegerFormatter() {
    */
   public function testIntegerFormatterWithSettings() {
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
     $this->fieldType = 'integer';
     $formatter = array(
       'type' => 'number_integer',
@@ -78,7 +78,7 @@ public function testFloatFormatter() {
    */
   public function testFloatFormatterWithSettings() {
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
     $this->fieldType = 'float';
     $formatter = array(
       'type' => 'number_decimal',
@@ -128,7 +128,7 @@ public function testFloatFormatterWithScale() {
    */
   public function testFloatFormatterWithScaleExercised() {
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
     $this->fieldType = 'float';
     $formatter = array(
       'type' => 'number_decimal',
@@ -166,7 +166,7 @@ public function testDecimalFormatter() {
    */
   public function testDecimalFormatterWithSettings() {
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
     $this->fieldType = 'decimal';
     $formatter = array(
       'type' => 'number_decimal',
diff --git a/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php b/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
index bb80e8b..2f172a0 100644
--- a/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
+++ b/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
@@ -44,7 +44,7 @@ public function testCurrentTheme() {
     $this->assertTrue($condition_negated->execute());
 
     // Set the expected theme to be used.
-    \Drupal::service('theme_handler')->setDefault('test_theme');
+    $this->config('system.theme')->set('default', 'test_theme')->save();
     \Drupal::theme()->resetActiveTheme();
 
     $this->assertTrue($condition->execute());
diff --git a/core/modules/system/src/Tests/Render/Element/TableTest.php b/core/modules/system/src/Tests/Render/Element/TableTest.php
index 827b55a..efd24b1 100644
--- a/core/modules/system/src/Tests/Render/Element/TableTest.php
+++ b/core/modules/system/src/Tests/Render/Element/TableTest.php
@@ -97,7 +97,7 @@ function testThemeTableWithEmptyMessage() {
 
     // Enable the Classy theme.
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
 
     $this->render($table);
     $this->removeWhiteSpace();
diff --git a/core/modules/system/src/Tests/System/SiteMaintenanceTest.php b/core/modules/system/src/Tests/System/SiteMaintenanceTest.php
index b89dc81..13a65a3 100644
--- a/core/modules/system/src/Tests/System/SiteMaintenanceTest.php
+++ b/core/modules/system/src/Tests/System/SiteMaintenanceTest.php
@@ -128,7 +128,7 @@ protected function testSiteMaintenance() {
 
     // Regression test to check if title displays in Bartik on maintenance page.
     \Drupal::service('theme_handler')->install(array('bartik'));
-    \Drupal::service('theme_handler')->setDefault('bartik');
+    $this->config('system.theme')->set('default', 'bartik')->save();
 
     // Logout and verify that offline message is displayed in Bartik.
     $this->drupalLogout();
diff --git a/core/modules/system/src/Tests/Theme/MessageTest.php b/core/modules/system/src/Tests/Theme/MessageTest.php
index 878d5bc..db27d2a 100644
--- a/core/modules/system/src/Tests/Theme/MessageTest.php
+++ b/core/modules/system/src/Tests/Theme/MessageTest.php
@@ -27,7 +27,7 @@ class MessageTest extends KernelTestBase {
   function testMessages() {
     // Enable the Classy theme.
     \Drupal::service('theme_handler')->install(['classy']);
-    \Drupal::service('theme_handler')->setDefault('classy');
+    $this->config('system.theme')->set('default', 'classy')->save();
 
     drupal_set_message('An error occurred', 'error');
     drupal_set_message('But then something nice happened');
diff --git a/core/modules/system/src/Tests/Theme/ThemeTest.php b/core/modules/system/src/Tests/Theme/ThemeTest.php
index 3d8b784..380c657 100644
--- a/core/modules/system/src/Tests/Theme/ThemeTest.php
+++ b/core/modules/system/src/Tests/Theme/ThemeTest.php
@@ -303,7 +303,7 @@ public function testRegionClass() {
    * when needed.
    */
   public function testSuggestionPreprocessForDefaults() {
-    \Drupal::service('theme_handler')->setDefault('test_theme');
+    $this->config('system.theme')->set('default', 'test_theme')->save();
     // Test with both an unprimed and primed theme registry.
     drupal_theme_rebuild();
     for ($i = 0; $i < 2; $i++) {
diff --git a/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php b/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php
index c220dde..1b330d0 100644
--- a/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php
+++ b/core/modules/system/src/Tests/Theme/TwigDebugMarkupTest.php
@@ -31,7 +31,7 @@ function testTwigDebugMarkup() {
     $renderer = $this->container->get('renderer');
     $extension = twig_extension();
     \Drupal::service('theme_handler')->install(array('test_theme'));
-    \Drupal::service('theme_handler')->setDefault('test_theme');
+    $this->config('system.theme')->set('default', 'test_theme')->save();
     $this->drupalCreateContentType(array('type' => 'page'));
     // Enable debug, rebuild the service container, and clear all caches.
     $parameters = $this->container->getParameter('twig.config');
diff --git a/core/modules/system/src/Tests/Theme/TwigTransTest.php b/core/modules/system/src/Tests/Theme/TwigTransTest.php
index 9eec247..867c4d5 100644
--- a/core/modules/system/src/Tests/Theme/TwigTransTest.php
+++ b/core/modules/system/src/Tests/Theme/TwigTransTest.php
@@ -54,7 +54,7 @@ protected function setUp() {
 
     // Setup test_theme.
     \Drupal::service('theme_handler')->install(array('test_theme'));
-    \Drupal::service('theme_handler')->setDefault('test_theme');
+    $this->config('system.theme')->set('default', 'test_theme')->save();
 
     // Create and log in as admin.
     $this->adminUser = $this->drupalCreateUser(array(
