From a733e5eb1347088390ae688125649427ab08f9a0 Mon Sep 17 00:00:00 2001
From: James Shields <57457-lostcarpark@users.noreply.drupalcode.org>
Date: Thu, 6 Jun 2024 15:21:24 +0000
Subject: [PATCH] Issue #3423697 by sime, lostcarpark, phenaproxima,
 chrisfromredfin: GitLab CI - test for previous and next minor versions, and
 maximum PHP version

---
 .gitlab-ci.yml                                 |  5 +++++
 composer.json                                  |  2 +-
 src/Controller/InstallerController.php         | 16 +++++++++-------
 tests/src/Kernel/CoreExperimentalLabelTest.php |  9 +++------
 4 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9bfbf132a..38b4fe668 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -54,6 +54,11 @@ variables:
   _PHPUNIT_CONCURRENT: '1'
   _PHPUNIT_TESTGROUPS: ''
 
+  # Broaden test coverage.
+  OPT_IN_TEST_PREVIOUS_MINOR: 1
+  OPT_IN_TEST_NEXT_MINOR: 1
+  OPT_IN_TEST_MAX_PHP: 1
+
 ################
 # Require composer checks to pass.
 ################
diff --git a/composer.json b/composer.json
index 9036824e4..b66cdb388 100644
--- a/composer.json
+++ b/composer.json
@@ -10,7 +10,7 @@
         "ext-simplexml": "*"
     },
     "require-dev": {
-        "drupal/automatic_updates": "^3",
+        "drupal/automatic_updates": "^3.1.2",
         "colinodell/psr-testlogger": "^1.2"
     },
     "conflict": {
diff --git a/src/Controller/InstallerController.php b/src/Controller/InstallerController.php
index 87c973c0c..3b384a2d8 100644
--- a/src/Controller/InstallerController.php
+++ b/src/Controller/InstallerController.php
@@ -3,6 +3,7 @@
 namespace Drupal\project_browser\Controller;
 
 use Drupal\Component\Datetime\TimeInterface;
+use Drupal\Component\Utility\DeprecationHelper;
 use Drupal\Core\Access\AccessResult;
 use Drupal\Core\Controller\ControllerBase;
 use Drupal\Core\TempStore\SharedTempStore;
@@ -319,13 +320,14 @@ class InstallerController extends ControllerBase {
     $generated_url->applyTo($url_with_csrf_token_placeholder);
 
     $renderer = \Drupal::service('renderer');
-    // @todo Remove this if statement, and everything below it, when Drupal
-    //   <10.3 support is dropped.
-    if (method_exists($renderer, 'renderInIsolation')) {
-      return (string) $renderer->renderInIsolation($url_with_csrf_token_placeholder);
-    }
-    // @phpstan-ignore-next-line
-    return (string) $renderer->renderPlain($url_with_csrf_token_placeholder);
+    $output = DeprecationHelper::backwardsCompatibleCall(
+      currentVersion: \Drupal::VERSION,
+      deprecatedVersion: '10.3',
+      currentCallable: fn() => $renderer->renderInIsolation($url_with_csrf_token_placeholder),
+      deprecatedCallable: fn() => $renderer->renderPlain($url_with_csrf_token_placeholder),
+    );
+
+    return (string) $output;
   }
 
   /**
diff --git a/tests/src/Kernel/CoreExperimentalLabelTest.php b/tests/src/Kernel/CoreExperimentalLabelTest.php
index 25e20c2eb..a58b0a642 100644
--- a/tests/src/Kernel/CoreExperimentalLabelTest.php
+++ b/tests/src/Kernel/CoreExperimentalLabelTest.php
@@ -24,12 +24,9 @@ class CoreExperimentalLabelTest extends KernelTestBase {
   /**
    * Tests 'Core (Experimental)' label.
    *
-   * This test will fail if 'Workspaces' is removed, made non-experimental,
-   * or if the language for experimental modules has changed.
-   * If it is reason 1 or 2, the test may be fixed by changing 'Workspaces'
-   * to another module that is currently experimental. If it's reason 3,
-   * we need to update `DrupalCore::projectIsCovered` to look for the new
-   * language that indicates a module is experimental.
+   * This test will fail if the language for experimental modules has changed.
+   * If it fails, we need to update `DrupalCore::projectIsCovered` to look for
+   * the new language that indicates a module is experimental.
    *
    * @covers ::getProjectData
    */
-- 
GitLab