3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

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->drupalGet('asset/add/default');
$this->submitForm($edit, $this->t('Save')); $this->submitForm($edit, 'Save');
$result = \Drupal::entityTypeManager() $result = \Drupal::entityTypeManager()
->getStorage('asset') ->getStorage('asset')
@ -85,7 +85,7 @@ class AssetCRUDTest extends AssetTestBase {
'name[0][value]' => $this->randomMachineName(), 'name[0][value]' => $this->randomMachineName(),
]; ];
$this->drupalGet($asset->toUrl('edit-form')); $this->drupalGet($asset->toUrl('edit-form'));
$this->submitForm($edit, $this->t('Save')); $this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains($edit['name[0][value]']); $this->assertSession()->pageTextContains($edit['name[0][value]']);
} }
@ -100,7 +100,7 @@ class AssetCRUDTest extends AssetTestBase {
$asset_id = $asset->id(); $asset_id = $asset->id();
$this->drupalGet($asset->toUrl('delete-form')); $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.', [ $this->assertSession()->responseContains($this->t('The @entity-type %label has been deleted.', [
'@entity-type' => $asset->getEntityType()->getSingularLabel(), '@entity-type' => $asset->getEntityType()->getSingularLabel(),
'%label' => $label, '%label' => $label,

View file

@ -141,7 +141,7 @@ class UserLoginTest extends FarmBrowserTestBase {
$this->submitForm([ $this->submitForm([
'name' => $account->getEmail(), 'name' => $account->getEmail(),
'pass' => $account->passRaw, 'pass' => $account->passRaw,
], $this->t('Log in')); ], 'Log in');
if (isset($flood_trigger)) { if (isset($flood_trigger)) {
$this->assertSession()->statusCodeEquals(403); $this->assertSession()->statusCodeEquals(403);
$this->assertSession()->fieldNotExists('pass'); $this->assertSession()->fieldNotExists('pass');
@ -187,7 +187,7 @@ class UserLoginTest extends FarmBrowserTestBase {
$this->submitForm([ $this->submitForm([
'name' => $account->getEmail(), 'name' => $account->getEmail(),
'pass' => $account->passRaw, 'pass' => $account->passRaw,
], $this->t('Log in')); ], 'Log in');
// @see ::drupalUserIsLoggedIn() // @see ::drupalUserIsLoggedIn()
$account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']); $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->drupalGet('plan/add/default');
$this->submitForm($edit, $this->t('Save')); $this->submitForm($edit, 'Save');
$result = \Drupal::entityTypeManager() $result = \Drupal::entityTypeManager()
->getStorage('plan') ->getStorage('plan')
@ -85,7 +85,7 @@ class PlanCRUDTest extends PlanTestBase {
'name[0][value]' => $this->randomMachineName(), 'name[0][value]' => $this->randomMachineName(),
]; ];
$this->drupalGet($plan->toUrl('edit-form')); $this->drupalGet($plan->toUrl('edit-form'));
$this->submitForm($edit, $this->t('Save')); $this->submitForm($edit, 'Save');
$this->assertSession()->pageTextContains($edit['name[0][value]']); $this->assertSession()->pageTextContains($edit['name[0][value]']);
} }
@ -101,7 +101,7 @@ class PlanCRUDTest extends PlanTestBase {
$plan_id = $plan->id(); $plan_id = $plan->id();
$this->drupalGet($plan->toUrl('delete-form')); $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.', [ $this->assertSession()->responseContains($this->t('The @entity-type %label has been deleted.', [
'@entity-type' => $plan->getEntityType()->getSingularLabel(), '@entity-type' => $plan->getEntityType()->getSingularLabel(),
'%label' => $label, '%label' => $label,