From 5c254c67a18a8b71a50b2b853aec2e0bb0356d45 Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Mon, 4 Mar 2024 10:57:07 +0000
Subject: [PATCH] Issue #3321634 by Spokje, andypost: Remove legacy
 experimental:true and its deprecation and test-files

---
 core/lib/Drupal/Core/Extension/Extension.php  |  9 -----
 core/modules/system/system.install            |  8 -----
 .../theme_page_test/theme_page_test.module    |  7 ++--
 ...xperimental_theme_dependency_test.info.yml |  5 ---
 .../legacy_experimental_theme_test.info.yml   |  7 ----
 .../Extension/ExperimentalDeprecationTest.php | 33 -------------------
 6 files changed, 2 insertions(+), 67 deletions(-)
 delete mode 100644 core/modules/system/tests/themes/legacy_experimental_theme_dependency_test/legacy_experimental_theme_dependency_test.info.yml
 delete mode 100644 core/modules/system/tests/themes/legacy_experimental_theme_test/legacy_experimental_theme_test.info.yml
 delete mode 100644 core/tests/Drupal/KernelTests/Core/Extension/ExperimentalDeprecationTest.php

diff --git a/core/lib/Drupal/Core/Extension/Extension.php b/core/lib/Drupal/Core/Extension/Extension.php
index 8ad50a565b76..3ef96ffbd3cd 100644
--- a/core/lib/Drupal/Core/Extension/Extension.php
+++ b/core/lib/Drupal/Core/Extension/Extension.php
@@ -223,15 +223,6 @@ public function __wakeup() {
    *   TRUE if an extension is marked as experimental, FALSE otherwise.
    */
   public function isExperimental(): bool {
-    // Currently, this function checks for both the key/value pairs
-    // 'experimental: true' and 'lifecycle: experimental' to determine if an
-    // extension is marked as experimental.
-    // @todo Remove the deprecation check for 'experimental: true' as part of
-    // https://www.drupal.org/node/3321634
-    if (isset($this->info['experimental']) && $this->info['experimental']) {
-      @trigger_error('The key-value pair "experimental: true" is deprecated in drupal:10.1.0 and will be removed before drupal:11.0.0. Use the key-value pair "lifecycle: experimental" instead. See https://www.drupal.org/node/3263585', E_USER_DEPRECATED);
-      return TRUE;
-    }
     return (isset($this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER])
         && $this->info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::EXPERIMENTAL);
   }
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 02aacbc193e2..bdf7d7793729 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -158,14 +158,6 @@ function system_requirements($phase) {
           $obsolete_extensions[$theme] = ['name' => $info['name'], 'lifecycle_link' => $info['lifecycle_link']];
         }
       }
-      // Currently, we check for both the key/value pairs 'experimental: true'
-      // and 'lifecycle: experimental' to determine if an extension is marked as
-      // experimental.
-      // @todo Remove the check for 'experimental: true' as part of
-      // https://www.drupal.org/node/3250342
-      if (isset($data->info['experimental']) && $data->info['experimental']) {
-        $experimental_themes[$theme] = $data->info['name'];
-      }
     }
 
     // Warn if any experimental themes are installed.
diff --git a/core/modules/system/tests/modules/theme_page_test/theme_page_test.module b/core/modules/system/tests/modules/theme_page_test/theme_page_test.module
index 04b052352742..d5f0a3896cbc 100644
--- a/core/modules/system/tests/modules/theme_page_test/theme_page_test.module
+++ b/core/modules/system/tests/modules/theme_page_test/theme_page_test.module
@@ -11,11 +11,8 @@
  * Implements hook_system_info_alter().
  */
 function theme_page_test_system_info_alter(&$info, Extension $file, $type) {
-  // Make sure that all themes are visible on the Appearance form, except for
-  // the legacy_experimental_theme_test theme.
-  // @todo Remove the exception for this theme in
-  //   https://www.drupal.org/node/3321634
-  if ($type === 'theme' && $info['name'] !== 'Legacy experimental test') {
+  // Make sure that all themes are visible on the Appearance form.
+  if ($type === 'theme') {
     unset($info['hidden']);
   }
 }
diff --git a/core/modules/system/tests/themes/legacy_experimental_theme_dependency_test/legacy_experimental_theme_dependency_test.info.yml b/core/modules/system/tests/themes/legacy_experimental_theme_dependency_test/legacy_experimental_theme_dependency_test.info.yml
deleted file mode 100644
index dc6173c130af..000000000000
--- a/core/modules/system/tests/themes/legacy_experimental_theme_dependency_test/legacy_experimental_theme_dependency_test.info.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-name: 'Legacy experimental dependency test'
-type: theme
-description: 'Legacy experimental dependency test theme.'
-version: VERSION
-base theme: legacy_experimental_theme_test
diff --git a/core/modules/system/tests/themes/legacy_experimental_theme_test/legacy_experimental_theme_test.info.yml b/core/modules/system/tests/themes/legacy_experimental_theme_test/legacy_experimental_theme_test.info.yml
deleted file mode 100644
index 9921613f388f..000000000000
--- a/core/modules/system/tests/themes/legacy_experimental_theme_test/legacy_experimental_theme_test.info.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-name: 'Legacy experimental test'
-type: theme
-description: 'Legacy experimental test theme.'
-version: VERSION
-base theme: false
-experimental: true
-hidden: true
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ExperimentalDeprecationTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ExperimentalDeprecationTest.php
deleted file mode 100644
index 096e467d2bf4..000000000000
--- a/core/tests/Drupal/KernelTests/Core/Extension/ExperimentalDeprecationTest.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace Drupal\KernelTests\Core\Extension;
-
-use Drupal\KernelTests\KernelTestBase;
-
-/**
- * Tests deprecated update.inc functions.
- *
- * @group legacy
- * @group extension
- *
- * @todo Remove this and all its test themes in
- *   https://www.drupal.org/node/3321634
- */
-class ExperimentalDeprecationTest extends KernelTestBase {
-
-  /**
-   * Tests \Drupal\Core\Extension\Extension::isExperimental deprecation.
-   */
-  public function testLegacyIsExperimental(): void {
-    /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
-    $theme_installer = \Drupal::service('theme_installer');
-    $theme_installer->install(['legacy_experimental_theme_test']);
-
-    /** @var \Drupal\Core\Extension\ThemeHandler $theme_handler */
-    $theme_handler = $this->container->get('theme_handler');
-    $theme = $theme_handler->getTheme('legacy_experimental_theme_test');
-    $this->expectDeprecation('The key-value pair "experimental: true" is deprecated in drupal:10.1.0 and will be removed before drupal:11.0.0. Use the key-value pair "lifecycle: experimental" instead. See https://www.drupal.org/node/3263585');
-    $this->assertTrue($theme->isExperimental());
-  }
-
-}
-- 
GitLab