Skip to content

Commit

Permalink
Use plain strings in submitForm() calls in functional tests.
Browse files Browse the repository at this point in the history
This fixes failing tests after upgrading to Drupal 10.2.3.
See https://www.drupal.org/project/drupal/issues/3399413
  • Loading branch information
mstenta committed Feb 8, 2024
1 parent cec7ed0 commit 92c558d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions modules/core/asset/tests/src/Functional/AssetCRUDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testCreateAsset() {
];

$this->drupalGet('asset/add/default');
$this->submitForm($edit, $this->t('Save'));
$this->submitForm($edit, 'Save');

$result = \Drupal::entityTypeManager()
->getStorage('asset')
Expand Down Expand Up @@ -85,7 +85,7 @@ public function testEditAsset() {
'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]']);
}

Expand All @@ -100,7 +100,7 @@ public function testDeleteAsset() {
$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,
Expand Down
4 changes: 2 additions & 2 deletions modules/core/login/tests/src/Functional/UserLoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function assertFailedLoginUsingEmail(User $account, $flood_trigger = NULL
$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');
Expand Down Expand Up @@ -187,7 +187,7 @@ protected function drupalLoginUsingEmail(AccountInterface $account) {
$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']);
Expand Down
6 changes: 3 additions & 3 deletions modules/core/plan/tests/src/Functional/PlanCRUDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testCreatePlan() {
];

$this->drupalGet('plan/add/default');
$this->submitForm($edit, $this->t('Save'));
$this->submitForm($edit, 'Save');

$result = \Drupal::entityTypeManager()
->getStorage('plan')
Expand Down Expand Up @@ -85,7 +85,7 @@ public function testEditPlan() {
'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]']);
}
Expand All @@ -101,7 +101,7 @@ public function testDeletePlan() {
$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,
Expand Down

0 comments on commit 92c558d

Please sign in to comment.