From 7031fb427dde5b7a227548a6eb0f0ea1b288f12e Mon Sep 17 00:00:00 2001 From: catch <6915-catch@users.noreply.drupalcode.org> Date: Sat, 28 Dec 2024 14:57:23 +0000 Subject: [PATCH] Issue #3487371 by spokje, dww: [random test failure] ImageStylesPathAndUrlTest --- .../image_module_test/src/Hook/ImageModuleTestHooks.php | 2 +- .../tests/src/Functional/ImageStylesPathAndUrlTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/modules/image/tests/modules/image_module_test/src/Hook/ImageModuleTestHooks.php b/core/modules/image/tests/modules/image_module_test/src/Hook/ImageModuleTestHooks.php index bd75b066d99d..b45ddc542c4a 100644 --- a/core/modules/image/tests/modules/image_module_test/src/Hook/ImageModuleTestHooks.php +++ b/core/modules/image/tests/modules/image_module_test/src/Hook/ImageModuleTestHooks.php @@ -53,7 +53,7 @@ public function imageStyleFlush($style, $path = NULL): void { */ #[Hook('file_download')] public function fileDownload($uri): array { - $default_uri = \Drupal::state()->get('image.test_file_download', FALSE); + $default_uri = \Drupal::keyValue('image')->get('test_file_download', FALSE); if ($default_uri == $uri) { return ['X-Image-Owned-By' => 'image_module_test']; } diff --git a/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php b/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php index 63b2a23a4918..5c8f1a095594 100644 --- a/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/tests/src/Functional/ImageStylesPathAndUrlTest.php @@ -176,7 +176,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s $original_uri = $file_system->copy($file->uri, $scheme . '://', FileExists::Rename); // Let the image_module_test module know about this file, so it can claim // ownership in hook_file_download(). - \Drupal::state()->set('image.test_file_download', $original_uri); + \Drupal::keyValue('image')->set('test_file_download', $original_uri); $this->assertNotFalse($original_uri, 'Created the generated image file.'); // Get the URL of a file that has not been generated and try to create it. @@ -251,7 +251,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s // Make sure that access is denied for existing style files if we do not // have access. - \Drupal::state()->delete('image.test_file_download'); + \Drupal::keyValue('image')->delete('test_file_download'); $this->drupalGet($generate_url); $this->assertSession()->statusCodeEquals(403); @@ -301,7 +301,7 @@ public function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_s $original_uri = $file_system->copy($file->uri, $scheme . '://', FileExists::Rename); // Let the image_module_test module know about this file, so it can claim // ownership in hook_file_download(). - \Drupal::state()->set('image.test_file_download', $original_uri); + \Drupal::keyValue('image')->set('test_file_download', $original_uri); // Suppress the security token in the URL, then get the URL of a file that // has not been created and try to create it. Check that the security token -- GitLab