Issue #3187113 by longwave: Remove uses of t() in submitForm() calls
parent
1fb62ccc58
commit
febe06ca57
|
@ -88,16 +88,12 @@ class CommentStatusFieldAccessTest extends BrowserTestBase {
|
|||
$this->drupalGet('node/add/article');
|
||||
$assert = $this->assertSession();
|
||||
$assert->fieldNotExists('comment[0][status]');
|
||||
$this->submitForm([
|
||||
'title[0][value]' => 'Node 1',
|
||||
], t('Save'));
|
||||
$this->submitForm(['title[0][value]' => 'Node 1'], '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',
|
||||
], t('Save'));
|
||||
$this->submitForm(['title[0][value]' => 'Node 2'], 'Save');
|
||||
$assert->fieldExists('subject[0][value]');
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class ModerationFormTest extends ModerationStateTestBase {
|
|||
$this->assertSession()->optionNotExists('moderation_state[0][state]', 'archived');
|
||||
|
||||
// Create new moderated content in draft.
|
||||
$this->submitForm(['moderation_state[0][state]' => 'draft'], t('Save'));
|
||||
$this->submitForm(['moderation_state[0][state]' => 'draft'], 'Save');
|
||||
|
||||
$node = $this->drupalGetNodeByTitle('Some moderated content');
|
||||
$canonical_path = sprintf('node/%d', $node->id());
|
||||
|
|
|
@ -53,7 +53,7 @@ class ContentTranslationDisableSettingTest extends BrowserTestBase {
|
|||
$translatable_checkbox => TRUE,
|
||||
$language_alterable => TRUE,
|
||||
];
|
||||
$this->submitForm($edit, t('Save configuration'));
|
||||
$this->submitForm($edit, 'Save configuration');
|
||||
|
||||
$assert->pageTextContains(t('Settings successfully updated.'));
|
||||
|
||||
|
@ -64,7 +64,7 @@ class ContentTranslationDisableSettingTest extends BrowserTestBase {
|
|||
$translatable_checkbox => TRUE,
|
||||
$language_alterable => TRUE,
|
||||
];
|
||||
$this->submitForm($edit, t('Save configuration'));
|
||||
$this->submitForm($edit, 'Save configuration');
|
||||
|
||||
$assert->pageTextContains(t('Settings successfully updated.'));
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class FormErrorHandlerFileUploadTest extends BrowserTestBase {
|
|||
$edit = [
|
||||
'edit-title-0-value' => $this->randomString(),
|
||||
];
|
||||
$this->submitForm($edit, t('Save'));
|
||||
$this->submitForm($edit, 'Save');
|
||||
|
||||
$error_text = $this->getSession()->getPage()->find('css', '.field--name-field-ief-file .form-item--error-message')->getText();
|
||||
|
||||
|
|
|
@ -58,10 +58,10 @@ class DoubleSlashTest extends MigrateUpgradeExecuteTestBase {
|
|||
|
||||
// Start the upgrade process.
|
||||
$this->drupalGet('/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'));
|
||||
$this->submitForm([], 'Continue');
|
||||
$this->submitForm($edits, 'Review upgrade');
|
||||
$this->submitForm([], 'I acknowledge I may lose data. Continue anyway.');
|
||||
$this->submitForm([], 'Perform upgrade');
|
||||
|
||||
// Tests the migration log contains an error message.
|
||||
$migration = $this->getMigrationPluginManager()->createInstance('d7_file');
|
||||
|
|
|
@ -262,7 +262,7 @@ class UserPasswordResetTest extends BrowserTestBase {
|
|||
// Test password reset with language prefixes.
|
||||
$this->drupalGet($visitingUrl);
|
||||
$edit = ['name' => $this->account->getAccountName()];
|
||||
$this->submitForm($edit, t('Submit'));
|
||||
$this->submitForm($edit, 'Submit');
|
||||
$this->assertValidPasswordReset($edit['name']);
|
||||
|
||||
$resetURL = $this->getResetURL();
|
||||
|
|
|
@ -63,7 +63,7 @@ class BlockExposedFilterAJAXTest extends WebDriverTestBase {
|
|||
$this->assertStringContainsString('Article A', $html);
|
||||
|
||||
// Filter by page type.
|
||||
$this->submitForm(['type' => 'page'], t('Apply'));
|
||||
$this->submitForm(['type' => 'page'], 'Apply');
|
||||
$this->assertSession()->waitForElementRemoved('xpath', '//*[text()="Article A"]');
|
||||
|
||||
// Verify that only the page nodes are present.
|
||||
|
@ -73,7 +73,7 @@ class BlockExposedFilterAJAXTest extends WebDriverTestBase {
|
|||
$this->assertStringNotContainsString('Article A', $html);
|
||||
|
||||
// Reset the form.
|
||||
$this->submitForm([], t('Reset'));
|
||||
$this->submitForm([], 'Reset');
|
||||
// Assert we are still on the node page.
|
||||
$html = $page->getHtml();
|
||||
// Repeat the original tests.
|
||||
|
@ -87,9 +87,9 @@ class BlockExposedFilterAJAXTest extends WebDriverTestBase {
|
|||
// 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'], t('Apply'));
|
||||
$this->submitForm(['type' => 'page'], 'Apply');
|
||||
$this->assertSession()->waitForElementRemoved('xpath', '//*[text()="Article A"]');
|
||||
$this->submitForm([], t('Reset'));
|
||||
$this->submitForm([], 'Reset');
|
||||
$this->assertSession()->addressEquals('some-path');
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class ExposedFilterAJAXTest extends WebDriverTestBase {
|
|||
$this->assertStringContainsString('Page Two', $html);
|
||||
|
||||
// Search for "Page One".
|
||||
$this->submitForm(['title' => 'Page One'], t('Filter'));
|
||||
$this->submitForm(['title' => 'Page One'], 'Filter');
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
|
||||
// Verify that only the "Page One" Node is present.
|
||||
|
@ -76,7 +76,7 @@ class ExposedFilterAJAXTest extends WebDriverTestBase {
|
|||
$this->assertStringNotContainsString('Page Two', $html);
|
||||
|
||||
// Search for "Page Two".
|
||||
$this->submitForm(['title' => 'Page Two'], t('Filter'));
|
||||
$this->submitForm(['title' => 'Page Two'], 'Filter');
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
|
||||
// Verify that only the "Page Two" Node is present.
|
||||
|
@ -89,13 +89,13 @@ class ExposedFilterAJAXTest extends WebDriverTestBase {
|
|||
$this->submitForm([
|
||||
'action' => 'node_make_sticky_action',
|
||||
'node_bulk_form[0]' => TRUE,
|
||||
], t('Apply to selected items'));
|
||||
], '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([], t('Reset'));
|
||||
$this->submitForm([], 'Reset');
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
|
||||
$this->assertSession()->pageTextContains('Page One');
|
||||
|
|
|
@ -228,7 +228,7 @@ class DemoUmamiProfileTest extends BrowserTestBase {
|
|||
$this->submitForm([
|
||||
'name' => $account->getAccountName(),
|
||||
'pass' => $password,
|
||||
], t('Log in'));
|
||||
], 'Log in');
|
||||
|
||||
// @see ::drupalUserIsLoggedIn()
|
||||
$account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']);
|
||||
|
|
|
@ -66,6 +66,10 @@ 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.
|
||||
|
@ -254,7 +258,7 @@ trait UiHelperTrait {
|
|||
$this->submitForm([
|
||||
'name' => $account->getAccountName(),
|
||||
'pass' => $account->passRaw,
|
||||
], t('Log in'));
|
||||
], 'Log in');
|
||||
|
||||
// @see ::drupalUserIsLoggedIn()
|
||||
$account->sessionId = $this->getSession()->getCookie(\Drupal::service('session_configuration')->getOptions(\Drupal::request())['name']);
|
||||
|
|
Loading…
Reference in New Issue