From fc4566b99fb46082fd97d0dbee1cb5de09d5aa5c Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 11:17:28 +0100
Subject: [PATCH 01/24] Issue #3501727: Try to simplify  checks in
 AdminNegotiator

---
 core/modules/user/src/Theme/AdminNegotiator.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index 398acbd20138..dc91ec2773a4 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -32,6 +32,9 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    * The entity type manager.
    *
    * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+   *
+   * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. The entity type manager is unused in the scope
+   * of the AdminNegotiator class thus it has to be removed.
    */
   protected $entityTypeManager;
 
@@ -64,8 +67,9 @@ public function __construct(AccountInterface $user, ConfigFactoryInterface $conf
   /**
    * {@inheritdoc}
    */
-  public function applies(RouteMatchInterface $route_match) {
-    return ($this->entityTypeManager->hasHandler('user_role', 'storage') && $this->user->hasPermission('view the administration theme') && $this->adminContext->isAdminRoute($route_match->getRouteObject()));
+  public function applies(RouteMatchInterface $route_match): bool {
+    $is_admin_route = $this->adminContext->isAdminRoute($route_match->getRouteObject());
+    return $is_admin_route && $this->user->hasPermission('view the administration theme');
   }
 
   /**
-- 
GitLab


From 6721339510129c0cf11bba5c05807886a9d84e4a Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 11:36:02 +0100
Subject: [PATCH 02/24] Issue #3501727: Remove the deprication notice, remove
 the entity type manager from AdminNegotiator and service definition, use the
 DeprecatedServicePropertyTrait to handle deprecation

---
 .../modules/user/src/Theme/AdminNegotiator.php | 18 +++---------------
 core/modules/user/user.services.yml            |  2 +-
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index dc91ec2773a4..80c058608e44 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -3,7 +3,7 @@
 namespace Drupal\user\Theme;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
 use Drupal\Core\Routing\AdminContext;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -13,6 +13,7 @@
  * Sets the active theme on admin pages.
  */
 class AdminNegotiator implements ThemeNegotiatorInterface {
+  use DeprecatedServicePropertyTrait;
 
   /**
    * The current user.
@@ -28,16 +29,6 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    */
   protected $configFactory;
 
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   *
-   * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. The entity type manager is unused in the scope
-   * of the AdminNegotiator class thus it has to be removed.
-   */
-  protected $entityTypeManager;
-
   /**
    * The route admin context to determine whether a route is an admin one.
    *
@@ -52,15 +43,12 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    *   The current user.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
    * @param \Drupal\Core\Routing\AdminContext $admin_context
    *   The route admin context to determine whether the route is an admin one.
    */
-  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, AdminContext $admin_context) {
+  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, AdminContext $admin_context) {
     $this->user = $user;
     $this->configFactory = $config_factory;
-    $this->entityTypeManager = $entity_type_manager;
     $this->adminContext = $admin_context;
   }
 
diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml
index ec34738d992e..d7ad70852f6e 100644
--- a/core/modules/user/user.services.yml
+++ b/core/modules/user/user.services.yml
@@ -39,7 +39,7 @@ services:
     arguments: ['@current_user', '@entity_type.manager', '@datetime.time']
   theme.negotiator.admin_theme:
     class: Drupal\user\Theme\AdminNegotiator
-    arguments: ['@current_user', '@config.factory', '@entity_type.manager', '@router.admin_context']
+    arguments: ['@current_user', '@config.factory', '@router.admin_context']
     tags:
       - { name: theme_negotiator, priority: -40 }
   user.auth:
-- 
GitLab


From 8247260db2885f455300754bcae53642f7715f1b Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 12:23:38 +0100
Subject: [PATCH 03/24] Issue #3501727: Fix the tests for AdminNegotiator

---
 .../src/Unit/Theme/AdminNegotiatorTest.php    |   6 +-
 phpunit.xml                                   | 151 ++++++++++++++++++
 2 files changed, 153 insertions(+), 4 deletions(-)
 create mode 100644 phpunit.xml

diff --git a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
index cb95afcd05c7..0aeaa1329bf0 100644
--- a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
+++ b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
@@ -4,7 +4,6 @@
 
 namespace Drupal\Tests\user\Unit\Theme;
 
-use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Routing\AdminContext;
 use Drupal\Core\Routing\RouteMatch;
 use Drupal\Core\Session\AccountInterface;
@@ -14,7 +13,7 @@
 /**
  * Tests AdminNegotiator class.
  *
- * @group user
+ * @group user_x
  * @coversDefaultClass \Drupal\user\Theme\AdminNegotiator
  */
 class AdminNegotiatorTest extends UnitTestCase {
@@ -25,9 +24,8 @@ class AdminNegotiatorTest extends UnitTestCase {
   public function testDetermineActiveTheme($admin_theme, $expected): void {
     $user = $this->prophesize(AccountInterface::class);
     $config_factory = $this->getConfigFactoryStub(['system.theme' => ['admin' => $admin_theme]]);
-    $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
     $admin_context = $this->prophesize(AdminContext::class);
-    $negotiator = new AdminNegotiator($user->reveal(), $config_factory, $entity_type_manager->reveal(), $admin_context->reveal());
+    $negotiator = new AdminNegotiator($user->reveal(), $config_factory, $admin_context->reveal());
     $route_match = $this->prophesize(RouteMatch::class);
     $this->assertSame($expected, $negotiator->determineActiveTheme($route_match->reveal()));
   }
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 000000000000..d50a7a91fffa
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- For how to customize PHPUnit configuration, see core/tests/README.md. -->
+<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
+<!-- PHPUnit expects functional tests to be run with either a privileged user
+ or your current system user. See core/tests/README.md and
+ https://www.drupal.org/node/2116263 for details.
+-->
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         bootstrap="tests/bootstrap.php"
+         colors="true"
+         beStrictAboutTestsThatDoNotTestAnything="true"
+         beStrictAboutOutputDuringTests="true"
+         beStrictAboutChangesToGlobalState="true"
+         failOnRisky="true"
+         failOnWarning="true"
+         displayDetailsOnTestsThatTriggerErrors="true"
+         displayDetailsOnTestsThatTriggerWarnings="true"
+         displayDetailsOnTestsThatTriggerDeprecations="true"
+         cacheResult="false"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         cacheDirectory=".phpunit.cache">
+  <php>
+    <!-- Set error reporting to E_ALL. -->
+    <ini name="error_reporting" value="32767"/>
+    <!-- Do not limit the amount of memory tests take to run. -->
+    <ini name="memory_limit" value="-1"/>
+    <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
+    <env name="SIMPLETEST_BASE_URL" value=""/>
+    <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/database_name#table_prefix -->
+    <env name="SIMPLETEST_DB" value=""/>
+    <!-- By default, browser tests will output links that use the base URL set
+     in SIMPLETEST_BASE_URL. However, if your SIMPLETEST_BASE_URL is an internal
+     path (such as may be the case in a virtual or Docker-based environment),
+     you can set the base URL used in the browser test output links to something
+     reachable from your host machine here. This will allow you to follow them
+     directly and view the output. -->
+    <env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
+    <!-- The environment variable SYMFONY_DEPRECATIONS_HELPER is used to configure
+      the behavior of the deprecation tests.
+      Drupal core's testing framework is setting this variable to its defaults.
+      Projects with their own requirements need to manage this variable
+      explicitly.
+    -->
+    <!-- To disable deprecation testing completely uncomment the next line. -->
+    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
+    <!-- Deprecation errors can be selectively ignored by specifying a file of
+      regular expression patterns for exclusion.
+      Uncomment the line below to specify a custom deprecations ignore file.
+      NOTE: it may be required to specify the full path to the file to run tests
+      correctly.
+    -->
+    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=.deprecation-ignore.txt"/> -->
+    <!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
+    <env name="MINK_DRIVER_CLASS" value=""/>
+    <!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' -->
+    <env name="MINK_DRIVER_ARGS" value=""/>
+    <!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "goog:chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
+    <env name="MINK_DRIVER_ARGS_WEBDRIVER" value=""/>
+  </php>
+  <extensions>
+    <!-- Functional tests HTML output logging. -->
+    <bootstrap class="Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger">
+      <!-- The directory where the browser output will be stored. If a relative
+        path is specified, it will be relative to the current working directory
+        of the process running the PHPUnit CLI. In CI environments, this can be
+        overridden by the value set for the "BROWSERTEST_OUTPUT_DIRECTORY"
+        environment variable.
+      -->
+      <parameter name="outputDirectory" value="sites/simpletest/browser_output"/>
+      <!-- By default browser tests print the individual links in the test run
+        report. To avoid overcrowding the output in CI environments, you can
+        set the "verbose" parameter or the "BROWSERTEST_OUTPUT_VERBOSE"
+        environment variable to "false". In GitLabCI, the output is saved
+        anyway as an artifact that can be browsed or downloaded from Gitlab.
+      -->
+      <parameter name="verbose" value="true"/>
+    </bootstrap>
+  </extensions>
+  <testsuites>
+    <testsuite name="unit">
+      <directory>tests/Drupal/Tests</directory>
+      <directory>modules/**/tests/src/Unit</directory>
+      <directory>profiles/**/tests/src/Unit</directory>
+      <directory>themes/**/tests/src/Unit</directory>
+      <directory>../modules/**/tests/src/Unit</directory>
+      <directory>../profiles/**/tests/src/Unit</directory>
+      <directory>../themes/**/tests/src/Unit</directory>
+    </testsuite>
+    <testsuite name="kernel">
+      <directory>tests/Drupal/KernelTests</directory>
+      <directory>modules/**/tests/src/Kernel</directory>
+      <directory>recipes/*/tests/src/Kernel</directory>
+      <directory>profiles/**/tests/src/Kernel</directory>
+      <directory>profiles/tests/testing/modules/*/tests/src/Kernel</directory>
+      <directory>themes/**/tests/src/Kernel</directory>
+      <directory>../modules/**/tests/src/Kernel</directory>
+      <directory>../profiles/**/tests/src/Kernel</directory>
+      <directory>../themes/**/tests/src/Kernel</directory>
+    </testsuite>
+    <testsuite name="functional">
+      <directory>tests/Drupal/FunctionalTests</directory>
+      <directory>modules/**/tests/src/Functional</directory>
+      <directory>modules/config/tests/config_test/tests/src/Functional</directory>
+      <directory>modules/system/tests/modules/entity_test/tests/src/Functional</directory>
+      <directory>modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional</directory>
+      <directory>modules/navigation/modules/navigation_top_bar/tests/src/Functional</directory>
+      <directory>profiles/**/tests/src/Functional</directory>
+      <directory>profiles/demo_umami/modules/demo_umami_content/tests/src/Functional</directory>
+      <directory>recipes/*/tests/src/Functional</directory>
+      <directory>themes/**/tests/src/Functional</directory>
+      <directory>../modules/**/tests/src/Functional</directory>
+      <directory>../profiles/**/tests/src/Functional</directory>
+      <directory>../themes/**/tests/src/Functional</directory>
+    </testsuite>
+    <testsuite name="functional-javascript">
+      <directory>tests/Drupal/FunctionalJavascriptTests</directory>
+      <directory>modules/**/tests/src/FunctionalJavascript</directory>
+      <directory>recipes/*/tests/src/FunctionalJavascript</directory>
+      <directory>profiles/**/tests/src/FunctionalJavascript</directory>
+      <directory>themes/**/tests/src/FunctionalJavascript</directory>
+      <directory>../modules/**/tests/src/FunctionalJavascript</directory>
+      <directory>../profiles/**/tests/src/FunctionalJavascript</directory>
+      <directory>../themes/**/tests/src/FunctionalJavascript</directory>
+    </testsuite>
+    <testsuite name="build">
+      <directory>tests/Drupal/BuildTests</directory>
+      <directory>modules/**/tests/src/Build</directory>
+    </testsuite>
+  </testsuites>
+  <!-- Settings for coverage reports. -->
+  <source ignoreSuppressionOfDeprecations="true">
+    <include>
+      <directory>./includes</directory>
+      <directory>./lib</directory>
+      <directory>./modules</directory>
+      <directory>../modules</directory>
+      <directory>../sites</directory>
+    </include>
+    <exclude>
+      <directory>./modules/*/src/Tests</directory>
+      <directory>./modules/*/tests</directory>
+      <directory>../modules/*/src/Tests</directory>
+      <directory>../modules/*/tests</directory>
+      <directory>../modules/*/*/src/Tests</directory>
+      <directory>../modules/*/*/tests</directory>
+      <directory suffix=".api.php">./lib/**</directory>
+      <directory suffix=".api.php">./modules/**</directory>
+      <directory suffix=".api.php">../modules/**</directory>
+    </exclude>
+  </source>
+</phpunit>
-- 
GitLab


From 2e0dd1e304c4a39490eb5663802bce337e712c08 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 12:32:59 +0100
Subject: [PATCH 04/24] Issue #3501727: Fix typo in group name

---
 core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
index 0aeaa1329bf0..7a34a967e478 100644
--- a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
+++ b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
@@ -13,7 +13,7 @@
 /**
  * Tests AdminNegotiator class.
  *
- * @group user_x
+ * @group user
  * @coversDefaultClass \Drupal\user\Theme\AdminNegotiator
  */
 class AdminNegotiatorTest extends UnitTestCase {
-- 
GitLab


From 468d5bc2b8cb3927eb6af53785e824d5d2fd3a7b Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 12:34:46 +0100
Subject: [PATCH 05/24] Issue #3501727: Rollback the phpunit.xml file.

---
 phpunit.xml | 151 ----------------------------------------------------
 1 file changed, 151 deletions(-)
 delete mode 100644 phpunit.xml

diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index d50a7a91fffa..000000000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- For how to customize PHPUnit configuration, see core/tests/README.md. -->
-<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
-<!-- PHPUnit expects functional tests to be run with either a privileged user
- or your current system user. See core/tests/README.md and
- https://www.drupal.org/node/2116263 for details.
--->
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         bootstrap="tests/bootstrap.php"
-         colors="true"
-         beStrictAboutTestsThatDoNotTestAnything="true"
-         beStrictAboutOutputDuringTests="true"
-         beStrictAboutChangesToGlobalState="true"
-         failOnRisky="true"
-         failOnWarning="true"
-         displayDetailsOnTestsThatTriggerErrors="true"
-         displayDetailsOnTestsThatTriggerWarnings="true"
-         displayDetailsOnTestsThatTriggerDeprecations="true"
-         cacheResult="false"
-         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
-         cacheDirectory=".phpunit.cache">
-  <php>
-    <!-- Set error reporting to E_ALL. -->
-    <ini name="error_reporting" value="32767"/>
-    <!-- Do not limit the amount of memory tests take to run. -->
-    <ini name="memory_limit" value="-1"/>
-    <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
-    <env name="SIMPLETEST_BASE_URL" value=""/>
-    <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/database_name#table_prefix -->
-    <env name="SIMPLETEST_DB" value=""/>
-    <!-- By default, browser tests will output links that use the base URL set
-     in SIMPLETEST_BASE_URL. However, if your SIMPLETEST_BASE_URL is an internal
-     path (such as may be the case in a virtual or Docker-based environment),
-     you can set the base URL used in the browser test output links to something
-     reachable from your host machine here. This will allow you to follow them
-     directly and view the output. -->
-    <env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
-    <!-- The environment variable SYMFONY_DEPRECATIONS_HELPER is used to configure
-      the behavior of the deprecation tests.
-      Drupal core's testing framework is setting this variable to its defaults.
-      Projects with their own requirements need to manage this variable
-      explicitly.
-    -->
-    <!-- To disable deprecation testing completely uncomment the next line. -->
-    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
-    <!-- Deprecation errors can be selectively ignored by specifying a file of
-      regular expression patterns for exclusion.
-      Uncomment the line below to specify a custom deprecations ignore file.
-      NOTE: it may be required to specify the full path to the file to run tests
-      correctly.
-    -->
-    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=.deprecation-ignore.txt"/> -->
-    <!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
-    <env name="MINK_DRIVER_CLASS" value=""/>
-    <!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' -->
-    <env name="MINK_DRIVER_ARGS" value=""/>
-    <!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "goog:chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
-    <env name="MINK_DRIVER_ARGS_WEBDRIVER" value=""/>
-  </php>
-  <extensions>
-    <!-- Functional tests HTML output logging. -->
-    <bootstrap class="Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger">
-      <!-- The directory where the browser output will be stored. If a relative
-        path is specified, it will be relative to the current working directory
-        of the process running the PHPUnit CLI. In CI environments, this can be
-        overridden by the value set for the "BROWSERTEST_OUTPUT_DIRECTORY"
-        environment variable.
-      -->
-      <parameter name="outputDirectory" value="sites/simpletest/browser_output"/>
-      <!-- By default browser tests print the individual links in the test run
-        report. To avoid overcrowding the output in CI environments, you can
-        set the "verbose" parameter or the "BROWSERTEST_OUTPUT_VERBOSE"
-        environment variable to "false". In GitLabCI, the output is saved
-        anyway as an artifact that can be browsed or downloaded from Gitlab.
-      -->
-      <parameter name="verbose" value="true"/>
-    </bootstrap>
-  </extensions>
-  <testsuites>
-    <testsuite name="unit">
-      <directory>tests/Drupal/Tests</directory>
-      <directory>modules/**/tests/src/Unit</directory>
-      <directory>profiles/**/tests/src/Unit</directory>
-      <directory>themes/**/tests/src/Unit</directory>
-      <directory>../modules/**/tests/src/Unit</directory>
-      <directory>../profiles/**/tests/src/Unit</directory>
-      <directory>../themes/**/tests/src/Unit</directory>
-    </testsuite>
-    <testsuite name="kernel">
-      <directory>tests/Drupal/KernelTests</directory>
-      <directory>modules/**/tests/src/Kernel</directory>
-      <directory>recipes/*/tests/src/Kernel</directory>
-      <directory>profiles/**/tests/src/Kernel</directory>
-      <directory>profiles/tests/testing/modules/*/tests/src/Kernel</directory>
-      <directory>themes/**/tests/src/Kernel</directory>
-      <directory>../modules/**/tests/src/Kernel</directory>
-      <directory>../profiles/**/tests/src/Kernel</directory>
-      <directory>../themes/**/tests/src/Kernel</directory>
-    </testsuite>
-    <testsuite name="functional">
-      <directory>tests/Drupal/FunctionalTests</directory>
-      <directory>modules/**/tests/src/Functional</directory>
-      <directory>modules/config/tests/config_test/tests/src/Functional</directory>
-      <directory>modules/system/tests/modules/entity_test/tests/src/Functional</directory>
-      <directory>modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional</directory>
-      <directory>modules/navigation/modules/navigation_top_bar/tests/src/Functional</directory>
-      <directory>profiles/**/tests/src/Functional</directory>
-      <directory>profiles/demo_umami/modules/demo_umami_content/tests/src/Functional</directory>
-      <directory>recipes/*/tests/src/Functional</directory>
-      <directory>themes/**/tests/src/Functional</directory>
-      <directory>../modules/**/tests/src/Functional</directory>
-      <directory>../profiles/**/tests/src/Functional</directory>
-      <directory>../themes/**/tests/src/Functional</directory>
-    </testsuite>
-    <testsuite name="functional-javascript">
-      <directory>tests/Drupal/FunctionalJavascriptTests</directory>
-      <directory>modules/**/tests/src/FunctionalJavascript</directory>
-      <directory>recipes/*/tests/src/FunctionalJavascript</directory>
-      <directory>profiles/**/tests/src/FunctionalJavascript</directory>
-      <directory>themes/**/tests/src/FunctionalJavascript</directory>
-      <directory>../modules/**/tests/src/FunctionalJavascript</directory>
-      <directory>../profiles/**/tests/src/FunctionalJavascript</directory>
-      <directory>../themes/**/tests/src/FunctionalJavascript</directory>
-    </testsuite>
-    <testsuite name="build">
-      <directory>tests/Drupal/BuildTests</directory>
-      <directory>modules/**/tests/src/Build</directory>
-    </testsuite>
-  </testsuites>
-  <!-- Settings for coverage reports. -->
-  <source ignoreSuppressionOfDeprecations="true">
-    <include>
-      <directory>./includes</directory>
-      <directory>./lib</directory>
-      <directory>./modules</directory>
-      <directory>../modules</directory>
-      <directory>../sites</directory>
-    </include>
-    <exclude>
-      <directory>./modules/*/src/Tests</directory>
-      <directory>./modules/*/tests</directory>
-      <directory>../modules/*/src/Tests</directory>
-      <directory>../modules/*/tests</directory>
-      <directory>../modules/*/*/src/Tests</directory>
-      <directory>../modules/*/*/tests</directory>
-      <directory suffix=".api.php">./lib/**</directory>
-      <directory suffix=".api.php">./modules/**</directory>
-      <directory suffix=".api.php">../modules/**</directory>
-    </exclude>
-  </source>
-</phpunit>
-- 
GitLab


From babf8a57e4c6f6e976946c78bb5d1f454222187a Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 13:17:42 +0100
Subject: [PATCH 06/24] Issue #3501727: Fix the performance tests cache
 counting.

---
 .../tests/src/FunctionalJavascript/StandardPerformanceTest.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
index c425f516695e..8a0838976163 100644
--- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
@@ -254,7 +254,7 @@ protected function testLogin(): void {
     $this->assertSame($expected_queries, $recorded_queries);
     $expected = [
       'QueryCount' => 17,
-      'CacheGetCount' => 82,
+      'CacheGetCount' => 81,
       'CacheSetCount' => 1,
       'CacheDeleteCount' => 1,
       'CacheTagChecksumCount' => 1,
-- 
GitLab


From 34dfef33f434ccd53f3429123a0c1f176228b430 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 13:38:19 +0100
Subject: [PATCH 07/24] Issue #3501727: Fix the performance tests cache
 counting.

---
 .../tests/src/FunctionalJavascript/StandardPerformanceTest.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
index 8a0838976163..ac19c2ad7634 100644
--- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
@@ -258,7 +258,7 @@ protected function testLogin(): void {
       'CacheSetCount' => 1,
       'CacheDeleteCount' => 1,
       'CacheTagChecksumCount' => 1,
-      'CacheTagIsValidCount' => 37,
+      'CacheTagIsValidCount' => 36,
       'CacheTagInvalidationCount' => 0,
     ];
     $this->assertMetrics($expected, $performance_data);
-- 
GitLab


From 17b3452ad1a9f438d265bb35d97bf53d7bf88454 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 14:15:19 +0100
Subject: [PATCH 08/24] Issue #3501727: Create admin user to test cron UI
 instead of relying on permissions

---
 core/modules/system/tests/src/Functional/System/CronRunTest.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/system/tests/src/Functional/System/CronRunTest.php b/core/modules/system/tests/src/Functional/System/CronRunTest.php
index a5885a660dfe..390ef565543a 100644
--- a/core/modules/system/tests/src/Functional/System/CronRunTest.php
+++ b/core/modules/system/tests/src/Functional/System/CronRunTest.php
@@ -118,7 +118,7 @@ public function testCronExceptions(): void {
    * Make sure the cron UI reads from the state storage.
    */
   public function testCronUI(): void {
-    $admin_user = $this->drupalCreateUser(['administer site configuration']);
+    $admin_user = $this->drupalCreateUser(admin: TRUE);
     $this->drupalLogin($admin_user);
     \Drupal::state()->delete('system.cron_last');
     $this->drupalGet('admin/config/system/cron');
-- 
GitLab


From 32deaff2687dea9e56c679a6e2dd02c74a2d6e0f Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sun, 26 Jan 2025 14:41:38 +0100
Subject: [PATCH 09/24] Issue #3501727: Revert cron UI test changes. Revert
 return type for applies method in AdminNegotiator. Fix handling the
 deprecated EntityTypeManager argument and property.

---
 .../src/Functional/System/CronRunTest.php     |  2 +-
 .../user/src/Theme/AdminNegotiator.php        | 22 +++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/core/modules/system/tests/src/Functional/System/CronRunTest.php b/core/modules/system/tests/src/Functional/System/CronRunTest.php
index 390ef565543a..a5885a660dfe 100644
--- a/core/modules/system/tests/src/Functional/System/CronRunTest.php
+++ b/core/modules/system/tests/src/Functional/System/CronRunTest.php
@@ -118,7 +118,7 @@ public function testCronExceptions(): void {
    * Make sure the cron UI reads from the state storage.
    */
   public function testCronUI(): void {
-    $admin_user = $this->drupalCreateUser(admin: TRUE);
+    $admin_user = $this->drupalCreateUser(['administer site configuration']);
     $this->drupalLogin($admin_user);
     \Drupal::state()->delete('system.cron_last');
     $this->drupalGet('admin/config/system/cron');
diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index 80c058608e44..06d577d7fa5a 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Routing\AdminContext;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -15,6 +16,11 @@
 class AdminNegotiator implements ThemeNegotiatorInterface {
   use DeprecatedServicePropertyTrait;
 
+  /**
+   * The service properties that should raise a deprecation error.
+   */
+  private array $deprecatedProperties = ['entityTypeManager' => 'entity_type.manager'];
+
   /**
    * The current user.
    *
@@ -43,19 +49,27 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    *   The current user.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory.
-   * @param \Drupal\Core\Routing\AdminContext $admin_context
+   * @param \Drupal\Core\Routing\AdminContext|EntityTypeManagerInterface $admin_context
    *   The route admin context to determine whether the route is an admin one.
    */
-  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, AdminContext $admin_context) {
+  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, AdminContext|EntityTypeManagerInterface $admin_context) {
     $this->user = $user;
     $this->configFactory = $config_factory;
-    $this->adminContext = $admin_context;
+
+    if ($admin_context instanceof EntityTypeManagerInterface) {
+      $deprecated_service_name = EntityTypeManagerInterface::class;
+      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated and will be removed in drupal:12.0.0.", E_USER_DEPRECATED);
+      $this->adminContext = func_get_arg(3);
+    }
+    else {
+      $this->adminContext = $admin_context;
+    }
   }
 
   /**
    * {@inheritdoc}
    */
-  public function applies(RouteMatchInterface $route_match): bool {
+  public function applies(RouteMatchInterface $route_match) {
     $is_admin_route = $this->adminContext->isAdminRoute($route_match->getRouteObject());
     return $is_admin_route && $this->user->hasPermission('view the administration theme');
   }
-- 
GitLab


From 39993e89ce3373eed0d5056bd0eaae07303a8433 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sun, 26 Jan 2025 14:49:54 +0100
Subject: [PATCH 10/24] Issue #3501727: Improve the deprecation message

---
 core/modules/user/src/Theme/AdminNegotiator.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index 06d577d7fa5a..fd79e287e11f 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -58,7 +58,7 @@ public function __construct(AccountInterface $user, ConfigFactoryInterface $conf
 
     if ($admin_context instanceof EntityTypeManagerInterface) {
       $deprecated_service_name = EntityTypeManagerInterface::class;
-      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated and will be removed in drupal:12.0.0.", E_USER_DEPRECATED);
+      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used.", E_USER_DEPRECATED);
       $this->adminContext = func_get_arg(3);
     }
     else {
-- 
GitLab


From 3b861479213aec4734a2af3a1451281c1f8e02f1 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sun, 26 Jan 2025 14:56:29 +0100
Subject: [PATCH 11/24] Issue #3501727: Add link to issue in deprecation
 message.

---
 core/modules/user/src/Theme/AdminNegotiator.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index fd79e287e11f..6c35720b8b02 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -58,7 +58,7 @@ public function __construct(AccountInterface $user, ConfigFactoryInterface $conf
 
     if ($admin_context instanceof EntityTypeManagerInterface) {
       $deprecated_service_name = EntityTypeManagerInterface::class;
-      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used.", E_USER_DEPRECATED);
+      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used. See https://www.drupal.org/project/drupal/issues/3501727", E_USER_DEPRECATED);
       $this->adminContext = func_get_arg(3);
     }
     else {
-- 
GitLab


From cfa47da635d82f8dcb16e7c5fcad9059d0cf73f0 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 11:17:28 +0100
Subject: [PATCH 12/24] Issue #3501727: Try to simplify  checks in
 AdminNegotiator

---
 core/modules/user/src/Theme/AdminNegotiator.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index 398acbd20138..dc91ec2773a4 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -32,6 +32,9 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    * The entity type manager.
    *
    * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+   *
+   * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. The entity type manager is unused in the scope
+   * of the AdminNegotiator class thus it has to be removed.
    */
   protected $entityTypeManager;
 
@@ -64,8 +67,9 @@ public function __construct(AccountInterface $user, ConfigFactoryInterface $conf
   /**
    * {@inheritdoc}
    */
-  public function applies(RouteMatchInterface $route_match) {
-    return ($this->entityTypeManager->hasHandler('user_role', 'storage') && $this->user->hasPermission('view the administration theme') && $this->adminContext->isAdminRoute($route_match->getRouteObject()));
+  public function applies(RouteMatchInterface $route_match): bool {
+    $is_admin_route = $this->adminContext->isAdminRoute($route_match->getRouteObject());
+    return $is_admin_route && $this->user->hasPermission('view the administration theme');
   }
 
   /**
-- 
GitLab


From 0c62c5de7a4ad530d3d2866b1aa55f5afa350da9 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 11:36:02 +0100
Subject: [PATCH 13/24] Issue #3501727: Remove the deprication notice, remove
 the entity type manager from AdminNegotiator and service definition, use the
 DeprecatedServicePropertyTrait to handle deprecation

---
 .../modules/user/src/Theme/AdminNegotiator.php | 18 +++---------------
 core/modules/user/user.services.yml            |  2 +-
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index dc91ec2773a4..80c058608e44 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -3,7 +3,7 @@
 namespace Drupal\user\Theme;
 
 use Drupal\Core\Config\ConfigFactoryInterface;
-use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
 use Drupal\Core\Routing\AdminContext;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -13,6 +13,7 @@
  * Sets the active theme on admin pages.
  */
 class AdminNegotiator implements ThemeNegotiatorInterface {
+  use DeprecatedServicePropertyTrait;
 
   /**
    * The current user.
@@ -28,16 +29,6 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    */
   protected $configFactory;
 
-  /**
-   * The entity type manager.
-   *
-   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
-   *
-   * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. The entity type manager is unused in the scope
-   * of the AdminNegotiator class thus it has to be removed.
-   */
-  protected $entityTypeManager;
-
   /**
    * The route admin context to determine whether a route is an admin one.
    *
@@ -52,15 +43,12 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    *   The current user.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory.
-   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
-   *   The entity type manager.
    * @param \Drupal\Core\Routing\AdminContext $admin_context
    *   The route admin context to determine whether the route is an admin one.
    */
-  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, AdminContext $admin_context) {
+  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, AdminContext $admin_context) {
     $this->user = $user;
     $this->configFactory = $config_factory;
-    $this->entityTypeManager = $entity_type_manager;
     $this->adminContext = $admin_context;
   }
 
diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml
index ec34738d992e..d7ad70852f6e 100644
--- a/core/modules/user/user.services.yml
+++ b/core/modules/user/user.services.yml
@@ -39,7 +39,7 @@ services:
     arguments: ['@current_user', '@entity_type.manager', '@datetime.time']
   theme.negotiator.admin_theme:
     class: Drupal\user\Theme\AdminNegotiator
-    arguments: ['@current_user', '@config.factory', '@entity_type.manager', '@router.admin_context']
+    arguments: ['@current_user', '@config.factory', '@router.admin_context']
     tags:
       - { name: theme_negotiator, priority: -40 }
   user.auth:
-- 
GitLab


From 9d4ae86d596c44d5ab478fb633897071246dd2ad Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 12:23:38 +0100
Subject: [PATCH 14/24] Issue #3501727: Fix the tests for AdminNegotiator

---
 .../src/Unit/Theme/AdminNegotiatorTest.php    |   6 +-
 phpunit.xml                                   | 151 ++++++++++++++++++
 2 files changed, 153 insertions(+), 4 deletions(-)
 create mode 100644 phpunit.xml

diff --git a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
index cb95afcd05c7..0aeaa1329bf0 100644
--- a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
+++ b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
@@ -4,7 +4,6 @@
 
 namespace Drupal\Tests\user\Unit\Theme;
 
-use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Routing\AdminContext;
 use Drupal\Core\Routing\RouteMatch;
 use Drupal\Core\Session\AccountInterface;
@@ -14,7 +13,7 @@
 /**
  * Tests AdminNegotiator class.
  *
- * @group user
+ * @group user_x
  * @coversDefaultClass \Drupal\user\Theme\AdminNegotiator
  */
 class AdminNegotiatorTest extends UnitTestCase {
@@ -25,9 +24,8 @@ class AdminNegotiatorTest extends UnitTestCase {
   public function testDetermineActiveTheme($admin_theme, $expected): void {
     $user = $this->prophesize(AccountInterface::class);
     $config_factory = $this->getConfigFactoryStub(['system.theme' => ['admin' => $admin_theme]]);
-    $entity_type_manager = $this->prophesize(EntityTypeManagerInterface::class);
     $admin_context = $this->prophesize(AdminContext::class);
-    $negotiator = new AdminNegotiator($user->reveal(), $config_factory, $entity_type_manager->reveal(), $admin_context->reveal());
+    $negotiator = new AdminNegotiator($user->reveal(), $config_factory, $admin_context->reveal());
     $route_match = $this->prophesize(RouteMatch::class);
     $this->assertSame($expected, $negotiator->determineActiveTheme($route_match->reveal()));
   }
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 000000000000..d50a7a91fffa
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- For how to customize PHPUnit configuration, see core/tests/README.md. -->
+<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
+<!-- PHPUnit expects functional tests to be run with either a privileged user
+ or your current system user. See core/tests/README.md and
+ https://www.drupal.org/node/2116263 for details.
+-->
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         bootstrap="tests/bootstrap.php"
+         colors="true"
+         beStrictAboutTestsThatDoNotTestAnything="true"
+         beStrictAboutOutputDuringTests="true"
+         beStrictAboutChangesToGlobalState="true"
+         failOnRisky="true"
+         failOnWarning="true"
+         displayDetailsOnTestsThatTriggerErrors="true"
+         displayDetailsOnTestsThatTriggerWarnings="true"
+         displayDetailsOnTestsThatTriggerDeprecations="true"
+         cacheResult="false"
+         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
+         cacheDirectory=".phpunit.cache">
+  <php>
+    <!-- Set error reporting to E_ALL. -->
+    <ini name="error_reporting" value="32767"/>
+    <!-- Do not limit the amount of memory tests take to run. -->
+    <ini name="memory_limit" value="-1"/>
+    <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
+    <env name="SIMPLETEST_BASE_URL" value=""/>
+    <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/database_name#table_prefix -->
+    <env name="SIMPLETEST_DB" value=""/>
+    <!-- By default, browser tests will output links that use the base URL set
+     in SIMPLETEST_BASE_URL. However, if your SIMPLETEST_BASE_URL is an internal
+     path (such as may be the case in a virtual or Docker-based environment),
+     you can set the base URL used in the browser test output links to something
+     reachable from your host machine here. This will allow you to follow them
+     directly and view the output. -->
+    <env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
+    <!-- The environment variable SYMFONY_DEPRECATIONS_HELPER is used to configure
+      the behavior of the deprecation tests.
+      Drupal core's testing framework is setting this variable to its defaults.
+      Projects with their own requirements need to manage this variable
+      explicitly.
+    -->
+    <!-- To disable deprecation testing completely uncomment the next line. -->
+    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
+    <!-- Deprecation errors can be selectively ignored by specifying a file of
+      regular expression patterns for exclusion.
+      Uncomment the line below to specify a custom deprecations ignore file.
+      NOTE: it may be required to specify the full path to the file to run tests
+      correctly.
+    -->
+    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=.deprecation-ignore.txt"/> -->
+    <!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
+    <env name="MINK_DRIVER_CLASS" value=""/>
+    <!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' -->
+    <env name="MINK_DRIVER_ARGS" value=""/>
+    <!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "goog:chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
+    <env name="MINK_DRIVER_ARGS_WEBDRIVER" value=""/>
+  </php>
+  <extensions>
+    <!-- Functional tests HTML output logging. -->
+    <bootstrap class="Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger">
+      <!-- The directory where the browser output will be stored. If a relative
+        path is specified, it will be relative to the current working directory
+        of the process running the PHPUnit CLI. In CI environments, this can be
+        overridden by the value set for the "BROWSERTEST_OUTPUT_DIRECTORY"
+        environment variable.
+      -->
+      <parameter name="outputDirectory" value="sites/simpletest/browser_output"/>
+      <!-- By default browser tests print the individual links in the test run
+        report. To avoid overcrowding the output in CI environments, you can
+        set the "verbose" parameter or the "BROWSERTEST_OUTPUT_VERBOSE"
+        environment variable to "false". In GitLabCI, the output is saved
+        anyway as an artifact that can be browsed or downloaded from Gitlab.
+      -->
+      <parameter name="verbose" value="true"/>
+    </bootstrap>
+  </extensions>
+  <testsuites>
+    <testsuite name="unit">
+      <directory>tests/Drupal/Tests</directory>
+      <directory>modules/**/tests/src/Unit</directory>
+      <directory>profiles/**/tests/src/Unit</directory>
+      <directory>themes/**/tests/src/Unit</directory>
+      <directory>../modules/**/tests/src/Unit</directory>
+      <directory>../profiles/**/tests/src/Unit</directory>
+      <directory>../themes/**/tests/src/Unit</directory>
+    </testsuite>
+    <testsuite name="kernel">
+      <directory>tests/Drupal/KernelTests</directory>
+      <directory>modules/**/tests/src/Kernel</directory>
+      <directory>recipes/*/tests/src/Kernel</directory>
+      <directory>profiles/**/tests/src/Kernel</directory>
+      <directory>profiles/tests/testing/modules/*/tests/src/Kernel</directory>
+      <directory>themes/**/tests/src/Kernel</directory>
+      <directory>../modules/**/tests/src/Kernel</directory>
+      <directory>../profiles/**/tests/src/Kernel</directory>
+      <directory>../themes/**/tests/src/Kernel</directory>
+    </testsuite>
+    <testsuite name="functional">
+      <directory>tests/Drupal/FunctionalTests</directory>
+      <directory>modules/**/tests/src/Functional</directory>
+      <directory>modules/config/tests/config_test/tests/src/Functional</directory>
+      <directory>modules/system/tests/modules/entity_test/tests/src/Functional</directory>
+      <directory>modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional</directory>
+      <directory>modules/navigation/modules/navigation_top_bar/tests/src/Functional</directory>
+      <directory>profiles/**/tests/src/Functional</directory>
+      <directory>profiles/demo_umami/modules/demo_umami_content/tests/src/Functional</directory>
+      <directory>recipes/*/tests/src/Functional</directory>
+      <directory>themes/**/tests/src/Functional</directory>
+      <directory>../modules/**/tests/src/Functional</directory>
+      <directory>../profiles/**/tests/src/Functional</directory>
+      <directory>../themes/**/tests/src/Functional</directory>
+    </testsuite>
+    <testsuite name="functional-javascript">
+      <directory>tests/Drupal/FunctionalJavascriptTests</directory>
+      <directory>modules/**/tests/src/FunctionalJavascript</directory>
+      <directory>recipes/*/tests/src/FunctionalJavascript</directory>
+      <directory>profiles/**/tests/src/FunctionalJavascript</directory>
+      <directory>themes/**/tests/src/FunctionalJavascript</directory>
+      <directory>../modules/**/tests/src/FunctionalJavascript</directory>
+      <directory>../profiles/**/tests/src/FunctionalJavascript</directory>
+      <directory>../themes/**/tests/src/FunctionalJavascript</directory>
+    </testsuite>
+    <testsuite name="build">
+      <directory>tests/Drupal/BuildTests</directory>
+      <directory>modules/**/tests/src/Build</directory>
+    </testsuite>
+  </testsuites>
+  <!-- Settings for coverage reports. -->
+  <source ignoreSuppressionOfDeprecations="true">
+    <include>
+      <directory>./includes</directory>
+      <directory>./lib</directory>
+      <directory>./modules</directory>
+      <directory>../modules</directory>
+      <directory>../sites</directory>
+    </include>
+    <exclude>
+      <directory>./modules/*/src/Tests</directory>
+      <directory>./modules/*/tests</directory>
+      <directory>../modules/*/src/Tests</directory>
+      <directory>../modules/*/tests</directory>
+      <directory>../modules/*/*/src/Tests</directory>
+      <directory>../modules/*/*/tests</directory>
+      <directory suffix=".api.php">./lib/**</directory>
+      <directory suffix=".api.php">./modules/**</directory>
+      <directory suffix=".api.php">../modules/**</directory>
+    </exclude>
+  </source>
+</phpunit>
-- 
GitLab


From 238cb16f023b0683ef252078b27d4f827cfdaa54 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 12:32:59 +0100
Subject: [PATCH 15/24] Issue #3501727: Fix typo in group name

---
 core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
index 0aeaa1329bf0..7a34a967e478 100644
--- a/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
+++ b/core/modules/user/tests/src/Unit/Theme/AdminNegotiatorTest.php
@@ -13,7 +13,7 @@
 /**
  * Tests AdminNegotiator class.
  *
- * @group user_x
+ * @group user
  * @coversDefaultClass \Drupal\user\Theme\AdminNegotiator
  */
 class AdminNegotiatorTest extends UnitTestCase {
-- 
GitLab


From 2a0182c588bc3413bbe8f00cab44d99504f65d52 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 12:34:46 +0100
Subject: [PATCH 16/24] Issue #3501727: Rollback the phpunit.xml file.

---
 phpunit.xml | 151 ----------------------------------------------------
 1 file changed, 151 deletions(-)
 delete mode 100644 phpunit.xml

diff --git a/phpunit.xml b/phpunit.xml
deleted file mode 100644
index d50a7a91fffa..000000000000
--- a/phpunit.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- For how to customize PHPUnit configuration, see core/tests/README.md. -->
-<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
-<!-- PHPUnit expects functional tests to be run with either a privileged user
- or your current system user. See core/tests/README.md and
- https://www.drupal.org/node/2116263 for details.
--->
-<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         bootstrap="tests/bootstrap.php"
-         colors="true"
-         beStrictAboutTestsThatDoNotTestAnything="true"
-         beStrictAboutOutputDuringTests="true"
-         beStrictAboutChangesToGlobalState="true"
-         failOnRisky="true"
-         failOnWarning="true"
-         displayDetailsOnTestsThatTriggerErrors="true"
-         displayDetailsOnTestsThatTriggerWarnings="true"
-         displayDetailsOnTestsThatTriggerDeprecations="true"
-         cacheResult="false"
-         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
-         cacheDirectory=".phpunit.cache">
-  <php>
-    <!-- Set error reporting to E_ALL. -->
-    <ini name="error_reporting" value="32767"/>
-    <!-- Do not limit the amount of memory tests take to run. -->
-    <ini name="memory_limit" value="-1"/>
-    <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
-    <env name="SIMPLETEST_BASE_URL" value=""/>
-    <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/database_name#table_prefix -->
-    <env name="SIMPLETEST_DB" value=""/>
-    <!-- By default, browser tests will output links that use the base URL set
-     in SIMPLETEST_BASE_URL. However, if your SIMPLETEST_BASE_URL is an internal
-     path (such as may be the case in a virtual or Docker-based environment),
-     you can set the base URL used in the browser test output links to something
-     reachable from your host machine here. This will allow you to follow them
-     directly and view the output. -->
-    <env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
-    <!-- The environment variable SYMFONY_DEPRECATIONS_HELPER is used to configure
-      the behavior of the deprecation tests.
-      Drupal core's testing framework is setting this variable to its defaults.
-      Projects with their own requirements need to manage this variable
-      explicitly.
-    -->
-    <!-- To disable deprecation testing completely uncomment the next line. -->
-    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/> -->
-    <!-- Deprecation errors can be selectively ignored by specifying a file of
-      regular expression patterns for exclusion.
-      Uncomment the line below to specify a custom deprecations ignore file.
-      NOTE: it may be required to specify the full path to the file to run tests
-      correctly.
-    -->
-    <!-- <env name="SYMFONY_DEPRECATIONS_HELPER" value="ignoreFile=.deprecation-ignore.txt"/> -->
-    <!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
-    <env name="MINK_DRIVER_CLASS" value=""/>
-    <!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' -->
-    <env name="MINK_DRIVER_ARGS" value=""/>
-    <!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "goog:chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
-    <env name="MINK_DRIVER_ARGS_WEBDRIVER" value=""/>
-  </php>
-  <extensions>
-    <!-- Functional tests HTML output logging. -->
-    <bootstrap class="Drupal\TestTools\Extension\HtmlLogging\HtmlOutputLogger">
-      <!-- The directory where the browser output will be stored. If a relative
-        path is specified, it will be relative to the current working directory
-        of the process running the PHPUnit CLI. In CI environments, this can be
-        overridden by the value set for the "BROWSERTEST_OUTPUT_DIRECTORY"
-        environment variable.
-      -->
-      <parameter name="outputDirectory" value="sites/simpletest/browser_output"/>
-      <!-- By default browser tests print the individual links in the test run
-        report. To avoid overcrowding the output in CI environments, you can
-        set the "verbose" parameter or the "BROWSERTEST_OUTPUT_VERBOSE"
-        environment variable to "false". In GitLabCI, the output is saved
-        anyway as an artifact that can be browsed or downloaded from Gitlab.
-      -->
-      <parameter name="verbose" value="true"/>
-    </bootstrap>
-  </extensions>
-  <testsuites>
-    <testsuite name="unit">
-      <directory>tests/Drupal/Tests</directory>
-      <directory>modules/**/tests/src/Unit</directory>
-      <directory>profiles/**/tests/src/Unit</directory>
-      <directory>themes/**/tests/src/Unit</directory>
-      <directory>../modules/**/tests/src/Unit</directory>
-      <directory>../profiles/**/tests/src/Unit</directory>
-      <directory>../themes/**/tests/src/Unit</directory>
-    </testsuite>
-    <testsuite name="kernel">
-      <directory>tests/Drupal/KernelTests</directory>
-      <directory>modules/**/tests/src/Kernel</directory>
-      <directory>recipes/*/tests/src/Kernel</directory>
-      <directory>profiles/**/tests/src/Kernel</directory>
-      <directory>profiles/tests/testing/modules/*/tests/src/Kernel</directory>
-      <directory>themes/**/tests/src/Kernel</directory>
-      <directory>../modules/**/tests/src/Kernel</directory>
-      <directory>../profiles/**/tests/src/Kernel</directory>
-      <directory>../themes/**/tests/src/Kernel</directory>
-    </testsuite>
-    <testsuite name="functional">
-      <directory>tests/Drupal/FunctionalTests</directory>
-      <directory>modules/**/tests/src/Functional</directory>
-      <directory>modules/config/tests/config_test/tests/src/Functional</directory>
-      <directory>modules/system/tests/modules/entity_test/tests/src/Functional</directory>
-      <directory>modules/layout_builder/modules/layout_builder_expose_all_field_blocks/tests/src/Functional</directory>
-      <directory>modules/navigation/modules/navigation_top_bar/tests/src/Functional</directory>
-      <directory>profiles/**/tests/src/Functional</directory>
-      <directory>profiles/demo_umami/modules/demo_umami_content/tests/src/Functional</directory>
-      <directory>recipes/*/tests/src/Functional</directory>
-      <directory>themes/**/tests/src/Functional</directory>
-      <directory>../modules/**/tests/src/Functional</directory>
-      <directory>../profiles/**/tests/src/Functional</directory>
-      <directory>../themes/**/tests/src/Functional</directory>
-    </testsuite>
-    <testsuite name="functional-javascript">
-      <directory>tests/Drupal/FunctionalJavascriptTests</directory>
-      <directory>modules/**/tests/src/FunctionalJavascript</directory>
-      <directory>recipes/*/tests/src/FunctionalJavascript</directory>
-      <directory>profiles/**/tests/src/FunctionalJavascript</directory>
-      <directory>themes/**/tests/src/FunctionalJavascript</directory>
-      <directory>../modules/**/tests/src/FunctionalJavascript</directory>
-      <directory>../profiles/**/tests/src/FunctionalJavascript</directory>
-      <directory>../themes/**/tests/src/FunctionalJavascript</directory>
-    </testsuite>
-    <testsuite name="build">
-      <directory>tests/Drupal/BuildTests</directory>
-      <directory>modules/**/tests/src/Build</directory>
-    </testsuite>
-  </testsuites>
-  <!-- Settings for coverage reports. -->
-  <source ignoreSuppressionOfDeprecations="true">
-    <include>
-      <directory>./includes</directory>
-      <directory>./lib</directory>
-      <directory>./modules</directory>
-      <directory>../modules</directory>
-      <directory>../sites</directory>
-    </include>
-    <exclude>
-      <directory>./modules/*/src/Tests</directory>
-      <directory>./modules/*/tests</directory>
-      <directory>../modules/*/src/Tests</directory>
-      <directory>../modules/*/tests</directory>
-      <directory>../modules/*/*/src/Tests</directory>
-      <directory>../modules/*/*/tests</directory>
-      <directory suffix=".api.php">./lib/**</directory>
-      <directory suffix=".api.php">./modules/**</directory>
-      <directory suffix=".api.php">../modules/**</directory>
-    </exclude>
-  </source>
-</phpunit>
-- 
GitLab


From 270244da36287ae01f56fd75ab5fc6c0d2d2bfcc Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 13:17:42 +0100
Subject: [PATCH 17/24] Issue #3501727: Fix the performance tests cache
 counting.

---
 .../tests/src/FunctionalJavascript/StandardPerformanceTest.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
index c425f516695e..8a0838976163 100644
--- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
@@ -254,7 +254,7 @@ protected function testLogin(): void {
     $this->assertSame($expected_queries, $recorded_queries);
     $expected = [
       'QueryCount' => 17,
-      'CacheGetCount' => 82,
+      'CacheGetCount' => 81,
       'CacheSetCount' => 1,
       'CacheDeleteCount' => 1,
       'CacheTagChecksumCount' => 1,
-- 
GitLab


From fd0b163738c5375e21ace9f67e849f2f085a37f1 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 13:38:19 +0100
Subject: [PATCH 18/24] Issue #3501727: Fix the performance tests cache
 counting.

---
 .../tests/src/FunctionalJavascript/StandardPerformanceTest.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
index 8a0838976163..ac19c2ad7634 100644
--- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
@@ -258,7 +258,7 @@ protected function testLogin(): void {
       'CacheSetCount' => 1,
       'CacheDeleteCount' => 1,
       'CacheTagChecksumCount' => 1,
-      'CacheTagIsValidCount' => 37,
+      'CacheTagIsValidCount' => 36,
       'CacheTagInvalidationCount' => 0,
     ];
     $this->assertMetrics($expected, $performance_data);
-- 
GitLab


From 8f91af6bffc667eb5ec77c8807c77842123c04ab Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sat, 25 Jan 2025 14:15:19 +0100
Subject: [PATCH 19/24] Issue #3501727: Create admin user to test cron UI
 instead of relying on permissions

---
 core/modules/system/tests/src/Functional/System/CronRunTest.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/system/tests/src/Functional/System/CronRunTest.php b/core/modules/system/tests/src/Functional/System/CronRunTest.php
index a5885a660dfe..390ef565543a 100644
--- a/core/modules/system/tests/src/Functional/System/CronRunTest.php
+++ b/core/modules/system/tests/src/Functional/System/CronRunTest.php
@@ -118,7 +118,7 @@ public function testCronExceptions(): void {
    * Make sure the cron UI reads from the state storage.
    */
   public function testCronUI(): void {
-    $admin_user = $this->drupalCreateUser(['administer site configuration']);
+    $admin_user = $this->drupalCreateUser(admin: TRUE);
     $this->drupalLogin($admin_user);
     \Drupal::state()->delete('system.cron_last');
     $this->drupalGet('admin/config/system/cron');
-- 
GitLab


From 8cac91872a3464039d73564774d6e875b76d9302 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sun, 26 Jan 2025 14:41:38 +0100
Subject: [PATCH 20/24] Issue #3501727: Revert cron UI test changes. Revert
 return type for applies method in AdminNegotiator. Fix handling the
 deprecated EntityTypeManager argument and property.

---
 .../src/Functional/System/CronRunTest.php     |  2 +-
 .../user/src/Theme/AdminNegotiator.php        | 22 +++++++++++++++----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/core/modules/system/tests/src/Functional/System/CronRunTest.php b/core/modules/system/tests/src/Functional/System/CronRunTest.php
index 390ef565543a..a5885a660dfe 100644
--- a/core/modules/system/tests/src/Functional/System/CronRunTest.php
+++ b/core/modules/system/tests/src/Functional/System/CronRunTest.php
@@ -118,7 +118,7 @@ public function testCronExceptions(): void {
    * Make sure the cron UI reads from the state storage.
    */
   public function testCronUI(): void {
-    $admin_user = $this->drupalCreateUser(admin: TRUE);
+    $admin_user = $this->drupalCreateUser(['administer site configuration']);
     $this->drupalLogin($admin_user);
     \Drupal::state()->delete('system.cron_last');
     $this->drupalGet('admin/config/system/cron');
diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index 80c058608e44..06d577d7fa5a 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -4,6 +4,7 @@
 
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
 use Drupal\Core\Routing\AdminContext;
 use Drupal\Core\Routing\RouteMatchInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -15,6 +16,11 @@
 class AdminNegotiator implements ThemeNegotiatorInterface {
   use DeprecatedServicePropertyTrait;
 
+  /**
+   * The service properties that should raise a deprecation error.
+   */
+  private array $deprecatedProperties = ['entityTypeManager' => 'entity_type.manager'];
+
   /**
    * The current user.
    *
@@ -43,19 +49,27 @@ class AdminNegotiator implements ThemeNegotiatorInterface {
    *   The current user.
    * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
    *   The config factory.
-   * @param \Drupal\Core\Routing\AdminContext $admin_context
+   * @param \Drupal\Core\Routing\AdminContext|EntityTypeManagerInterface $admin_context
    *   The route admin context to determine whether the route is an admin one.
    */
-  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, AdminContext $admin_context) {
+  public function __construct(AccountInterface $user, ConfigFactoryInterface $config_factory, AdminContext|EntityTypeManagerInterface $admin_context) {
     $this->user = $user;
     $this->configFactory = $config_factory;
-    $this->adminContext = $admin_context;
+
+    if ($admin_context instanceof EntityTypeManagerInterface) {
+      $deprecated_service_name = EntityTypeManagerInterface::class;
+      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated and will be removed in drupal:12.0.0.", E_USER_DEPRECATED);
+      $this->adminContext = func_get_arg(3);
+    }
+    else {
+      $this->adminContext = $admin_context;
+    }
   }
 
   /**
    * {@inheritdoc}
    */
-  public function applies(RouteMatchInterface $route_match): bool {
+  public function applies(RouteMatchInterface $route_match) {
     $is_admin_route = $this->adminContext->isAdminRoute($route_match->getRouteObject());
     return $is_admin_route && $this->user->hasPermission('view the administration theme');
   }
-- 
GitLab


From c59939d412fdaa2333c68a83b429b543ba9d44e0 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sun, 26 Jan 2025 14:49:54 +0100
Subject: [PATCH 21/24] Issue #3501727: Improve the deprecation message

---
 core/modules/user/src/Theme/AdminNegotiator.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index 06d577d7fa5a..fd79e287e11f 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -58,7 +58,7 @@ public function __construct(AccountInterface $user, ConfigFactoryInterface $conf
 
     if ($admin_context instanceof EntityTypeManagerInterface) {
       $deprecated_service_name = EntityTypeManagerInterface::class;
-      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated and will be removed in drupal:12.0.0.", E_USER_DEPRECATED);
+      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used.", E_USER_DEPRECATED);
       $this->adminContext = func_get_arg(3);
     }
     else {
-- 
GitLab


From ce3a0cd692b523a2a903394422414c144fa79ce1 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Sun, 26 Jan 2025 14:56:29 +0100
Subject: [PATCH 22/24] Issue #3501727: Add link to issue in deprecation
 message.

---
 core/modules/user/src/Theme/AdminNegotiator.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index fd79e287e11f..6c35720b8b02 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -58,7 +58,7 @@ public function __construct(AccountInterface $user, ConfigFactoryInterface $conf
 
     if ($admin_context instanceof EntityTypeManagerInterface) {
       $deprecated_service_name = EntityTypeManagerInterface::class;
-      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used.", E_USER_DEPRECATED);
+      @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used. See https://www.drupal.org/project/drupal/issues/3501727", E_USER_DEPRECATED);
       $this->adminContext = func_get_arg(3);
     }
     else {
-- 
GitLab


From 600b7bded33c98d408b24a6b0ce9bf30eda354f5 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Tue, 4 Feb 2025 09:45:54 +0100
Subject: [PATCH 23/24] Update the expected value for CacheGetCount in
 StandardPerformanceTest

---
 .../tests/src/FunctionalJavascript/StandardPerformanceTest.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
index ecc905112b37..611265479699 100644
--- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
+++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardPerformanceTest.php
@@ -335,7 +335,7 @@ protected function testLogin(): void {
     $this->assertSame($expected_queries, $recorded_queries);
     $expected = [
       'QueryCount' => 17,
-      'CacheGetCount' => 82,
+      'CacheGetCount' => 81,
       'CacheSetCount' => 1,
       'CacheDeleteCount' => 1,
       'CacheTagChecksumCount' => 1,
-- 
GitLab


From 2104c5274ce3a6294114851c33bc7e7f1c85a255 Mon Sep 17 00:00:00 2001
From: Mariusz Andrzejewski <mariusz.andrzejewski@droptica.pl>
Date: Thu, 6 Feb 2025 11:51:41 +0100
Subject: [PATCH 24/24] Get AdminContext from container instead of relying on
 the constructor arguments

---
 core/modules/user/src/Theme/AdminNegotiator.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/modules/user/src/Theme/AdminNegotiator.php b/core/modules/user/src/Theme/AdminNegotiator.php
index 6c35720b8b02..d8c495d2350e 100644
--- a/core/modules/user/src/Theme/AdminNegotiator.php
+++ b/core/modules/user/src/Theme/AdminNegotiator.php
@@ -59,7 +59,7 @@ public function __construct(AccountInterface $user, ConfigFactoryInterface $conf
     if ($admin_context instanceof EntityTypeManagerInterface) {
       $deprecated_service_name = EntityTypeManagerInterface::class;
       @trigger_error("Passing the $deprecated_service_name (entity_type.manager service) to AdminNegotiator is deprecated in drupal:11.2.0 and will be removed in drupal:12.0.0. There is no replacement for this service, as it is not used. See https://www.drupal.org/project/drupal/issues/3501727", E_USER_DEPRECATED);
-      $this->adminContext = func_get_arg(3);
+      $this->adminContext = \Drupal::service('router.admin_context');
     }
     else {
       $this->adminContext = $admin_context;
-- 
GitLab