From 92c558dde3fbf2cff8cb11a4b97107db43fae5ff Mon Sep 17 00:00:00 2001 From: Michael Stenta Date: Thu, 8 Feb 2024 05:04:26 -0500 Subject: [PATCH] Use plain strings in submitForm() calls in functional tests. This fixes failing tests after upgrading to Drupal 10.2.3. See https://www.drupal.org/project/drupal/issues/3399413 --- modules/core/asset/tests/src/Functional/AssetCRUDTest.php | 6 +++--- modules/core/login/tests/src/Functional/UserLoginTest.php | 4 ++-- modules/core/plan/tests/src/Functional/PlanCRUDTest.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/core/asset/tests/src/Functional/AssetCRUDTest.php b/modules/core/asset/tests/src/Functional/AssetCRUDTest.php index fa0b53d0e..bb3a44029 100644 --- a/modules/core/asset/tests/src/Functional/AssetCRUDTest.php +++ b/modules/core/asset/tests/src/Functional/AssetCRUDTest.php @@ -40,7 +40,7 @@ class AssetCRUDTest extends AssetTestBase { ]; $this->drupalGet('asset/add/default'); - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $result = \Drupal::entityTypeManager() ->getStorage('asset') @@ -85,7 +85,7 @@ class AssetCRUDTest extends AssetTestBase { 'name[0][value]' => $this->randomMachineName(), ]; $this->drupalGet($asset->toUrl('edit-form')); - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $this->assertSession()->pageTextContains($edit['name[0][value]']); } @@ -100,7 +100,7 @@ class AssetCRUDTest extends AssetTestBase { $asset_id = $asset->id(); $this->drupalGet($asset->toUrl('delete-form')); - $this->submitForm([], $this->t('Delete')); + $this->submitForm([], 'Delete'); $this->assertSession()->responseContains($this->t('The @entity-type %label has been deleted.', [ '@entity-type' => $asset->getEntityType()->getSingularLabel(), '%label' => $label, diff --git a/modules/core/login/tests/src/Functional/UserLoginTest.php b/modules/core/login/tests/src/Functional/UserLoginTest.php index 93896bb9f..16cdcaa88 100644 --- a/modules/core/login/tests/src/Functional/UserLoginTest.php +++ b/modules/core/login/tests/src/Functional/UserLoginTest.php @@ -141,7 +141,7 @@ class UserLoginTest extends FarmBrowserTestBase { $this->submitForm([ 'name' => $account->getEmail(), 'pass' => $account->passRaw, - ], $this->t('Log in')); + ], 'Log in'); if (isset($flood_trigger)) { $this->assertSession()->statusCodeEquals(403); $this->assertSession()->fieldNotExists('pass'); @@ -187,7 +187,7 @@ class UserLoginTest extends FarmBrowserTestBase { $this->submitForm([ 'name' => $account->getEmail(), 'pass' => $account->passRaw, - ], $this->t('Log in')); + ], 'Log in'); // @see ::drupalUserIsLoggedIn() $account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']); diff --git a/modules/core/plan/tests/src/Functional/PlanCRUDTest.php b/modules/core/plan/tests/src/Functional/PlanCRUDTest.php index 541a02343..86ad32cb1 100644 --- a/modules/core/plan/tests/src/Functional/PlanCRUDTest.php +++ b/modules/core/plan/tests/src/Functional/PlanCRUDTest.php @@ -40,7 +40,7 @@ class PlanCRUDTest extends PlanTestBase { ]; $this->drupalGet('plan/add/default'); - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $result = \Drupal::entityTypeManager() ->getStorage('plan') @@ -85,7 +85,7 @@ class PlanCRUDTest extends PlanTestBase { 'name[0][value]' => $this->randomMachineName(), ]; $this->drupalGet($plan->toUrl('edit-form')); - $this->submitForm($edit, $this->t('Save')); + $this->submitForm($edit, 'Save'); $this->assertSession()->pageTextContains($edit['name[0][value]']); } @@ -101,7 +101,7 @@ class PlanCRUDTest extends PlanTestBase { $plan_id = $plan->id(); $this->drupalGet($plan->toUrl('delete-form')); - $this->submitForm([], $this->t('Delete')); + $this->submitForm([], 'Delete'); $this->assertSession()->responseContains($this->t('The @entity-type %label has been deleted.', [ '@entity-type' => $plan->getEntityType()->getSingularLabel(), '%label' => $label,