Skip to content
Snippets Groups Projects
Commit 08cddd89 authored by catch's avatar catch
Browse files

Revert "Issue #3187113 by longwave: Remove uses of t() in submitForm() calls"

This reverts commit febe06ca.
parent 69a0a835
No related branches found
No related tags found
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!16Draft: Resolve #2081585 "History storage"
Showing
with 25 additions and 25 deletions
......@@ -88,12 +88,16 @@ public function testCommentStatusFieldAccessStatus() {
$this->drupalGet('node/add/article');
$assert = $this->assertSession();
$assert->fieldNotExists('comment[0][status]');
$this->submitForm(['title[0][value]' => 'Node 1'], 'Save');
$this->submitForm([
'title[0][value]' => 'Node 1',
], t('Save'));
$assert->fieldExists('subject[0][value]');
$this->drupalLogin($this->commentAdmin);
$this->drupalGet('node/add/article');
$assert->fieldExists('comment[0][status]');
$this->submitForm(['title[0][value]' => 'Node 2'], 'Save');
$this->submitForm([
'title[0][value]' => 'Node 2',
], t('Save'));
$assert->fieldExists('subject[0][value]');
}
......
......@@ -66,7 +66,7 @@ public function testModerationForm() {
$this->assertSession()->optionNotExists('moderation_state[0][state]', 'archived');
// Create new moderated content in draft.
$this->submitForm(['moderation_state[0][state]' => 'draft'], 'Save');
$this->submitForm(['moderation_state[0][state]' => 'draft'], t('Save'));
$node = $this->drupalGetNodeByTitle('Some moderated content');
$canonical_path = sprintf('node/%d', $node->id());
......
......@@ -53,7 +53,7 @@ public function testDisableSetting() {
$translatable_checkbox => TRUE,
$language_alterable => TRUE,
];
$this->submitForm($edit, 'Save configuration');
$this->submitForm($edit, t('Save configuration'));
$assert->pageTextContains(t('Settings successfully updated.'));
......@@ -64,7 +64,7 @@ public function testDisableSetting() {
$translatable_checkbox => TRUE,
$language_alterable => TRUE,
];
$this->submitForm($edit, 'Save configuration');
$this->submitForm($edit, t('Save configuration'));
$assert->pageTextContains(t('Settings successfully updated.'));
......
......@@ -94,7 +94,7 @@ public function testFileUploadErrors() {
$edit = [
'edit-title-0-value' => $this->randomString(),
];
$this->submitForm($edit, 'Save');
$this->submitForm($edit, t('Save'));
$error_text = $this->getSession()->getPage()->find('css', '.field--name-field-ief-file .form-item--error-message')->getText();
......
......@@ -58,10 +58,10 @@ public function testMigrateUpgradeExecute() {
// Start the upgrade process.
$this->drupalGet('/upgrade');
$this->submitForm([], 'Continue');
$this->submitForm($edits, 'Review upgrade');
$this->submitForm([], 'I acknowledge I may lose data. Continue anyway.');
$this->submitForm([], 'Perform upgrade');
$this->submitForm([], t('Continue'));
$this->submitForm($edits, t('Review upgrade'));
$this->submitForm([], t('I acknowledge I may lose data. Continue anyway.'));
$this->submitForm([], t('Perform upgrade'));
// Tests the migration log contains an error message.
$migration = $this->getMigrationPluginManager()->createInstance('d7_file');
......
......@@ -262,7 +262,7 @@ public function testUserPasswordResetPreferredLanguage($setPreferredLangcode, $a
// Test password reset with language prefixes.
$this->drupalGet($visitingUrl);
$edit = ['name' => $this->account->getAccountName()];
$this->submitForm($edit, 'Submit');
$this->submitForm($edit, t('Submit'));
$this->assertValidPasswordReset($edit['name']);
$resetURL = $this->getResetURL();
......
......@@ -63,7 +63,7 @@ public function testExposedFilteringAndReset() {
$this->assertStringContainsString('Article A', $html);
// Filter by page type.
$this->submitForm(['type' => 'page'], 'Apply');
$this->submitForm(['type' => 'page'], t('Apply'));
$this->assertSession()->waitForElementRemoved('xpath', '//*[text()="Article A"]');
// Verify that only the page nodes are present.
......@@ -73,7 +73,7 @@ public function testExposedFilteringAndReset() {
$this->assertStringNotContainsString('Article A', $html);
// Reset the form.
$this->submitForm([], 'Reset');
$this->submitForm([], t('Reset'));
// Assert we are still on the node page.
$html = $page->getHtml();
// Repeat the original tests.
......@@ -87,9 +87,9 @@ public function testExposedFilteringAndReset() {
// is redirected to the page display.
$this->drupalPlaceBlock('views_block:test_block_exposed_ajax_with_page-block_1');
$this->drupalGet($node->toUrl());
$this->submitForm(['type' => 'page'], 'Apply');
$this->submitForm(['type' => 'page'], t('Apply'));
$this->assertSession()->waitForElementRemoved('xpath', '//*[text()="Article A"]');
$this->submitForm([], 'Reset');
$this->submitForm([], t('Reset'));
$this->assertSession()->addressEquals('some-path');
}
......
......@@ -67,7 +67,7 @@ public function testExposedFiltering() {
$this->assertStringContainsString('Page Two', $html);
// Search for "Page One".
$this->submitForm(['title' => 'Page One'], 'Filter');
$this->submitForm(['title' => 'Page One'], t('Filter'));
$this->assertSession()->assertWaitOnAjaxRequest();
// Verify that only the "Page One" Node is present.
......@@ -76,7 +76,7 @@ public function testExposedFiltering() {
$this->assertStringNotContainsString('Page Two', $html);
// Search for "Page Two".
$this->submitForm(['title' => 'Page Two'], 'Filter');
$this->submitForm(['title' => 'Page Two'], t('Filter'));
$this->assertSession()->assertWaitOnAjaxRequest();
// Verify that only the "Page Two" Node is present.
......@@ -89,13 +89,13 @@ public function testExposedFiltering() {
$this->submitForm([
'action' => 'node_make_sticky_action',
'node_bulk_form[0]' => TRUE,
], 'Apply to selected items');
], t('Apply to selected items'));
// Verify that the action was performed.
$this->assertSession()->pageTextContains('Make content sticky was applied to 1 item.');
// Reset the form.
$this->submitForm([], 'Reset');
$this->submitForm([], t('Reset'));
$this->assertSession()->assertWaitOnAjaxRequest();
$this->assertSession()->pageTextContains('Page One');
......
......@@ -228,7 +228,7 @@ protected function drupalLoginWithPassword(AccountInterface $account, $password)
$this->submitForm([
'name' => $account->getAccountName(),
'pass' => $password,
], 'Log in');
], t('Log in'));
// @see ::drupalUserIsLoggedIn()
$account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']);
......
......@@ -66,10 +66,6 @@ trait UiHelperTrait {
* underscores.
*/
protected function submitForm(array $edit, $submit, $form_html_id = NULL) {
if (is_object($submit)) {
@trigger_error('Calling ' . __METHOD__ . '() with $submit as an object is deprecated in drupal:9.2.0 and strings will be required in drupal:10.0.0. Pass a plain string instead. See https://www.drupal.org/node/xxx', E_USER_DEPRECATED);
}
$assert_session = $this->assertSession();
// Get the form.
......@@ -258,7 +254,7 @@ protected function drupalLogin(AccountInterface $account) {
$this->submitForm([
'name' => $account->getAccountName(),
'pass' => $account->passRaw,
], 'Log in');
], t('Log in'));
// @see ::drupalUserIsLoggedIn()
$account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment