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
This commit is contained in:
Michael Stenta 2024-02-08 05:04:26 -05:00
parent cec7ed04d0
commit 92c558dde3
3 changed files with 8 additions and 8 deletions

View File

@ -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,

View File

@ -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']);

View File

@ -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,