diff --git a/core/modules/system/tests/modules/deprecated_module/config/install/deprecated_module.settings.yml b/core/modules/system/tests/modules/deprecated_module/config/install/deprecated_module.settings.yml
new file mode 100644
index 0000000000000000000000000000000000000000..4eddb872b850c3b7a512cbd94759035452398e1e
--- /dev/null
+++ b/core/modules/system/tests/modules/deprecated_module/config/install/deprecated_module.settings.yml
@@ -0,0 +1,2 @@
+foo:
+  bar
diff --git a/core/modules/system/tests/modules/deprecated_module/config/schema/deprecated_module.schema.yml b/core/modules/system/tests/modules/deprecated_module/config/schema/deprecated_module.schema.yml
new file mode 100644
index 0000000000000000000000000000000000000000..decbe5da4de485f19b7434c05771dce62e36adfb
--- /dev/null
+++ b/core/modules/system/tests/modules/deprecated_module/config/schema/deprecated_module.schema.yml
@@ -0,0 +1,7 @@
+deprecated_module.settings:
+  type: config_object
+  label: 'deprecated_module settings'
+  mapping:
+    foo:
+      type: string
+      label: 'Wait until you meet baz!'
diff --git a/core/modules/system/tests/themes/test_deprecated_theme/config/install/test_deprecated_theme.settings.yml b/core/modules/system/tests/themes/test_deprecated_theme/config/install/test_deprecated_theme.settings.yml
new file mode 100644
index 0000000000000000000000000000000000000000..502e7f0ee3678e73ea34e21af54dbf4cd1208c44
--- /dev/null
+++ b/core/modules/system/tests/themes/test_deprecated_theme/config/install/test_deprecated_theme.settings.yml
@@ -0,0 +1,2 @@
+favicon:
+  use_default: true
diff --git a/core/modules/system/tests/themes/test_deprecated_theme/config/schema/test_deprecated_theme.schema.yml b/core/modules/system/tests/themes/test_deprecated_theme/config/schema/test_deprecated_theme.schema.yml
new file mode 100644
index 0000000000000000000000000000000000000000..5d11eca98dd1fb12f0c33c383325c1f106e8d725
--- /dev/null
+++ b/core/modules/system/tests/themes/test_deprecated_theme/config/schema/test_deprecated_theme.schema.yml
@@ -0,0 +1,3 @@
+test_deprecated_theme.settings:
+  type: theme_settings
+  label: 'test_deprecated_theme settings'
diff --git a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
index 0de9040330c0d65d9aa5707567440b1540c50f8f..5d27fd0a9a8732c0babdab4d395d0b80e0fbb29a 100644
--- a/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
+++ b/core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
@@ -49,7 +49,7 @@ class DefaultConfigTest extends KernelTestBase {
   /**
    * Tests if installed config is equal to the exported config.
    *
-   * @dataProvider coreModuleListDataProvider
+   * @dataProvider moduleListDataProvider
    */
   public function testModuleConfig($module) {
     $this->assertExtensionConfig($module, 'module');
@@ -75,6 +75,31 @@ public function testThemeConfig($theme) {
    * @internal
    */
   protected function assertExtensionConfig(string $name, string $type): void {
+    // Parse .info.yml file for module/theme $name. Since it's not installed at
+    // this point we can't retrieve it from the 'module_handler' service.
+    switch ($name) {
+      case 'test_deprecated_theme':
+        $file_name = DRUPAL_ROOT . '/core/modules/system/tests/themes/' . $name . '/' . $name . '.info.yml';
+        break;
+
+      case 'deprecated_module':
+        $file_name = DRUPAL_ROOT . '/core/modules/system/tests/modules/' . $name . '/' . $name . '.info.yml';
+        break;
+
+      default;
+        $file_name = DRUPAL_ROOT . '/core/' . $type . 's/' . $name . '/' . $name . '.info.yml';
+    }
+
+    $info = \Drupal::service('info_parser')->parse($file_name);
+    // Test we have a parsed info.yml file.
+    $this->assertNotEmpty($info);
+
+    // Skip deprecated extensions.
+    if (isset($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER])
+      && $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::DEPRECATED) {
+      $this->markTestSkipped("The $type '$name' is deprecated.");
+    }
+
     // System and user are required in order to be able to install some of the
     // other modules. Therefore they are put into static::$modules, which though
     // doesn't install config files, so import those config files explicitly. Do
@@ -114,8 +139,11 @@ protected function assertExtensionConfig(string $name, string $type): void {
   /**
    * A data provider that lists every theme in core.
    *
-   * @return array
-   *   An array of theme names to test.
+   * Also adds a deprecated theme with config.
+   *
+   * @return string[][]
+   *   An array of theme names to test, with both key and value being the name
+   *   of the theme.
    */
   public function themeListDataProvider() {
     $prefix = dirname(__DIR__, 4) . DIRECTORY_SEPARATOR . 'themes';
@@ -128,11 +156,32 @@ public function themeListDataProvider() {
     // Engines is not a theme.
     unset($themes_keyed['engines']);
 
+    // Add a deprecated theme with config.
+    $themes_keyed['test_deprecated_theme'] = 'test_deprecated_theme';
+
     return array_map(function ($theme) {
       return [$theme];
     }, $themes_keyed);
   }
 
+  /**
+   * A data provider that lists every module in core.
+   *
+   * Also adds a deprecated module with config.
+   *
+   * @return string[][]
+   *   An array of module names to test, with both key and value being the name
+   *   of the module.
+   */
+  public function moduleListDataProvider() {
+    $modules_keyed = $this->coreModuleListDataProvider();
+
+    // Add a deprecated module with config.
+    $modules_keyed['deprecated_module'] = ['deprecated_module'];
+
+    return $modules_keyed;
+  }
+
   /**
    * Tests that default config matches the installed config.
    *