From 0eab6a2ad7d29d03906ad900cc8c18302ebd946e Mon Sep 17 00:00:00 2001
From: Adam Bramley <adam.bramley@previousnext.com.au>
Date: Tue, 25 Mar 2025 15:11:43 +1100
Subject: [PATCH 1/2] Issue #3385836: Remove unnecessary form submissions in
 NodeTranslationUITest

---
 .../src/Functional/NodeTranslationUITest.php  | 23 ++++++++-----------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index 2bb252f7c6e1..2f7cc7247f06 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -242,21 +242,18 @@ public function testTranslationLinkTheme(): void {
 
     // Set up the default admin theme and use it for node editing.
     $this->container->get('theme_installer')->install(['claro']);
-    $edit = [];
-    $edit['admin_theme'] = 'claro';
-    $edit['use_admin_theme'] = TRUE;
-    $this->drupalGet('admin/appearance');
-    $this->submitForm($edit, 'Save configuration');
-    $this->drupalGet('node/' . $article->id() . '/translations');
+    $this->config('system.theme')->set('admin', 'claro')->save();
+
     // Verify that translation uses the admin theme if edit is admin.
+    $this->drupalGet('node/' . $article->id() . '/translations');
     $this->assertSession()->responseContains('core/themes/claro/css/base/elements.css');
 
     // Turn off admin theme for editing, assert inheritance to translations.
-    $edit['use_admin_theme'] = FALSE;
-    $this->drupalGet('admin/appearance');
-    $this->submitForm($edit, 'Save configuration');
-    $this->drupalGet('node/' . $article->id() . '/translations');
+    $this->config('node.settings')->set('use_admin_theme', FALSE)->save();
+    $this->container->get('router.builder')->rebuild();
+
     // Verify that translation uses the frontend theme if edit is frontend.
+    $this->drupalGet('node/' . $article->id() . '/translations');
     $this->assertSession()->responseNotContains('core/themes/claro/css/base/elements.css');
 
     // Assert presence of translation page itself (vs. DisabledBundle below).
@@ -561,12 +558,10 @@ public function testDetailsTitleIsNotEscaped(): void {
       'translatable' => TRUE,
     ])->save();
 
-    $this->drupalLogin($this->administrator);
     // Make the image field a multi-value field in order to display a
     // details form element.
-    $edit = ['field_storage[subform][cardinality_number]' => 2];
-    $this->drupalGet('admin/structure/types/manage/article/fields/node.article.field_image');
-    $this->submitForm($edit, 'Save');
+    $fieldStorage = FieldStorageConfig::loadByName('node', 'field_image');
+    $fieldStorage->setCardinality(2)->save();
 
     // Enable the display of the image field.
     EntityFormDisplay::load('node.article.default')
-- 
GitLab


From 4c6dd77474bb53381a8f84ffb1b4370dbe1f6386 Mon Sep 17 00:00:00 2001
From: Adam Bramley <46227-acbramley@users.noreply.drupalcode.org>
Date: Tue, 25 Mar 2025 21:38:13 +0000
Subject: [PATCH 2/2] Add comment.

---
 core/modules/node/tests/src/Functional/NodeTranslationUITest.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index 2f7cc7247f06..ac1e8664badf 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -250,6 +250,7 @@ public function testTranslationLinkTheme(): void {
 
     // Turn off admin theme for editing, assert inheritance to translations.
     $this->config('node.settings')->set('use_admin_theme', FALSE)->save();
+    // Changing node.settings:use_admin_theme requires a route rebuild.
     $this->container->get('router.builder')->rebuild();
 
     // Verify that translation uses the frontend theme if edit is frontend.
-- 
GitLab