From 3e2ec19f371e388c8fb5fdfe2ca9cffa177a296a Mon Sep 17 00:00:00 2001
From: catch <6915-catch@users.noreply.drupalcode.org>
Date: Wed, 1 Jan 2025 08:01:41 +0000
Subject: [PATCH] Issue #3496405 by spokje: [random test failure]
 EditorSecurityTest::testEditorXssFilterOverride

---
 .../tests/modules/editor_test/src/Hook/EditorTestHooks.php    | 2 +-
 .../editor/tests/src/Functional/EditorSecurityTest.php        | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/modules/editor/tests/modules/editor_test/src/Hook/EditorTestHooks.php b/core/modules/editor/tests/modules/editor_test/src/Hook/EditorTestHooks.php
index 9c2e5a87d204..12e182bfe4f9 100644
--- a/core/modules/editor/tests/modules/editor_test/src/Hook/EditorTestHooks.php
+++ b/core/modules/editor/tests/modules/editor_test/src/Hook/EditorTestHooks.php
@@ -66,7 +66,7 @@ public function editorJsSettingsAlter(&$settings): void {
   #[Hook('editor_xss_filter_alter')]
   public function editorXssFilterAlter(&$editor_xss_filter_class, FilterFormatInterface $format, ?FilterFormatInterface $original_format = NULL): void {
     // Allow tests to enable or disable this alter hook.
-    if (!\Drupal::state()->get('editor_test_editor_xss_filter_alter_enabled', FALSE)) {
+    if (!\Drupal::keyValue('editor_test')->get('editor_xss_filter_alter_enabled', FALSE)) {
       return;
     }
     $filters = $format->filters()->getAll();
diff --git a/core/modules/editor/tests/src/Functional/EditorSecurityTest.php b/core/modules/editor/tests/src/Functional/EditorSecurityTest.php
index 26d4bdaeb4cc..d344fed3a43e 100644
--- a/core/modules/editor/tests/src/Functional/EditorSecurityTest.php
+++ b/core/modules/editor/tests/src/Functional/EditorSecurityTest.php
@@ -445,9 +445,9 @@ public function testEditorXssFilterOverride(): void {
     $this->drupalGet('node/2/edit');
     $this->assertSession()->fieldValueEquals('edit-body-0-value', self::$sampleContentSecured);
 
-    // Enable editor_test.module's hook_editor_xss_filter_alter() implementation
+    // Enable editor_test's hook_editor_xss_filter_alter() implementation
     // to alter the text editor XSS filter class being used.
-    \Drupal::state()->set('editor_test_editor_xss_filter_alter_enabled', TRUE);
+    \Drupal::keyValue('editor_test')->set('editor_xss_filter_alter_enabled', TRUE);
 
     // First: the Insecure text editor XSS filter.
     $this->drupalGet('node/2/edit');
-- 
GitLab