diff --git a/core/modules/action/tests/src/Functional/ConfigurationTest.php b/core/modules/action/tests/src/Functional/ConfigurationTest.php index f429d519c01383326668d4c673b1ce20adcb05a4..a4b31c9a709384d2c10657781fa74a49369f8607 100644 --- a/core/modules/action/tests/src/Functional/ConfigurationTest.php +++ b/core/modules/action/tests/src/Functional/ConfigurationTest.php @@ -37,7 +37,7 @@ public function testActionConfiguration() { // Make a POST request to admin/config/system/actions. $edit = []; $edit['action'] = 'action_goto_action'; - $this->drupalPostForm('admin/config/system/actions', $edit, t('Create')); + $this->drupalPostForm('admin/config/system/actions', $edit, 'Create'); $this->assertSession()->statusCodeEquals(200); // Make a POST request to the individual action configuration page. @@ -46,7 +46,7 @@ public function testActionConfiguration() { $edit['label'] = $action_label; $edit['id'] = strtolower($action_label); $edit['url'] = 'admin'; - $this->drupalPostForm('admin/config/system/actions/add/action_goto_action', $edit, t('Save')); + $this->drupalPostForm('admin/config/system/actions/add/action_goto_action', $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); $action_id = $edit['id']; @@ -62,7 +62,7 @@ public function testActionConfiguration() { $new_action_label = $this->randomMachineName(); $edit['label'] = $new_action_label; $edit['url'] = 'admin'; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); // Make sure that the action updated properly. @@ -79,7 +79,7 @@ public function testActionConfiguration() { $this->clickLink(t('Delete')); $this->assertSession()->statusCodeEquals(200); $edit = []; - $this->drupalPostForm(NULL, $edit, t('Delete')); + $this->drupalPostForm(NULL, $edit, 'Delete'); $this->assertSession()->statusCodeEquals(200); // Make sure that the action was actually deleted. diff --git a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php index fea18180de959a290874db79490ea65b2e9f6856..556c313559dcd05e0348f0d8c8e931f3c07637a6 100644 --- a/core/modules/aggregator/tests/src/Functional/AddFeedTest.php +++ b/core/modules/aggregator/tests/src/Functional/AddFeedTest.php @@ -45,7 +45,7 @@ public function testAddFeed() { 'url[0][value]' => $feed->getUrl(), 'refresh' => '900', ]; - $this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); + $this->drupalPostForm('aggregator/sources/add', $edit, 'Save'); $this->assertRaw(t('A feed named %feed already exists. Enter a unique title.', ['%feed' => $feed->label()])); $this->assertRaw(t('A feed with this URL %url already exists. Enter a unique URL.', ['%url' => $feed->getUrl()])); diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php index 56a43c5801c34a0071ea24b3c6a1d89af4d9f157..bfb53e06d188ee99af4dab676d700567f6d2a73a 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php @@ -36,7 +36,7 @@ public function testSettingsPage() { 'aggregator_parser' => 'aggregator_test_parser', 'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor', ]; - $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, 'Save configuration'); $this->assertText('The configuration options have been saved.'); // Check that settings have the correct default value. @@ -50,7 +50,7 @@ public function testSettingsPage() { $edit = [ 'dummy_length' => 100, ]; - $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, 'Save configuration'); $this->assertText('The configuration options have been saved.'); $this->assertSession()->fieldValueEquals('dummy_length', 100); diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php index 761c89d9226100075526010a35fdf19157a7a21a..360aae5d0c33c61b2bf0206d4e10d26e75a97ab2 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php @@ -74,7 +74,7 @@ protected function setUp() { */ public function createFeed($feed_url = NULL, array $edit = []) { $edit = $this->getFeedEditArray($feed_url, $edit); - $this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); + $this->drupalPostForm('aggregator/sources/add', $edit, 'Save'); $this->assertText('The feed ' . Html::escape($edit['title[0][value]']) . ' has been added.', new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']])); // Verify that the creation message contains a link to a feed. @@ -92,7 +92,7 @@ public function createFeed($feed_url = NULL, array $edit = []) { * Feed object representing the feed. */ public function deleteFeed(FeedInterface $feed) { - $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/delete', [], t('Delete')); + $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/delete', [], 'Delete'); $this->assertRaw(t('The feed %title has been deleted.', ['%title' => $feed->label()])); } @@ -212,7 +212,7 @@ public function updateFeedItems(FeedInterface $feed, $expected_count = NULL) { * Feed object representing the feed. */ public function deleteFeedItems(FeedInterface $feed) { - $this->drupalPostForm('admin/config/services/aggregator/delete/' . $feed->id(), [], t('Delete items')); + $this->drupalPostForm('admin/config/services/aggregator/delete/' . $feed->id(), [], 'Delete items'); $this->assertRaw(t('The news items from %title have been deleted.', ['%title' => $feed->label()])); } @@ -376,7 +376,7 @@ public function createSampleNodes($count = 5) { $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); $edit['body[0][value]'] = $this->randomMachineName(); - $this->drupalPostForm('node/add/article', $edit, t('Save')); + $this->drupalPostForm('node/add/article', $edit, 'Save'); } } diff --git a/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php b/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php index 5311f2c1d300bac09145beb06a6bc2d7fdfb1aa3..45ec0768097e06e66b4f435932a17c7a4438e6e7 100644 --- a/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php +++ b/core/modules/aggregator/tests/src/Functional/FeedLanguageTest.php @@ -68,7 +68,7 @@ public function testFeedLanguage() { $edit['entity_types[aggregator_feed]'] = TRUE; $edit['settings[aggregator_feed][aggregator_feed][settings][language][language_alterable]'] = TRUE; - $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration'); /** @var \Drupal\aggregator\FeedInterface[] $feeds */ $feeds = []; diff --git a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php index e925431c0526f29034e95e5d58022320321ea94b..fc1b68b04b3a39d8ab44a2a4b60bfdb68eeafcab 100644 --- a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php +++ b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php @@ -61,7 +61,7 @@ public function validateImportFormFields() { $before = $count_query->execute(); $edit = []; - $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); + $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import'); $this->assertRaw(t('Either upload a file or enter a URL.')); $path = $this->getEmptyOpml(); @@ -69,11 +69,11 @@ public function validateImportFormFields() { 'files[upload]' => $path, 'remote' => file_create_url($path), ]; - $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); + $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import'); $this->assertRaw(t('Either upload a file or enter a URL.')); $edit = ['remote' => 'invalidUrl://empty']; - $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); + $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import'); $this->assertText('The URL invalidUrl://empty is not valid.', 'Error if the URL is invalid.'); $after = $count_query->execute(); @@ -88,11 +88,11 @@ protected function submitImportForm() { $before = $count_query->execute(); $form['files[upload]'] = $this->getInvalidOpml(); - $this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, t('Import')); + $this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, 'Import'); $this->assertText('No new feed has been added.', 'Attempting to upload invalid XML.'); $edit = ['remote' => file_create_url($this->getEmptyOpml())]; - $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); + $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import'); $this->assertText('No new feed has been added.', 'Attempting to load empty OPML from remote URL.'); $after = $count_query->execute(); @@ -109,7 +109,7 @@ protected function submitImportForm() { 'files[upload]' => $this->getValidOpml($feeds), 'refresh' => '900', ]; - $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); + $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, 'Import'); // Verify that a duplicate URL was identified. $this->assertRaw(t('A feed with the URL %url already exists.', ['%url' => $feeds[0]['url[0][value]']])); // Verify that a duplicate title was identified. diff --git a/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php index 7a8bf69d71b0b3a303e3e1f5d0e1e10d10b5263c..bcba76cc5d385884d7b9d2c0b5975011cdd07e98 100644 --- a/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php +++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php @@ -43,7 +43,7 @@ public function testUpdateFeedItem() { $this->drupalGet($edit['url[0][value]']); $this->assertSession()->statusCodeEquals(200); - $this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); + $this->drupalPostForm('aggregator/sources/add', $edit, 'Save'); $this->assertText('The feed ' . $edit['title[0][value]'] . ' has been added.', new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']])); // Verify that the creation message contains a link to a feed. diff --git a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php index 77e936e75d2357042ac84dec41e9a6dcade5b7cb..646a5923bef750b9e300292bbe1ab000275312ed 100644 --- a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php +++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php @@ -31,7 +31,7 @@ public function testUpdateFeed() { if (isset($feed->{$same_field}->value)) { $edit[$same_field] = $feed->{$same_field}->value; } - $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save')); + $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, 'Save'); $this->assertText('The feed ' . $edit['title[0][value]'] . ' has been updated.', new FormattableMarkup('The feed %name has been updated.', ['%name' => $edit['title[0][value]']])); // Verify that the creation message contains a link to a feed. diff --git a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php index 9a177f1c1077347b69a8859fa12cd271b7ca4738..fbc4ca70f6d6df10abcbc83a7ed0c4e7f9c756b8 100644 --- a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php +++ b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php @@ -38,7 +38,7 @@ public function testIPAddressValidation() { // Ban a valid IP address. $edit = []; $edit['ip'] = '1.2.3.3'; - $this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); + $this->drupalPostForm('admin/config/people/ban', $edit, 'Add'); $ip = $connection->select('ban_ip', 'bi')->fields('bi', ['iid'])->condition('ip', $edit['ip'])->execute()->fetchField(); $this->assertNotEmpty($ip, 'IP address found in database.'); $this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $edit['ip']])); @@ -46,30 +46,30 @@ public function testIPAddressValidation() { // Try to block an IP address that's already blocked. $edit = []; $edit['ip'] = '1.2.3.3'; - $this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); + $this->drupalPostForm('admin/config/people/ban', $edit, 'Add'); $this->assertText('This IP address is already banned.'); // Try to block a reserved IP address. $edit = []; $edit['ip'] = '255.255.255.255'; - $this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); + $this->drupalPostForm('admin/config/people/ban', $edit, 'Add'); $this->assertText('Enter a valid IP address.'); // Try to block a reserved IP address. $edit = []; $edit['ip'] = 'test.example.com'; - $this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); + $this->drupalPostForm('admin/config/people/ban', $edit, 'Add'); $this->assertText('Enter a valid IP address.'); // Submit an empty form. $edit = []; $edit['ip'] = ''; - $this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); + $this->drupalPostForm('admin/config/people/ban', $edit, 'Add'); $this->assertText('Enter a valid IP address.'); // Pass an IP address as a URL parameter and submit it. $submit_ip = '1.2.3.4'; - $this->drupalPostForm('admin/config/people/ban/' . $submit_ip, [], t('Add')); + $this->drupalPostForm('admin/config/people/ban/' . $submit_ip, [], 'Add'); $ip = $connection->select('ban_ip', 'bi')->fields('bi', ['iid'])->condition('ip', $submit_ip)->execute()->fetchField(); $this->assertNotEmpty($ip, 'IP address found in database'); $this->assertRaw(t('The IP address %ip has been banned.', ['%ip' => $submit_ip])); @@ -79,7 +79,7 @@ public function testIPAddressValidation() { // TODO: On some systems this test fails due to a bug/inconsistency in cURL. // $edit = array(); // $edit['ip'] = \Drupal::request()->getClientIP(); - // $this->drupalPostForm('admin/config/people/ban', $edit, t('Save')); + // $this->drupalPostForm('admin/config/people/ban', $edit, 'Save'); // $this->assertText('You may not ban your own IP address.'); // Test duplicate ip address are not present in the 'blocked_ips' table. diff --git a/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php b/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php index ce4b24bbfe7c8bd405d193a9ccfcd36b0271dcd8..4327b2b395035b56f7a4f5d14d32fa7f6c35f1b8 100644 --- a/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php +++ b/core/modules/block/tests/src/Functional/BlockAdminThemeTest.php @@ -42,7 +42,7 @@ public function testAdminTheme() { // Install admin theme and confirm that tab is accessible. \Drupal::service('theme_installer')->install(['bartik']); $edit['admin_theme'] = 'bartik'; - $this->drupalPostForm('admin/appearance', $edit, t('Save configuration')); + $this->drupalPostForm('admin/appearance', $edit, 'Save configuration'); $this->drupalGet('admin/structure/block/list/bartik'); $this->assertSession()->statusCodeEquals(200); } @@ -63,7 +63,7 @@ public function testSevenAdminTheme() { // Install admin theme and confirm that tab is accessible. \Drupal::service('theme_installer')->install(['seven']); $edit['admin_theme'] = 'seven'; - $this->drupalPostForm('admin/appearance', $edit, t('Save configuration')); + $this->drupalPostForm('admin/appearance', $edit, 'Save configuration'); // Define our block settings. $settings = [ diff --git a/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php b/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php index 3ee4aaa750fc7ce9f8ad8a900775bc3e258469d6..4e81acbac602f0b81133ae916bc57dceace72495 100644 --- a/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockFormInBlockTest.php @@ -47,7 +47,7 @@ public function testCachePerPage() { // Make sure that we're currently still on /test-page after submitting the // form. - $this->drupalPostForm(NULL, $form_values, t('Submit')); + $this->drupalPostForm(NULL, $form_values, 'Submit'); $this->assertSession()->addressEquals('test-page'); $this->assertText('Your email address is test@example.com'); @@ -59,7 +59,7 @@ public function testCachePerPage() { // Make sure that submitting the form didn't redirect us to the first page // we submitted the form from after submitting the form from // /test-render-title. - $this->drupalPostForm(NULL, $form_values, t('Submit')); + $this->drupalPostForm(NULL, $form_values, 'Submit'); $this->assertSession()->addressEquals('test-render-title'); $this->assertText('Your email address is test@example.com'); } diff --git a/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php b/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php index 4eef431b1698ea9212b9740557da634b2624fe94..6ab28c643d0174400af740a6158aa272f605a5f9 100644 --- a/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php +++ b/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php @@ -67,7 +67,7 @@ public function testBlockLinks() { // Create a menu in the default language. $edit['label'] = $this->randomMachineName(); $edit['id'] = mb_strtolower($edit['label']); - $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save')); + $this->drupalPostForm('admin/structure/menu/add', $edit, 'Save'); $this->assertText('Menu ' . $edit['label'] . ' has been added.'); // Check that the block is listed for all languages. diff --git a/core/modules/block/tests/src/Functional/BlockLanguageTest.php b/core/modules/block/tests/src/Functional/BlockLanguageTest.php index 30cf2943ef272612ae8c25cfd4dbb622e6a18b92..3c35765447baa6ced199afb0340de12316236e93 100644 --- a/core/modules/block/tests/src/Functional/BlockLanguageTest.php +++ b/core/modules/block/tests/src/Functional/BlockLanguageTest.php @@ -43,7 +43,7 @@ protected function setUp(): void { $edit = [ 'predefined_langcode' => 'fr', ]; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); $this->assertText('French', 'Language added successfully.'); } @@ -65,13 +65,13 @@ public function testLanguageBlockVisibility() { 'id' => strtolower($this->randomMachineName(8)), 'region' => 'sidebar_first', ]; - $this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, 'Save block'); // Change the default language. $edit = [ 'site_default_language' => 'fr', ]; - $this->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/language', $edit, 'Save configuration'); // Check that a page has a block. $this->drupalGet('en'); @@ -104,7 +104,7 @@ public function testLanguageBlockVisibilityLanguageDelete() { $this->assertEqual('fr', $visibility['language']['langcodes']['fr'], 'Language is set in the block configuration.'); // Delete the language. - $this->drupalPostForm('admin/config/regional/language/delete/fr', [], t('Delete')); + $this->drupalPostForm('admin/config/regional/language/delete/fr', [], 'Delete'); // Check that the language is no longer stored in the configuration after // it is deleted. @@ -134,7 +134,7 @@ public function testMultipleLanguageTypes() { 'language_content[enabled][language-url]' => TRUE, 'language_content[enabled][language-interface]' => FALSE, ]; - $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); + $this->drupalPostForm('admin/config/regional/language/detection', $edit, 'Save settings'); // Check if the visibility setting is available with a type setting. $default_theme = $this->config('system.theme')->get('default'); @@ -150,7 +150,7 @@ public function testMultipleLanguageTypes() { 'id' => $block_id, 'region' => 'sidebar_first', ]; - $this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme, $edit, 'Save block'); // Interface negotiation depends on request arguments. $this->drupalGet('node', ['query' => ['language' => 'en']]); @@ -174,7 +174,7 @@ public function testMultipleLanguageTypes() { $edit = [ 'visibility[language][context_mapping][language]' => '@language.current_language_context:language_content', ]; - $this->drupalPostForm('admin/structure/block/manage/' . $block_id, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/manage/' . $block_id, $edit, 'Save block'); // Content language negotiation does not depend on request arguments. // It will fall back on English (site default) and not display the block. diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php index 14d47a6a6cec186561d43053f8e19765e705b6c4..6fe63b52394fc5727c3c76159ebd35d4b344bb4b 100644 --- a/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -44,7 +44,7 @@ public function testBlockVisibility() { $this->drupalGet('admin/structure/block/add/' . $block_name . '/' . $default_theme); $this->assertSession()->checkboxChecked('edit-visibility-request-path-negate-0'); - $this->drupalPostForm(NULL, $edit, t('Save block')); + $this->drupalPostForm(NULL, $edit, 'Save block'); $this->assertText('The block configuration has been saved.', 'Block was saved'); $this->clickLink('Configure'); @@ -83,7 +83,7 @@ public function testBlockToggleVisibility() { $block_id = $edit['id']; // Set the block to be shown only to authenticated users. $edit['visibility[user_role][roles][' . RoleInterface::AUTHENTICATED_ID . ']'] = TRUE; - $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block'); $this->clickLink('Configure'); $this->assertSession()->checkboxChecked('edit-visibility-user-role-roles-authenticated'); @@ -119,7 +119,7 @@ public function testBlockVisibilityListedEmpty() { ]; // Set the block to be hidden on any user path, and to be shown only to // authenticated users. - $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block'); $this->assertText('The block configuration has been saved.', 'Block was saved'); $this->drupalGet('user'); @@ -170,7 +170,7 @@ public function testAddBlockFromLibraryWithWeight() { 'settings[label]' => $title, ]; // Create the block using the link parsed from the library page. - $this->drupalPostForm($this->getAbsoluteUrl($links[0]->getAttribute('href')), $edit, t('Save block')); + $this->drupalPostForm($this->getAbsoluteUrl($links[0]->getAttribute('href')), $edit, 'Save block'); // Ensure that the block was created with the expected weight. /** @var \Drupal\block\BlockInterface $block */ @@ -199,7 +199,7 @@ public function testBlock() { $block['region'] = 'header'; // Set block title to confirm that interface works and override any custom titles. - $this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], ['settings[label]' => $block['settings[label]'], 'settings[label_display]' => $block['settings[label_display]'], 'id' => $block['id'], 'region' => $block['region']], t('Save block')); + $this->drupalPostForm('admin/structure/block/add/' . $block['id'] . '/' . $block['theme'], ['settings[label]' => $block['settings[label]'], 'settings[label_display]' => $block['settings[label_display]'], 'id' => $block['id'], 'region' => $block['region']], 'Save block'); $this->assertText('The block configuration has been saved.', 'Block title set.'); // Check to see if the block was created by checking its configuration. $instance = Block::load($block['id']); @@ -230,7 +230,7 @@ public function testBlock() { $this->drupalGet('admin/structure/block/manage/' . $block['id']); $this->clickLink(t('Remove block')); $this->assertRaw(t('Are you sure you want to remove the block @name?', ['@name' => $block['settings[label]']])); - $this->drupalPostForm(NULL, [], t('Remove')); + $this->drupalPostForm(NULL, [], 'Remove'); $this->assertRaw(t('The block %name has been removed.', ['%name' => $block['settings[label]']])); // Test deleting a block via "Configure block" link. @@ -238,7 +238,7 @@ public function testBlock() { $this->drupalGet('admin/structure/block/manage/' . $block->id(), ['query' => ['destination' => 'admin']]); $this->clickLink(t('Remove block')); $this->assertRaw(t('Are you sure you want to remove the block @name?', ['@name' => $block->label()])); - $this->drupalPostForm(NULL, [], t('Remove')); + $this->drupalPostForm(NULL, [], 'Remove'); $this->assertRaw(t('The block %name has been removed.', ['%name' => $block->label()])); $this->assertSession()->addressEquals('admin'); $this->assertNoRaw($block->id()); @@ -259,7 +259,7 @@ public function testBlockThemeSelector() { $block['id'] = strtolower($this->randomMachineName()); $block['theme'] = $theme; $block['region'] = 'content'; - $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, 'Save block'); $this->assertText('The block configuration has been saved.'); $this->assertSession()->addressEquals('admin/structure/block/list/' . $theme . '?block-placement=' . Html::getClass($block['id'])); @@ -302,7 +302,7 @@ public function testHideBlockTitle() { 'region' => 'sidebar_first', 'settings[label]' => $title, ]; - $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, 'Save block'); $this->assertText('The block configuration has been saved.', 'Block was saved'); $this->drupalGet('user'); @@ -311,7 +311,7 @@ public function testHideBlockTitle() { $edit = [ 'settings[label_display]' => TRUE, ]; - $this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/manage/' . $id, $edit, 'Save block'); $this->assertText('The block configuration has been saved.', 'Block was saved'); $this->drupalGet('admin/structure/block/manage/' . $id); @@ -338,7 +338,7 @@ public function moveBlockToRegion(array $block, $region) { $block += ['theme' => $this->config('system.theme')->get('default')]; $edit = []; $edit['blocks[' . $block['id'] . '][region]'] = $region; - $this->drupalPostForm('admin/structure/block', $edit, t('Save blocks')); + $this->drupalPostForm('admin/structure/block', $edit, 'Save blocks'); // Confirm that the block was moved to the proper region. $this->assertText('The block settings have been updated.', new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region])); diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php index db5761d4a989a426a6e87854a33acba99caa4c04..47bd635922acdf5428679e12435d81974410333f 100644 --- a/core/modules/block/tests/src/Functional/BlockUiTest.php +++ b/core/modules/block/tests/src/Functional/BlockUiTest.php @@ -131,7 +131,7 @@ public function testBlockAdminUiPage() { // Change the test block's weight. $edit['blocks[' . $values['settings']['id'] . '][weight]'] = $values['test_weight']; } - $this->drupalPostForm('admin/structure/block', $edit, t('Save blocks')); + $this->drupalPostForm('admin/structure/block', $edit, 'Save blocks'); foreach ($this->blockValues as $values) { // Check if the region and weight settings changes have persisted. $this->assertTrue($this->assertSession()->optionExists('edit-blocks-' . $values['settings']['id'] . '-region', 'header')->isSelected()); @@ -326,11 +326,11 @@ public function testBlockPlacementIndicator() { $block['region'] = 'content'; // After adding a block, it will indicate which block was just added. - $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/system_powered_by_block', $block, 'Save block'); $this->assertSession()->addressEquals('admin/structure/block/list/classy?block-placement=' . Html::getClass($block['id'])); // Resaving the block page will remove the block placement indicator. - $this->drupalPostForm(NULL, [], t('Save blocks')); + $this->drupalPostForm(NULL, [], 'Save blocks'); $this->assertSession()->addressEquals('admin/structure/block/list/classy'); // Place another block and test the remove functionality works with the @@ -356,7 +356,7 @@ public function testBlockPlacementIndicator() { * Tests if validation errors are passed plugin form to the parent form. */ public function testBlockValidateErrors() { - $this->drupalPostForm('admin/structure/block/add/test_settings_validation/classy', ['region' => 'content', 'settings[digits]' => 'abc'], t('Save block')); + $this->drupalPostForm('admin/structure/block/add/test_settings_validation/classy', ['region' => 'content', 'settings[digits]' => 'abc'], 'Save block'); $arguments = [':message' => 'Only digits are allowed']; $pattern = '//div[contains(@class,"messages messages--error")]/div[contains(text()[2],:message)]'; diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php index 089f9005e8d61713a6fcf76f0b650c86d628bd8d..1e65d2bee4adf2c2690c7c16fdb1002d987127f9 100644 --- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php +++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -77,7 +77,7 @@ public function testBlockCategory() { $edit['description'] = $this->randomString(); $edit['block[create]'] = TRUE; $edit['block[style][row_plugin]'] = 'fields'; - $this->drupalPostForm('admin/structure/views/add', $edit, t('Save and edit')); + $this->drupalPostForm('admin/structure/views/add', $edit, 'Save and edit'); $pattern = '//tr[.//td[text()=:category] and .//td//a[contains(@href, :href)]]'; @@ -96,7 +96,7 @@ public function testBlockCategory() { $this->assertTrue(!empty($elements), 'The test block appears in the category for its base table.'); // Duplicate the block before changing the category. - $this->drupalPostForm('admin/structure/views/view/' . $edit['id'] . '/edit/block_1', [], t('Duplicate @display_title', ['@display_title' => 'Block'])); + $this->drupalPostForm('admin/structure/views/view/' . $edit['id'] . '/edit/block_1', [], 'Duplicate Block'); $this->assertSession()->addressEquals('admin/structure/views/view/' . $edit['id'] . '/edit/block_2'); // Change the block category to a random string. @@ -105,13 +105,13 @@ public function testBlockCategory() { $this->assertTrue(!empty($link)); $this->clickLink(t('Lists (Views)')); $category = $this->randomString(); - $this->drupalPostForm(NULL, ['block_category' => $category], t('Apply')); + $this->drupalPostForm(NULL, ['block_category' => $category], 'Apply'); // Duplicate the block after changing the category. - $this->drupalPostForm(NULL, [], t('Duplicate @display_title', ['@display_title' => 'Block'])); + $this->drupalPostForm(NULL, [], 'Duplicate Block'); $this->assertSession()->addressEquals('admin/structure/views/view/' . $edit['id'] . '/edit/block_3'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); // Test that the blocks are listed under the correct categories. $arguments[':category'] = $category; @@ -209,7 +209,7 @@ public function testViewsBlockForm() { // Save the block. $edit = ['region' => 'content']; - $this->drupalPostForm(NULL, $edit, t('Save block')); + $this->drupalPostForm(NULL, $edit, 'Save block'); $storage = $this->container->get('entity_type.manager')->getStorage('block'); $block = $storage->load('views_block__test_view_block_block_1'); // This will only return a result if our new block has been created with the @@ -218,7 +218,7 @@ public function testViewsBlockForm() { for ($i = 2; $i <= 3; $i++) { // Place the same block again and make sure we have a new ID. - $this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, 'Save block'); $block = $storage->load('views_block__test_view_block_block_1_' . $i); // This will only return a result if our new block has been created with the // expected machine name. @@ -230,14 +230,14 @@ public function testViewsBlockForm() { $edit = ['region' => 'content']; $edit['settings[override][items_per_page]'] = 10; - $this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, 'Save block'); $block = $storage->load('views_block__test_view_block_block_1_4'); $config = $block->getPlugin()->getConfiguration(); $this->assertEqual(10, $config['items_per_page'], "'Items per page' is properly saved."); $edit['settings[override][items_per_page]'] = 5; - $this->drupalPostForm('admin/structure/block/manage/views_block__test_view_block_block_1_4', $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/manage/views_block__test_view_block_block_1_4', $edit, 'Save block'); $block = $storage->load('views_block__test_view_block_block_1_4'); @@ -248,7 +248,7 @@ public function testViewsBlockForm() { $edit = ['region' => 'content']; $edit['settings[views_label_checkbox]'] = 1; $edit['settings[views_label]'] = 'Custom title'; - $this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, t('Save block')); + $this->drupalPostForm('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme, $edit, 'Save block'); $block = $storage->load('views_block__test_view_block_block_1_5'); $config = $block->getPlugin()->getConfiguration(); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php index 1678f2c47121b4c480bfa54c96af65a806813c88..7b6dc7df189d563b2ed5dbdd07bbea662fdca49d 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php @@ -56,7 +56,7 @@ public function testBlockContentCreation() { $edit = []; $edit['info[0][value]'] = 'Test Block'; $edit['body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm('block/add/basic', $edit, t('Save')); + $this->drupalPostForm('block/add/basic', $edit, 'Save'); // Check that the Basic block has been created. $this->assertRaw(new FormattableMarkup('@block %name has been created.', [ @@ -76,7 +76,7 @@ public function testBlockContentCreation() { // Check that attempting to create another block with the same value for // 'info' returns an error. - $this->drupalPostForm('block/add/basic', $edit, t('Save')); + $this->drupalPostForm('block/add/basic', $edit, 'Save'); // Check that the Basic block has been created. $this->assertRaw(new FormattableMarkup('A custom block with block description %value already exists.', [ @@ -96,7 +96,7 @@ public function testBlockContentCreationMultipleViewModes() { 'id' => 'test_view_mode', 'label' => 'Test View Mode', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('Saved the %label view mode.', ['%label' => $edit['label']])); $this->drupalLogin($this->adminUser); @@ -105,7 +105,7 @@ public function testBlockContentCreationMultipleViewModes() { $edit = []; $edit['info[0][value]'] = 'Test Block'; $edit['body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm('block/add/basic', $edit, t('Save')); + $this->drupalPostForm('block/add/basic', $edit, 'Save'); // Check that the Basic block has been created. $this->assertRaw(new FormattableMarkup('@block %name has been created.', [ @@ -114,7 +114,7 @@ public function testBlockContentCreationMultipleViewModes() { ])); // Save our block permanently - $this->drupalPostForm(NULL, ['region' => 'content'], t('Save block')); + $this->drupalPostForm(NULL, ['region' => 'content'], 'Save block'); // Set test_view_mode as a custom display to be available on the list. $this->drupalGet('admin/structure/block/block-content'); @@ -124,7 +124,7 @@ public function testBlockContentCreationMultipleViewModes() { $custom_view_mode = [ 'display_modes_custom[test_view_mode]' => 1, ]; - $this->drupalPostForm(NULL, $custom_view_mode, t('Save')); + $this->drupalPostForm(NULL, $custom_view_mode, 'Save'); // Go to the configure page and change the view mode. $this->drupalGet('admin/structure/block/manage/testblock'); @@ -136,7 +136,7 @@ public function testBlockContentCreationMultipleViewModes() { $this->assertSession()->optionExists('edit-settings-view-mode', 'test_view_mode'); $view_mode['settings[view_mode]'] = 'test_view_mode'; - $this->drupalPostForm(NULL, $view_mode, t('Save block')); + $this->drupalPostForm(NULL, $view_mode, 'Save block'); // Check that the view mode setting is shown because more than one exists. $this->drupalGet('admin/structure/block/manage/testblock'); @@ -145,7 +145,7 @@ public function testBlockContentCreationMultipleViewModes() { // Change the view mode. $view_mode['region'] = 'content'; $view_mode['settings[view_mode]'] = 'test_view_mode'; - $this->drupalPostForm(NULL, $view_mode, t('Save block')); + $this->drupalPostForm(NULL, $view_mode, 'Save block'); // Go to the configure page and verify the view mode has changed. $this->drupalGet('admin/structure/block/manage/testblock'); @@ -160,7 +160,7 @@ public function testBlockContentCreationMultipleViewModes() { // Check that attempting to create another block with the same value for // 'info' returns an error. - $this->drupalPostForm('block/add/basic', $edit, t('Save')); + $this->drupalPostForm('block/add/basic', $edit, 'Save'); // Check that the Basic block has been created. $this->assertRaw(new FormattableMarkup('A custom block with block description %value already exists.', [ @@ -180,7 +180,7 @@ public function testDefaultBlockContentCreation() { $edit['info[0][value]'] = $this->randomMachineName(8); $edit['body[0][value]'] = $this->randomMachineName(16); // Don't pass the custom block type in the url so the default is forced. - $this->drupalPostForm('block/add', $edit, t('Save')); + $this->drupalPostForm('block/add', $edit, 'Save'); // Check that the block has been created and that it is a basic block. $this->assertRaw(new FormattableMarkup('@block %name has been created.', [ @@ -229,7 +229,7 @@ public function testBlockDelete() { $edit['info[0][value]'] = $this->randomMachineName(8); $body = $this->randomMachineName(16); $edit['body[0][value]'] = $body; - $this->drupalPostForm('block/add/basic', $edit, t('Save')); + $this->drupalPostForm('block/add/basic', $edit, 'Save'); // Place the block. $instance = [ @@ -239,7 +239,7 @@ public function testBlockDelete() { ]; $block = BlockContent::load(1); $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default'); - $this->drupalPostForm($url, $instance, t('Save block')); + $this->drupalPostForm($url, $instance, 'Save block'); $block = BlockContent::load(1); @@ -262,7 +262,7 @@ public function testBlockDelete() { $edit2['info[0][value]'] = $this->randomMachineName(8); $body2 = $this->randomMachineName(16); $edit2['body[0][value]'] = $body2; - $this->drupalPostForm('block/add/basic', $edit2, t('Save')); + $this->drupalPostForm('block/add/basic', $edit2, 'Save'); $this->assertNoRaw('Error message'); @@ -272,7 +272,7 @@ public function testBlockDelete() { $edit3['info[0][value]'] = $this->randomMachineName(8); $body = $this->randomMachineName(16); $edit3['body[0][value]'] = $body; - $this->drupalPostForm('block/add/basic', $edit3, t('Save')); + $this->drupalPostForm('block/add/basic', $edit3, 'Save'); // Show the delete confirm form. $this->drupalGet('block/3/delete'); @@ -293,7 +293,7 @@ public function testConfigDependencies() { ]; $block = BlockContent::load(1); $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default'); - $this->drupalPostForm($url, $instance, t('Save block')); + $this->drupalPostForm($url, $instance, 'Save block'); $dependencies = \Drupal::service('config.manager')->findConfigEntityDependentsAsEntities('content', [$block->getConfigDependencyName()]); $block_placement = reset($dependencies); diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php index 09fdd78303bd41ba884dfc9ab49a2150c019b845..0593624c2664bc5914b26b94fb51d540eec7466c 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php @@ -64,7 +64,7 @@ public function testListing() { $edit = []; $edit['info[0][value]'] = $label; $edit['body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Confirm that once the user returns to the listing, the text of the label // (versus elsewhere on the page). @@ -90,7 +90,7 @@ public function testListing() { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals("Edit custom block $label | Drupal"); $edit = ['info[0][value]' => $new_label]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); } else { $this->fail('Did not find Albatross block in the database.'); @@ -102,11 +102,10 @@ public function testListing() { // Delete the added entity using the operations link. $this->assertSession()->linkByHrefExists('block/' . $block->id() . '/delete'); - $delete_text = t('Delete'); - $this->clickLink($delete_text); + $this->clickLink('Delete'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals("Are you sure you want to delete the custom block $new_label? | Drupal"); - $this->drupalPostForm(NULL, [], $delete_text); + $this->drupalPostForm(NULL, [], 'Delete'); // Verify that the text of the label and machine name does not appear in // the list (though it may appear elsewhere on the page). diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php index 638ce2dec9f4621937542c6abc8e3575f207218f..7bcc15dd29b98734b9eb57ef43a1cf4896806405 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php @@ -76,7 +76,7 @@ public function testListing() { $edit = []; $edit['info[0][value]'] = $label; $edit['body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Confirm that once the user returns to the listing, the text of the label // (versus elsewhere on the page). @@ -102,7 +102,7 @@ public function testListing() { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals("Edit custom block $label | Drupal"); $edit = ['info[0][value]' => $new_label]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); } else { $this->fail('Did not find Albatross block in the database.'); @@ -114,11 +114,10 @@ public function testListing() { // Delete the added entity using the operations link. $this->assertSession()->linkByHrefExists('block/' . $block->id() . '/delete'); - $delete_text = t('Delete'); - $this->clickLink($delete_text); + $this->clickLink('Delete'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals("Are you sure you want to delete the custom block $new_label? | Drupal"); - $this->drupalPostForm(NULL, [], $delete_text); + $this->drupalPostForm(NULL, [], 'Delete'); // Verify that the text of the label and machine name does not appear in // the list (though it may appear elsewhere on the page). diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index b8cba2cf8aacd5df2e939f8ea5cd47a2b4c43ecc..baa75dc0da81af0367dc6ed48aeb4b9b76741956 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -68,7 +68,7 @@ public function testBlockContentTypeCreation() { 'id' => 'foo', 'label' => 'title for foo', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $block_type = BlockContentType::load('foo'); $this->assertInstanceOf(BlockContentType::class, $block_type); @@ -121,7 +121,7 @@ public function testBlockContentTypeEditing() { ]; $this->drupalGet('admin/structure/block/block-content/manage/basic'); $this->assertSession()->titleEquals('Edit basic custom block type | Drupal'); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $front_page_path = Url::fromRoute('')->toString(); $this->assertBreadcrumb('admin/structure/block/block-content/manage/basic/fields', [ $front_page_path => 'Home', @@ -138,9 +138,9 @@ public function testBlockContentTypeEditing() { $this->assertSession()->addressEquals(Url::fromRoute('block_content.add_form', ['block_content_type' => 'basic'])); // Remove the body field. - $this->drupalPostForm('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete', [], t('Delete')); + $this->drupalPostForm('admin/structure/block/block-content/manage/basic/fields/block_content.basic.body/delete', [], 'Delete'); // Resave the settings for this type. - $this->drupalPostForm('admin/structure/block/block-content/manage/basic', [], t('Save')); + $this->drupalPostForm('admin/structure/block/block-content/manage/basic', [], 'Save'); // Check that the body field doesn't exist. $this->drupalGet('block/add/basic'); $this->assertEmpty($this->cssSelect('#edit-body-0-value'), 'Body field was not found.'); @@ -221,12 +221,12 @@ public function testsBlockContentAddTypes() { } // Create a new block. $edit = ['info[0][value]' => $this->randomMachineName(8)]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $blocks = $storage->loadByProperties(['info' => $edit['info[0][value]']]); if (!empty($blocks)) { $block = reset($blocks); $this->assertSession()->addressEquals(Url::fromRoute('block.admin_add', ['plugin_id' => 'block_content:' . $block->uuid(), 'theme' => $theme])); - $this->drupalPostForm(NULL, ['region' => 'content'], t('Save block')); + $this->drupalPostForm(NULL, ['region' => 'content'], 'Save block'); $this->assertSession()->addressEquals(Url::fromRoute('block.admin_display_theme', ['theme' => $theme], ['query' => ['block-placement' => Html::getClass($edit['info[0][value]'])]])); } else { @@ -241,7 +241,7 @@ public function testsBlockContentAddTypes() { $this->clickLink(t('Add custom block')); $this->clickLink('foo'); $edit = ['info[0][value]' => $this->randomMachineName(8)]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $blocks = $storage->loadByProperties(['info' => $edit['info[0][value]']]); if (!empty($blocks)) { $this->assertSession()->addressEquals(Url::fromRoute('entity.block_content.collection')); diff --git a/core/modules/block_content/tests/src/Functional/PageEditTest.php b/core/modules/block_content/tests/src/Functional/PageEditTest.php index a15a68ed97b225a39c124a1da5825fbfba204e64..bc0aad87fab38d2acb4029f13218279b6a1df82b 100644 --- a/core/modules/block_content/tests/src/Functional/PageEditTest.php +++ b/core/modules/block_content/tests/src/Functional/PageEditTest.php @@ -34,7 +34,7 @@ public function testPageEdit() { $edit = []; $edit['info[0][value]'] = mb_strtolower($this->randomMachineName(8)); $edit[$body_key] = $this->randomMachineName(16); - $this->drupalPostForm('block/add/basic', $edit, t('Save')); + $this->drupalPostForm('block/add/basic', $edit, 'Save'); // Check that the block exists in the database. $blocks = \Drupal::entityQuery('block_content')->condition('info', $edit['info[0][value]'])->execute(); @@ -51,7 +51,7 @@ public function testPageEdit() { $edit[$title_key] = $this->randomMachineName(8); $edit[$body_key] = $this->randomMachineName(16); // Stay on the current page, without reloading. - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Edit the same block, creating a new revision. $this->drupalGet("block/" . $block->id()); @@ -59,7 +59,7 @@ public function testPageEdit() { $edit['info[0][value]'] = $this->randomMachineName(8); $edit[$body_key] = $this->randomMachineName(16); $edit['revision'] = TRUE; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Ensure that the block revision has been created. \Drupal::entityTypeManager()->getStorage('block_content')->resetCache([$block->id()]); diff --git a/core/modules/block_content/tests/src/Functional/Views/BlockContentWizardTest.php b/core/modules/block_content/tests/src/Functional/Views/BlockContentWizardTest.php index 7e8f03727ed65151056029ad0b4cf560b8c25313..4c2fbcabc56d6394b0398a40659ef6b36293bebe 100644 --- a/core/modules/block_content/tests/src/Functional/Views/BlockContentWizardTest.php +++ b/core/modules/block_content/tests/src/Functional/Views/BlockContentWizardTest.php @@ -40,7 +40,7 @@ public function testViewAddBlockContent() { $view['description'] = $this->randomMachineName(16); $view['page[create]'] = FALSE; $view['show[wizard_key]'] = 'block_content'; - $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit')); + $this->drupalPostForm('admin/structure/views/add', $view, 'Save and edit'); $view_storage_controller = $this->container->get('entity_type.manager')->getStorage('view'); /** @var \Drupal\views\Entity\View $view */ diff --git a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php index ee2bfedb4703df17f0d2a98e04e2099bf6863b5e..0ac6adc115fffbe998dba9045079d4b76f4bcc7a 100644 --- a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php +++ b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php @@ -134,16 +134,16 @@ protected function createBookNode($book_nid, $parent = NULL) { $edit['book[bid]'] = $book_nid; if ($parent !== NULL) { - $this->drupalPostForm('node/add/book', $edit, t('Change book (update list of parents)')); + $this->drupalPostForm('node/add/book', $edit, 'Change book (update list of parents)'); $edit['book[pid]'] = $parent; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Make sure the parent was flagged as having children. $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent); $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children'); } else { - $this->drupalPostForm('node/add/book', $edit, t('Save')); + $this->drupalPostForm('node/add/book', $edit, 'Save'); } // Check to make sure the book node was created. diff --git a/core/modules/book/tests/src/Functional/BookContentModerationTest.php b/core/modules/book/tests/src/Functional/BookContentModerationTest.php index 167e2363401a11e40000545ba2e8d60dfa9637cc..b792ab9e7bc9c7228febfa2683be626edae2912e 100644 --- a/core/modules/book/tests/src/Functional/BookContentModerationTest.php +++ b/core/modules/book/tests/src/Functional/BookContentModerationTest.php @@ -82,33 +82,33 @@ public function testBookWithPendingRevisions() { 'title[0][value]' => $this->randomString(), 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm('node/add/book', $edit, t('Save')); + $this->drupalPostForm('node/add/book', $edit, 'Save'); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $this->assertNotEmpty($node); $edit = [ 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); $this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.'); // Create a book draft with no changes, then publish it. $edit = [ 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, 'Save'); $this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.'); $edit = [ 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $book_1->id() . '/edit', $edit, 'Save'); // Try to move Node 2 to a different parent. $edit = [ 'book[pid]' => $book_1_nodes[3]->id(), 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save'); $this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.'); @@ -122,7 +122,7 @@ public function testBookWithPendingRevisions() { 'book[bid]' => $book_2->id(), 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save'); $this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.'); @@ -136,7 +136,7 @@ public function testBookWithPendingRevisions() { 'book[weight]' => 2, 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save'); $this->assertSession()->pageTextContains('You can only change the book outline for the published version of this content.'); @@ -150,7 +150,7 @@ public function testBookWithPendingRevisions() { $edit = [ 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $book_1_nodes[1]->id() . '/edit', $edit, 'Save'); $this->assertSession()->pageTextNotContains('You can only change the book outline for the published version of this content.'); } diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php index 7daf14c0a897e94476d07bef7de463a7aa48748d..6e97868a3bde6e565c3ff4e9d3a868d52913f769 100644 --- a/core/modules/book/tests/src/Functional/BookTest.php +++ b/core/modules/book/tests/src/Functional/BookTest.php @@ -161,7 +161,7 @@ public function testEmptyBook() { // Log in as a user with access to the book outline and save the form. $this->drupalLogin($this->adminUser); - $this->drupalPostForm('admin/structure/book/' . $book->id(), [], t('Save book pages')); + $this->drupalPostForm('admin/structure/book/' . $book->id(), [], 'Save book pages'); $this->assertText('Updated book ' . $book->label() . '.'); } @@ -214,7 +214,7 @@ public function testBook() { $other_book = $this->createBookNode('new'); $node = $this->createBookNode($book->id()); $edit = ['book[bid]' => $other_book->id()]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); $this->drupalLogout(); $this->drupalLogin($this->webUser); @@ -297,7 +297,7 @@ public function testBookNavigationBlock() { // Give anonymous users the permission 'node test view'. $edit = []; $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE; - $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions')); + $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, 'Save permissions'); $this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users."); // Test correct display of the block. @@ -395,7 +395,7 @@ public function testNavigationBlockOnAccessModuleInstalled() { // Give anonymous users the permission 'node test view'. $edit = []; $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE; - $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions')); + $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, 'Save permissions'); $this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users."); // Create a book. @@ -430,7 +430,7 @@ public function testBookDelete() { $this->assertSession()->statusCodeEquals(403); // Ensure that a child book node can be deleted. - $this->drupalPostForm('node/' . $nodes[4]->id() . '/outline/remove', $edit, t('Remove')); + $this->drupalPostForm('node/' . $nodes[4]->id() . '/outline/remove', $edit, 'Remove'); $node_storage->resetCache([$nodes[4]->id()]); $node4 = $node_storage->load($nodes[4]->id()); $this->assertTrue(empty($node4->book), 'Deleting child book node properly allowed.'); @@ -442,7 +442,7 @@ public function testBookDelete() { // Delete all child book nodes and retest top-level node deletion. $node_storage->delete($nodes); - $this->drupalPostForm('node/' . $this->book->id() . '/outline/remove', $edit, t('Remove')); + $this->drupalPostForm('node/' . $this->book->id() . '/outline/remove', $edit, 'Remove'); $node_storage->resetCache([$this->book->id()]); $node = $node_storage->load($this->book->id()); $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.'); @@ -453,7 +453,7 @@ public function testBookDelete() { $this->drupalGet($this->book->toUrl('delete-form')); $this->assertRaw(t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', ['%title' => $this->book->label()])); // Delete parent, and visit a child page. - $this->drupalPostForm($this->book->toUrl('delete-form'), [], t('Delete')); + $this->drupalPostForm($this->book->toUrl('delete-form'), [], 'Delete'); $this->drupalGet($nodes[0]->toUrl()); $this->assertSession()->statusCodeEquals(200); $this->assertText($nodes[0]->label()); @@ -487,7 +487,7 @@ public function testBookOutline() { $edit = []; $edit['book[bid]'] = '1'; - $this->drupalPostForm('node/' . $empty_book->id() . '/outline', $edit, t('Add to book outline')); + $this->drupalPostForm('node/' . $empty_book->id() . '/outline', $edit, 'Add to book outline'); $node = \Drupal::entityTypeManager()->getStorage('node')->load($empty_book->id()); // Test the book array. $this->assertEqual($node->book['nid'], $empty_book->id()); @@ -510,7 +510,7 @@ public function testBookOutline() { $node = $this->drupalCreateNode(['type' => 'book']); $edit = []; $edit['book[bid]'] = $node->id(); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); $node = \Drupal::entityTypeManager()->getStorage('node')->load($node->id()); // Test the book array. @@ -705,7 +705,7 @@ public function testBookNavigationBlockOnUnpublishedBook() { // Unpublish book node. $edit = ['status[value]' => FALSE]; - $this->drupalPostForm('node/' . $this->book->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $this->book->id() . '/edit', $edit, 'Save'); // Test node page. $this->drupalGet('node/' . $this->book->id()); diff --git a/core/modules/book/tests/src/Functional/BookTestTrait.php b/core/modules/book/tests/src/Functional/BookTestTrait.php index 00a9e410432a3f5022fd6739f032339605ba8271..ba56f12d63e3e4f88a9015333693aa31f0b6a520 100644 --- a/core/modules/book/tests/src/Functional/BookTestTrait.php +++ b/core/modules/book/tests/src/Functional/BookTestTrait.php @@ -191,16 +191,16 @@ public function createBookNode($book_nid, $parent = NULL, $edit = []) { $edit['book[bid]'] = $book_nid; if ($parent !== NULL) { - $this->drupalPostForm('node/add/book', $edit, t('Change book (update list of parents)')); + $this->drupalPostForm('node/add/book', $edit, 'Change book (update list of parents)'); $edit['book[pid]'] = $parent; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Make sure the parent was flagged as having children. $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent); $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children'); } else { - $this->drupalPostForm('node/add/book', $edit, t('Save')); + $this->drupalPostForm('node/add/book', $edit, 'Save'); } // Check to make sure the book node was created. diff --git a/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php b/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php index b6347b646c651d8f7a955385b5168caf27b35270..5f301960923092848d16434a611f938d361e608e 100644 --- a/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php +++ b/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php @@ -121,16 +121,16 @@ protected function createBookNode($book_nid, $parent = NULL) { $edit['book[bid]'] = $book_nid; if ($parent !== NULL) { - $this->drupalPostForm('node/add/book', $edit, t('Change book (update list of parents)')); + $this->drupalPostForm('node/add/book', $edit, 'Change book (update list of parents)'); $edit['book[pid]'] = $parent; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Make sure the parent was flagged as having children. $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent); $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children'); } else { - $this->drupalPostForm('node/add/book', $edit, t('Save')); + $this->drupalPostForm('node/add/book', $edit, 'Save'); } // Check to make sure the book node was created. diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php index 4d4094692fc64d5a456ccb9808c63c9153aefe9f..645aa26007b75c7d58a0c615dd9cd7115581ae24 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php @@ -78,7 +78,7 @@ public function testExistingFormat() { $edit = [ 'editor[editor]' => 'ckeditor', ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $this->assertRaw(t('You must configure the selected text editor.')); // Ensure the CKEditor editor returns the expected default settings. @@ -144,7 +144,7 @@ public function testExistingFormat() { $this->assertCount(1, $styles_textarea, 'The "styles" textarea exists.'); // Submit the form to save the selection of CKEditor as the chosen editor. - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); // Ensure an Editor object exists now, with the proper settings. $expected_settings = $expected_default_settings; @@ -158,7 +158,7 @@ public function testExistingFormat() { $edit = [ 'editor[settings][plugins][stylescombo][styles]' => "h1.title|Title\np.callout|Callout\n\n", ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\n\n"; $editor = Editor::load('filtered_html'); $this->assertInstanceOf(Editor::class, $editor); @@ -175,7 +175,7 @@ public function testExistingFormat() { $edit = [ 'editor[settings][toolbar][button_groups]' => json_encode($expected_settings['toolbar']['rows']), ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $editor = Editor::load('filtered_html'); $this->assertInstanceOf(Editor::class, $editor); $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); @@ -213,7 +213,7 @@ public function testExistingFormat() { $edit = [ 'editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]' => '1', ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $this->drupalGet('admin/config/content/formats/manage/filtered_html'); $ultra_llama_mode_checkbox = $this->xpath('//input[@type="checkbox" and @name="editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]" and @checked="checked"]'); $this->assertCount(1, $ultra_llama_mode_checkbox, 'The "Ultra llama mode" checkbox exists and is checked.'); @@ -289,7 +289,7 @@ public function testNewFormat() { // Submit the form to create both a new text format and an associated text // editor. - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); // Ensure a FilterFormat object exists now. $filter_format = FilterFormat::load('amazing_format'); diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboAdminTest.php index 0afbd741bedf55d245de3cceec7df826cfc24861..a2dc630dc889a7f9ab8e891c265751a9e748c3d5 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboAdminTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorStylesComboAdminTest.php @@ -82,7 +82,7 @@ public function testExistingFormat() { $edit = [ 'editor[settings][plugins][stylescombo][styles]' => "h1.title|Title\np.callout|Callout\ndrupal-entity.has-dashes|Allowing Dashes\n\n", ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\ndrupal-entity.has-dashes|Allowing Dashes\n\n"; $editor = Editor::load($this->format); $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); @@ -94,7 +94,7 @@ public function testExistingFormat() { $edit = [ 'editor[settings][plugins][stylescombo][styles]' => "h1.title|Title\np.callout|Title\n\n", ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $this->assertRaw(t('Each style must have a unique label.')); $editor = Editor::load($this->format); $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); diff --git a/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php index 1ce136a905df7681489831dcdef4c22e8460d91f..dd3ef37b8e2607b89d7b7c4f0f79382037644857 100644 --- a/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php @@ -62,10 +62,10 @@ public function testImageButtonDisplay() { // Install the Arabic language (which is RTL) and configure as the default. $edit = []; $edit['predefined_langcode'] = 'ar'; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); $edit = ['site_default_language' => 'ar']; - $this->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/language', $edit, 'Save configuration'); // Once the default language is changed, go to the tested text format // configuration page. $this->drupalGet('admin/config/content/formats/manage/full_html'); diff --git a/core/modules/color/tests/src/Functional/ColorConfigSchemaTest.php b/core/modules/color/tests/src/Functional/ColorConfigSchemaTest.php index 8249604e37f519d0d5f5625923f48141ab8ba7db..8d7b2bb3ce5461a69b5ba9d73674db7fcc0f1663 100644 --- a/core/modules/color/tests/src/Functional/ColorConfigSchemaTest.php +++ b/core/modules/color/tests/src/Functional/ColorConfigSchemaTest.php @@ -49,7 +49,7 @@ public function testValidColorConfigSchema() { $settings_path = 'admin/appearance/settings/bartik'; $edit['scheme'] = ''; $edit['palette[bg]'] = '#123456'; - $this->drupalPostForm($settings_path, $edit, t('Save configuration')); + $this->drupalPostForm($settings_path, $edit, 'Save configuration'); } } diff --git a/core/modules/color/tests/src/Functional/ColorTest.php b/core/modules/color/tests/src/Functional/ColorTest.php index 57f8ba73a8a012fcd1e360518563bb962aee1f0f..4b9fcaa4fa473a5ef107a2565dee39b61c5e127a 100644 --- a/core/modules/color/tests/src/Functional/ColorTest.php +++ b/core/modules/color/tests/src/Functional/ColorTest.php @@ -116,7 +116,7 @@ public function _testColor($theme, $test_values) { $this->assertSession()->pageTextContainsOnce('Color set'); $edit['scheme'] = ''; $edit[$test_values['palette_input']] = '#123456'; - $this->drupalPostForm($settings_path, $edit, t('Save configuration')); + $this->drupalPostForm($settings_path, $edit, 'Save configuration'); $this->drupalGet(''); $stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets'); @@ -130,7 +130,7 @@ public function _testColor($theme, $test_values) { $this->drupalGet($settings_path); $this->assertSession()->statusCodeEquals(200); $edit['scheme'] = $test_values['scheme']; - $this->drupalPostForm($settings_path, $edit, t('Save configuration')); + $this->drupalPostForm($settings_path, $edit, 'Save configuration'); $this->drupalGet(''); $stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets'); @@ -168,7 +168,7 @@ public function testValidColor() { foreach ($this->colorTests as $color => $is_valid) { $edit['palette[bg]'] = $color; - $this->drupalPostForm($settings_path, $edit, t('Save configuration')); + $this->drupalPostForm($settings_path, $edit, 'Save configuration'); if ($is_valid) { $this->assertText('The configuration options have been saved.'); @@ -188,7 +188,7 @@ public function testLogoSettingOverride() { 'default_logo' => FALSE, 'logo_path' => 'core/misc/druplicon.png', ]; - $this->drupalPostForm('admin/appearance/settings', $edit, t('Save configuration')); + $this->drupalPostForm('admin/appearance/settings', $edit, 'Save configuration'); // Ensure that the overridden logo is present in Bartik, which is colorable. $this->drupalGet('admin/appearance/settings/bartik'); @@ -216,7 +216,7 @@ public function testOverrideAndResetScheme() { // Log in and set the color scheme to 'slate'. $this->drupalLogin($this->bigUser); $edit['scheme'] = 'slate'; - $this->drupalPostForm($settings_path, $edit, t('Save configuration')); + $this->drupalPostForm($settings_path, $edit, 'Save configuration'); // Visit the homepage and ensure color changes. $this->drupalLogout(); @@ -229,7 +229,7 @@ public function testOverrideAndResetScheme() { // Log in and set the color scheme back to default (delete config). $this->drupalLogin($this->bigUser); $edit['scheme'] = 'default'; - $this->drupalPostForm($settings_path, $edit, t('Save configuration')); + $this->drupalPostForm($settings_path, $edit, 'Save configuration'); // Log out and ensure there is no color and we have the original logo. $this->drupalLogout(); diff --git a/core/modules/comment/tests/src/Functional/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/CommentAdminTest.php index 6807c551a2463c469214b5e2535daca2207748b4..f1be260962db71a3774929a6bb927062f1629c96 100644 --- a/core/modules/comment/tests/src/Functional/CommentAdminTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAdminTest.php @@ -88,7 +88,7 @@ public function testApprovalAdminInterface() { "comments[{$comments[0]->id()}]" => 1, "comments[{$comments[1]->id()}]" => 1, ]; - $this->drupalPostForm(NULL, $edit, t('Update')); + $this->drupalPostForm(NULL, $edit, 'Update'); $this->assertText('Unapproved comments (0)', 'All comments were approved.'); // Delete multiple comments in one operation. @@ -98,15 +98,15 @@ public function testApprovalAdminInterface() { "comments[{$comments[1]->id()}]" => 1, "comments[{$anonymous_comment4->id()}]" => 1, ]; - $this->drupalPostForm(NULL, $edit, t('Update')); + $this->drupalPostForm(NULL, $edit, 'Update'); $this->assertText('Are you sure you want to delete these comments and all their children?', 'Confirmation required.'); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertText('No comments available.', 'All comments were deleted.'); // Test message when no comments selected. $edit = [ 'operation' => 'delete', ]; - $this->drupalPostForm(NULL, $edit, t('Update')); + $this->drupalPostForm(NULL, $edit, 'Update'); $this->assertText('Select one or more comments to perform the update on.'); // Make sure the label of unpublished node is not visible on listing page. @@ -276,12 +276,12 @@ public function testCommentedTranslationDeletion() { "comments[{$comment1->id()}]" => 1, "comments[{$comment2->id()}]" => 1, ]; - $this->drupalPostForm('admin/content/comment', $edit, t('Update')); + $this->drupalPostForm('admin/content/comment', $edit, 'Update'); $this->assertRaw(new FormattableMarkup('@label (Original translation) - The following comment translations will be deleted:', ['@label' => $comment1->label()])); $this->assertRaw(new FormattableMarkup('@label (Original translation) - The following comment translations will be deleted:', ['@label' => $comment2->label()])); $this->assertText('English'); $this->assertText('Urdu'); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $after_count = $count_query->execute(); $this->assertEqual($after_count, $before_count, 'No comment or translation found.'); } diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php index c0641377d351f91346736447fd2c1c8a9581483f..966eb0e3addee94cf54c543259b34908ab30cd4e 100644 --- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php @@ -47,7 +47,7 @@ public function testAnonymous() { $body = 'comment body with skip comment approval'; $edit['subject[0][value]'] = $title; $edit['comment_body[0][value]'] = $body; - $this->drupalPostForm($this->node->toUrl(), $edit, t('Preview')); + $this->drupalPostForm($this->node->toUrl(), $edit, 'Preview'); // Cannot use assertRaw here since both title and body are in the form. $preview = (string) $this->cssSelect('.preview')[0]->getHtml(); $this->assertStringContainsString($title, $preview, 'Anonymous user can preview comment title.'); @@ -60,7 +60,7 @@ public function testAnonymous() { $body = 'comment body without skip comment approval'; $edit['subject[0][value]'] = $title; $edit['comment_body[0][value]'] = $body; - $this->drupalPostForm($this->node->toUrl(), $edit, t('Preview')); + $this->drupalPostForm($this->node->toUrl(), $edit, 'Preview'); // Cannot use assertRaw here since both title and body are in the form. $preview = (string) $this->cssSelect('.preview')[0]->getHtml(); $this->assertStringContainsString($title, $preview, 'Anonymous user can preview comment title.'); @@ -76,7 +76,7 @@ public function testAnonymous() { 'name' => $this->adminUser->getAccountName(), 'comment_body[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, t('Save')); + $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, 'Save'); $this->assertRaw(t('The name you used (%name) belongs to a registered user.', [ '%name' => $this->adminUser->getAccountName(), ])); @@ -109,7 +109,7 @@ public function testAnonymous() { 'subject[0][value]' => $this->randomMachineName(), 'comment_body[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, t('Save')); + $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', $edit, 'Save'); $this->assertRaw(t('The name you used (%name) belongs to a registered user.', [ '%name' => $this->adminUser->getAccountName(), ])); diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php index 4aaf2d2b1751614d2875f93b15d5627b8029e944..e52ccc3497959f607a986f00927c89925399ff88 100644 --- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php +++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php @@ -161,7 +161,7 @@ public function testCommentFieldCreate() { // Try to save the comment field without selecting a comment type. $edit = []; - $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, t('Save field settings')); + $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, 'Save field settings'); // We should get an error message. $this->assertText('An illegal choice has been detected. Please contact the site administrator.'); @@ -178,7 +178,7 @@ public function testCommentFieldCreate() { $edit = [ 'settings[comment_type]' => 'user_comment_type', ]; - $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, t('Save field settings')); + $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, 'Save field settings'); // We shouldn't get an error message. $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.'); } @@ -207,20 +207,20 @@ public function testCommentInstallAfterContentModule() { // Uninstall the comment module. $edit = []; $edit['uninstall[comment]'] = TRUE; - $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); - $this->drupalPostForm(NULL, [], t('Uninstall')); + $this->drupalPostForm('admin/modules/uninstall', $edit, 'Uninstall'); + $this->drupalPostForm(NULL, [], 'Uninstall'); $this->rebuildContainer(); $this->assertFalse($this->container->get('module_handler')->moduleExists('comment'), 'Comment module uninstalled.'); // Install core content type module (book). $edit = []; $edit['modules[book][enable]'] = 'book'; - $this->drupalPostForm('admin/modules', $edit, t('Install')); + $this->drupalPostForm('admin/modules', $edit, 'Install'); // Now install the comment module. $edit = []; $edit['modules[comment][enable]'] = 'comment'; - $this->drupalPostForm('admin/modules', $edit, t('Install')); + $this->drupalPostForm('admin/modules', $edit, 'Install'); $this->rebuildContainer(); $this->assertTrue($this->container->get('module_handler')->moduleExists('comment'), 'Comment module enabled.'); diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php index bfd03eef243066e7045244518a8ca895359e2f81..fb7a9c8aeda562e9a0008150d1b8ae0b71e87963 100644 --- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @@ -288,7 +288,7 @@ public function testAutoFilledHtmlSubject() { 'comment_body[0][value]' => $body_text1, 'comment_body[0][format]' => 'filtered_html', ]; - $this->drupalPostForm(NULL, $edit1, t('Save')); + $this->drupalPostForm(NULL, $edit1, 'Save'); $this->assertEqual('Hello World', Comment::load(1)->getSubject()); // If there's nothing other than HTML, the subject should be '(No subject)'. @@ -297,7 +297,7 @@ public function testAutoFilledHtmlSubject() { 'comment_body[0][value]' => $body_text2, 'comment_body[0][format]' => 'filtered_html', ]; - $this->drupalPostForm(NULL, $edit2, t('Save')); + $this->drupalPostForm(NULL, $edit2, 'Save'); $this->assertEqual('(No subject)', Comment::load(2)->getSubject()); } diff --git a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php index 663158af6b5af3e4eb1f65de94d3d836821b4085..5df4c5f181e86f27d1d9e10c8d15fe980794533c 100644 --- a/core/modules/comment/tests/src/Functional/CommentLanguageTest.php +++ b/core/modules/comment/tests/src/Functional/CommentLanguageTest.php @@ -60,11 +60,11 @@ protected function setUp(): void { // Add language. $edit = ['predefined_langcode' => 'fr']; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); // Set "Article" content type to use multilingual support. $edit = ['language_configuration[language_alterable]' => TRUE]; - $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type')); + $this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type'); // Enable content language negotiation UI. \Drupal::state()->set('language_test.content_language_type', TRUE); @@ -78,12 +78,12 @@ protected function setUp(): void { 'language_content[enabled][language-url]' => TRUE, 'language_content[enabled][language-interface]' => FALSE, ]; - $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); + $this->drupalPostForm('admin/config/regional/language/detection', $edit, 'Save settings'); // Change user language preference, this way interface language is always // French no matter what path prefix the URLs have. $edit = ['preferred_langcode' => 'fr']; - $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, t('Save')); + $this->drupalPostForm("user/" . $admin_user->id() . "/edit", $edit, 'Save'); // Create comment field on article. $this->addDefaultCommentField('node', 'article'); @@ -115,7 +115,7 @@ public function testCommentLanguage() { 'langcode[0][value]' => $node_langcode, 'comment[0][status]' => CommentItemInterface::OPEN, ]; - $this->drupalPostForm("node/add/article", $edit, t('Save')); + $this->drupalPostForm("node/add/article", $edit, 'Save'); $node = $this->drupalGetNodeByTitle($title); $prefixes = $this->config('language.negotiation')->get('url.prefixes'); @@ -127,8 +127,8 @@ public function testCommentLanguage() { 'subject[0][value]' => $this->randomMachineName(), 'comment_body[0][value]' => $comment_values[$node_langcode][$langcode], ]; - $this->drupalPostForm($prefix . 'node/' . $node->id(), $edit, t('Preview')); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm($prefix . 'node/' . $node->id(), $edit, 'Preview'); + $this->drupalPostForm(NULL, $edit, 'Save'); // Check that comment language matches the current content language. $cids = \Drupal::entityQuery('comment') diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php index ff6d7858cdccf7d7f12d9e8c928f606e36e9e227..3b654c9f6f443f181db9e2a953ae4e8ab8bd76c7 100644 --- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php @@ -150,19 +150,19 @@ public function postComment(EntityInterface $entity, $comment, $subject = '', $c case DRUPAL_REQUIRED: // Preview required so no save button should be found. $this->assertSession()->buttonNotExists(t('Save')); - $this->drupalPostForm(NULL, $edit, t('Preview')); + $this->drupalPostForm(NULL, $edit, 'Preview'); // Don't break here so that we can test post-preview field presence and // function below. case DRUPAL_OPTIONAL: $this->assertSession()->buttonExists(t('Preview')); $this->assertSession()->buttonExists(t('Save')); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); break; case DRUPAL_DISABLED: $this->assertSession()->buttonNotExists(t('Preview')); $this->assertSession()->buttonExists(t('Save')); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); break; } $match = []; @@ -235,10 +235,10 @@ public function performCommentOperation($comment, $operation, $approval = FALSE) $edit = []; $edit['operation'] = $operation; $edit['comments[' . $comment->id() . ']'] = TRUE; - $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update')); + $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, 'Update'); if ($operation == 'delete') { - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.')); } else { @@ -415,7 +415,7 @@ public function testCommentFunctionality() { 'default_value_input[comment][0][status]' => CommentItemInterface::CLOSED, 'settings[anonymous]' => CommentInterface::ANONYMOUS_MAY_CONTACT, ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment'); $this->assertSession()->checkboxNotChecked('edit-default-value-input-comment-0-status-0'); $this->assertSession()->checkboxChecked('edit-default-value-input-comment-0-status-1'); @@ -478,7 +478,7 @@ public function testCommentFunctionality() { $this->assertSession()->fieldNotExists('comment_body[0][value]'); // Set subject field to autogenerate it. $edit = ['subject[0][value]' => '']; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); } /** diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 3934e7035548b2f5b6e667dc24bb8ec5540ed6e8..83cbaca0d3dfd81053f396aa38f5e6bee2efe72f 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -347,11 +347,11 @@ public function testTwoPagers() { $this->assertText('Pager ID: 1'); $this->drupalPostForm(NULL, [], 'comment_settings_edit'); // Change default pager to 2. - $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 2], t('Save')); + $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 2], 'Save'); $this->assertText('Pager ID: 2'); // Revert the changes. $this->drupalPostForm(NULL, [], 'comment_settings_edit'); - $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 0], t('Save')); + $this->drupalPostForm(NULL, ['fields[comment][settings_edit_form][settings][pager_id]' => 0], 'Save'); $this->assertNoText('Pager ID: 0', 'No summary for standard pager'); $this->drupalLogin($this->adminUser); diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php index f11f39ea7b2f503b4d3d9e233936013243c79687..6269bd3dbcce4ced0004ed46b1eaa6cf8b820751 100644 --- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php @@ -49,11 +49,11 @@ public function testCommentPreview() { $edit = []; $edit['subject[0][value]'] = $this->randomMachineName(8); $edit['comment_body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview')); + $this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview'); $this->assertSession()->assertEscaped('' . $this->webUser->id() . ''); \Drupal::state()->set('user_hooks_test_user_format_name_alter_safe', TRUE); - $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview')); + $this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview'); $this->assertInstanceOf(MarkupInterface::class, $this->webUser->getDisplayName()); $this->assertSession()->assertNoEscaped('' . $this->webUser->id() . ''); $this->assertRaw('' . $this->webUser->id() . ''); @@ -61,10 +61,10 @@ public function testCommentPreview() { // Add a user picture. $image = current($this->drupalGetTestFiles('image')); $user_edit['files[user_picture_0]'] = \Drupal::service('file_system')->realpath($image->uri); - $this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $user_edit, t('Save')); + $this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $user_edit, 'Save'); // As the web user, fill in the comment form and preview the comment. - $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview')); + $this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview'); // Check that the preview is displaying the title and body. $this->assertSession()->titleEquals('Preview comment | Drupal'); @@ -98,7 +98,7 @@ public function testCommentPreviewDuplicateSubmission() { $edit = []; $edit['subject[0][value]'] = $this->randomMachineName(8); $edit['comment_body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm('node/' . $this->node->id(), $edit, t('Preview')); + $this->drupalPostForm('node/' . $this->node->id(), $edit, 'Preview'); // Check that the preview is displaying the title and body. $this->assertSession()->titleEquals('Preview comment | Drupal'); @@ -152,7 +152,7 @@ public function testCommentEditPreviewSave() { $expected_form_date = $date->format('Y-m-d'); $expected_form_time = $date->format('H:i:s'); $comment = $this->postComment($this->node, $edit['subject[0][value]'], $edit['comment_body[0][value]'], TRUE); - $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Preview')); + $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, 'Preview'); // Check that the preview is displaying the subject, comment, author and date correctly. $this->assertSession()->titleEquals('Preview comment | Drupal'); @@ -169,7 +169,7 @@ public function testCommentEditPreviewSave() { $this->assertSession()->fieldValueEquals('date[time]', $edit['date[time]']); // Check that saving a comment produces a success message. - $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, 'Save'); $this->assertText('Your comment has been posted.', 'Comment posted.'); // Check that the comment fields are correct after loading the saved comment. @@ -187,7 +187,7 @@ public function testCommentEditPreviewSave() { $displayed['uid'] = current($this->xpath("//input[@id='edit-uid']"))->getValue(); $displayed['date[date]'] = current($this->xpath("//input[@id='edit-date-date']"))->getValue(); $displayed['date[time]'] = current($this->xpath("//input[@id='edit-date-time']"))->getValue(); - $this->drupalPostForm('comment/' . $comment->id() . '/edit', $displayed, t('Save')); + $this->drupalPostForm('comment/' . $comment->id() . '/edit', $displayed, 'Save'); // Check that the saved comment is still correct. $comment_storage = \Drupal::entityTypeManager()->getStorage('comment'); @@ -207,7 +207,7 @@ public function testCommentEditPreviewSave() { $this->drupalLogin($web_user); // Web user cannot change the comment author. unset($edit['uid']); - $this->drupalPostForm('comment/' . $comment->id() . '/edit', $user_edit, t('Save')); + $this->drupalPostForm('comment/' . $comment->id() . '/edit', $user_edit, 'Save'); $comment_storage->resetCache([$comment->id()]); $comment_loaded = Comment::load($comment->id()); $this->assertEqual($comment_loaded->getCreatedTime(), $expected_created_time, 'Expected date and time for comment edited.'); diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php index b6a5bae592ef06b9385e8b7ed2824b7ba7051590..c265eebb5f64eeab4c08530239c7ab47af6a9a02 100644 --- a/core/modules/comment/tests/src/Functional/CommentTestBase.php +++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php @@ -149,19 +149,19 @@ public function postComment($entity, $comment, $subject = '', $contact = NULL, $ case DRUPAL_REQUIRED: // Preview required so no save button should be found. $this->assertSession()->buttonNotExists(t('Save')); - $this->drupalPostForm(NULL, $edit, t('Preview')); + $this->drupalPostForm(NULL, $edit, 'Preview'); // Don't break here so that we can test post-preview field presence and // function below. case DRUPAL_OPTIONAL: $this->assertSession()->buttonExists(t('Preview')); $this->assertSession()->buttonExists(t('Save')); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); break; case DRUPAL_DISABLED: $this->assertSession()->buttonNotExists(t('Preview')); $this->assertSession()->buttonExists(t('Save')); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); break; } $match = []; @@ -227,7 +227,7 @@ public function commentExists(CommentInterface $comment = NULL, $reply = FALSE) * Comment to delete. */ public function deleteComment(CommentInterface $comment) { - $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], t('Delete')); + $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], 'Delete'); $this->assertText('The comment and all its replies have been deleted.', 'Comment deleted.'); } @@ -361,10 +361,10 @@ public function performCommentOperation(CommentInterface $comment, $operation, $ $edit = []; $edit['operation'] = $operation; $edit['comments[' . $comment->id() . ']'] = TRUE; - $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, t('Update')); + $this->drupalPostForm('admin/content/comment' . ($approval ? '/approval' : ''), $edit, 'Update'); if ($operation == 'delete') { - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.')); } else { diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php index 9246b2d4913e1ee1072918409f5de2abe4033f36..c15dd20128e623877783ff283a206ea44581bb1e 100644 --- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php @@ -75,7 +75,7 @@ public function testCommentTypeCreation() { 'description' => '', 'target_entity_type_id' => 'node', ]; - $this->drupalPostForm('admin/structure/comment/types/add', $edit, t('Save')); + $this->drupalPostForm('admin/structure/comment/types/add', $edit, 'Save'); $comment_type = CommentType::load('foo'); $this->assertInstanceOf(CommentType::class, $comment_type); @@ -89,7 +89,7 @@ public function testCommentTypeCreation() { $this->assertText('Target entity type'); // Save the form and ensure the entity-type value is preserved even though // the field isn't present. - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); \Drupal::entityTypeManager()->getStorage('comment_type')->resetCache(['foo']); $comment_type = CommentType::load('foo'); $this->assertEqual($comment_type->getTargetEntityTypeId(), 'node'); @@ -109,7 +109,7 @@ public function testCommentTypeEditing() { $edit = [ 'label' => 'Bar', ]; - $this->drupalPostForm('admin/structure/comment/manage/comment', $edit, t('Save')); + $this->drupalPostForm('admin/structure/comment/manage/comment', $edit, 'Save'); $this->drupalGet('admin/structure/comment'); $this->assertRaw('Bar'); @@ -119,9 +119,9 @@ public function testCommentTypeEditing() { $this->assertCount(1, $this->cssSelect('tr#comment-body'), 'Body field exists.'); // Remove the body field. - $this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', [], t('Delete')); + $this->drupalPostForm('admin/structure/comment/manage/comment/fields/comment.comment.comment_body/delete', [], 'Delete'); // Resave the settings for this type. - $this->drupalPostForm('admin/structure/comment/manage/comment', [], t('Save')); + $this->drupalPostForm('admin/structure/comment/manage/comment', [], 'Save'); // Check that the body field doesn't exist. $this->drupalGet('admin/structure/comment/manage/comment/fields'); $this->assertCount(0, $this->cssSelect('tr#comment-body'), 'Body field does not exist.'); @@ -188,7 +188,7 @@ public function testCommentTypeDeletion() { } // Delete the comment type. - $this->drupalPostForm('admin/structure/comment/manage/' . $type->id() . '/delete', [], t('Delete')); + $this->drupalPostForm('admin/structure/comment/manage/' . $type->id() . '/delete', [], 'Delete'); $this->assertNull(CommentType::load($type->id()), 'Comment type deleted.'); $this->assertRaw(t('The comment type %label has been deleted.', ['%label' => $type->label()])); } diff --git a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php index 2e8488dff4c2c701782bb2dc813c74ac82b4d18a..b8ace9690e175203f301f7d9d9765840cd6c4dcb 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php @@ -69,7 +69,7 @@ public function testApprovalAdminInterface() { $this->drupalPostForm('comment/reply/node/' . $this->node->id() . '/comment', [ 'name' => $author_name, 'comment_body[0][value]' => $body, - ], t('Save')); + ], 'Save'); $this->assertText('Your comment has been queued for review by site administrators and will be published after approval.', 'Comment requires approval.'); // Get unapproved comment id. @@ -92,7 +92,7 @@ public function testApprovalAdminInterface() { $edit = []; $edit['action'] = 'comment_publish_action'; $edit['comment_bulk_form[0]'] = $anonymous_comment4->id(); - $this->drupalPostForm('admin/content/comment/approval', $edit, t('Apply to selected items')); + $this->drupalPostForm('admin/content/comment/approval', $edit, 'Apply to selected items'); $this->assertText('Publish comment was applied to 1 item.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => 'publish'])); $this->drupalLogout(); @@ -119,11 +119,11 @@ public function testApprovalAdminInterface() { "comment_bulk_form[1]" => $comments[0]->id(), "comment_bulk_form[0]" => $comments[1]->id(), ]; - $this->drupalPostForm(NULL, $edit, t('Apply to selected items')); + $this->drupalPostForm(NULL, $edit, 'Apply to selected items'); $this->assertText('Unapproved comments (0)', 'All comments were approved.'); // Test message when no comments selected. - $this->drupalPostForm('admin/content/comment', [], t('Apply to selected items')); + $this->drupalPostForm('admin/content/comment', [], 'Apply to selected items'); $this->assertText('Select one or more comments to perform the update on.'); $subject_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and contains(@title, :title) and text()=:text]', [ @@ -149,9 +149,9 @@ public function testApprovalAdminInterface() { "comment_bulk_form[0]" => $comments[1]->id(), "comment_bulk_form[2]" => $anonymous_comment4->id(), ]; - $this->drupalPostForm(NULL, $edit, t('Apply to selected items')); + $this->drupalPostForm(NULL, $edit, 'Apply to selected items'); $this->assertText('Are you sure you want to delete these comments and all their children?', 'Confirmation required.'); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertText('No comments available.', 'All comments were deleted.'); // Make sure the label of unpublished node is not visible on listing page. diff --git a/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php b/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php index fb5f736a870fa25640386502545ee3b34b0efa78..a59ada5d1cc0d793565edb2658364c0372c19460 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentEditTest.php @@ -29,7 +29,7 @@ public function testCommentEdit() { $edit = [ 'comment_body[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->drupalGet('admin/content/comment'); $this->assertText($this->adminUser->label()); } diff --git a/core/modules/comment/tests/src/Functional/Views/WizardTest.php b/core/modules/comment/tests/src/Functional/Views/WizardTest.php index 81e9563e4a4e8687095fe514a053b5b8dc26001d..404fd3633066dfcc1dde018c8d17ef6fd23220a1 100644 --- a/core/modules/comment/tests/src/Functional/Views/WizardTest.php +++ b/core/modules/comment/tests/src/Functional/Views/WizardTest.php @@ -51,7 +51,7 @@ public function testCommentWizard() { // Just triggering the saving should automatically choose a proper row // plugin. - $this->drupalPostForm('admin/structure/views/add', $view, t('Save and edit')); + $this->drupalPostForm('admin/structure/views/add', $view, 'Save and edit'); // Verify that the view saving was successful and the browser got redirected // to the edit page. $this->assertSession()->addressEquals('admin/structure/views/view/' . $view['id']); @@ -60,7 +60,7 @@ public function testCommentWizard() { // row plugins as the select field. $this->drupalGet('admin/structure/views/add'); - $this->drupalPostForm('admin/structure/views/add', $view, t('Update "of type" choice')); + $this->drupalPostForm('admin/structure/views/add', $view, 'Update "of type" choice'); // Check for available options of the row plugin. $expected_options = ['entity:comment', 'fields']; @@ -72,7 +72,7 @@ public function testCommentWizard() { $this->assertEquals($expected_options, $actual_options); $view['id'] = strtolower($this->randomMachineName(16)); - $this->drupalPostForm(NULL, $view, t('Save and edit')); + $this->drupalPostForm(NULL, $view, 'Save and edit'); // Verify that the view saving was successful and the browser got redirected // to the edit page. $this->assertSession()->addressEquals('admin/structure/views/view/' . $view['id']); diff --git a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php index 0026c8b443ab04efcb09ddc4c30eb8a0c3e68a72..cb4298eeb086bd137da70146733742bed9921c6d 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityFormOverrideTest.php @@ -60,7 +60,7 @@ public function testFormsWithOverrides() { $edit = [ 'label' => $edited_label, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->drupalGet('admin/structure/config_test'); $this->assertNoText($overridden_label); $this->assertText($edited_label); diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php index 0fe1c35f757174c4ad90eaac65bafaa9506b27a6..c6e052f686add7779f2a8ac84d584f0337ee035d 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListMultilingualTest.php @@ -57,7 +57,7 @@ public function testListUI() { 'id' => 'antilop', 'langcode' => 'hu', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Ensure that operations for editing the Hungarian entity appear in English. $this->assertSession()->linkByHrefExists('admin/structure/config_test/manage/antilop'); diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php index ddba30c94a4b03beb57c549b11e913229e943fb1..cbde42ade1c1e9ccb1d8a9f4c59f1c8a83170aef 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -201,7 +201,7 @@ public function testListUI() { 'id' => 'antelope', 'weight' => 1, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Ensure that the entity's sort method was called. $this->assertTrue(\Drupal::state()->get('config_entity_sort'), 'ConfigTest::sort() was called.'); @@ -218,7 +218,7 @@ public function testListUI() { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals('Edit Antelope | Drupal'); $edit = ['label' => 'Albatross', 'id' => 'albatross']; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Confirm that the user is returned to the listing, and verify that the // text of the label and machine name appears in the list (versus elsewhere @@ -231,7 +231,7 @@ public function testListUI() { $this->clickLink('Delete', 1); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals('Are you sure you want to delete the test configuration Albatross? | Drupal'); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); // Verify that the text of the label and machine name does not appear in // the list (though it may appear elsewhere on the page). @@ -242,7 +242,7 @@ public function testListUI() { $this->clickLink('Delete'); $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals('Are you sure you want to delete the test configuration Default? | Drupal'); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); // Verify that the text of the label and machine name does not appear in // the list (though it may appear elsewhere on the page). diff --git a/core/modules/config/tests/src/Functional/ConfigExportUITest.php b/core/modules/config/tests/src/Functional/ConfigExportUITest.php index ce23fa14503b3094eadc9c959b496f1bce469045..6ce71759fb4ba76175171814f688e4c98fcd984e 100644 --- a/core/modules/config/tests/src/Functional/ConfigExportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigExportUITest.php @@ -52,7 +52,7 @@ public function testExport() { // Submit the export form and verify response. This will create a file in // temporary directory with the default name config.tar.gz. - $this->drupalPostForm('admin/config/development/configuration/full/export', [], t('Export')); + $this->drupalPostForm('admin/config/development/configuration/full/export', [], 'Export'); $this->assertSession()->statusCodeEquals(200); // Test if header contains file name with hostname and timestamp. diff --git a/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php b/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php index 95f4e1b8cb947c4c41874f755db8a2c7ef14d8bd..fbd399a40dfc33cb96fcb8e8b0853feced5f18fb 100644 --- a/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php @@ -46,7 +46,7 @@ public function testFormsWithOverrides() { $edit = [ 'site_name' => 'Custom site name', ]; - $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/system/site-information', $edit, 'Save configuration'); $this->assertSession()->titleEquals('Basic site settings | ' . $overridden_name); $elements = $this->xpath('//input[@name="site_name"]'); $this->assertIdentical($elements[0]->getValue(), $edit['site_name']); diff --git a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php index 9e60c53fbe557708d3518d0276f310f3670c3662..ac5d94d41b084435fa06999bc75b741e27d3a2c8 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportAllTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportAllTest.php @@ -117,7 +117,7 @@ public function testInstallUninstall() { } // Import the configuration thereby re-installing all the modules. - $this->drupalPostForm('admin/config/development/configuration', [], t('Import all')); + $this->drupalPostForm('admin/config/development/configuration', [], 'Import all'); // Modules have been installed that have services. $this->rebuildContainer(); diff --git a/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php b/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php index dca10e46765f5673853cc948905e955d8b6efcbb..3685bce03ab765902042ac0821fe8c878fa8c55f 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportInstallProfileTest.php @@ -59,7 +59,7 @@ public function testInstallProfileValidation() { unset($core['module']['testing_config_import']); $sync->write('core.extension', $core); - $this->drupalPostForm('admin/config/development/configuration', [], t('Import all')); + $this->drupalPostForm('admin/config/development/configuration', [], 'Import all'); $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:'); $this->assertText('Unable to uninstall the Testing config import profile since it is the install profile.'); @@ -74,7 +74,7 @@ public function testInstallProfileValidation() { $theme = $sync->read('system.theme'); $theme['default'] = 'classy'; $sync->write('system.theme', $theme); - $this->drupalPostForm('admin/config/development/configuration', [], t('Import all')); + $this->drupalPostForm('admin/config/development/configuration', [], 'Import all'); $this->assertText('The configuration was imported successfully.'); $this->rebuildContainer(); $this->assertFalse(\Drupal::moduleHandler()->moduleExists('syslog'), 'The syslog module has been uninstalled.'); diff --git a/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php index 4ef7cb1aad22ec9643ed8f06507677e084859f43..2687d89cab779d8ba070901683232cbe62f9cf6a 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php @@ -128,7 +128,7 @@ public function testImport() { $this->assertSession()->buttonExists('Import all'); // Import and verify that both do not appear anymore. - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $this->assertNoRaw('' . $name); $this->assertNoRaw('' . $dynamic_name); $this->assertNoRaw('core.extension'); @@ -199,7 +199,7 @@ public function testImport() { $this->assertRaw('automated_cron.settings'); // Import and verify that both do not appear anymore. - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $this->assertNoRaw('core.extension'); $this->assertNoRaw('system.theme'); $this->assertNoRaw('automated_cron.settings'); @@ -244,7 +244,7 @@ public function testImportLock() { $this->container->get('lock.persistent')->acquire($config_importer::LOCK_NAME); // Attempt to import configuration and verify that an error message appears. - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $this->assertText('Another request may be synchronizing configuration already.'); // Release the lock, just to keep testing sane. @@ -362,7 +362,7 @@ public function testImportValidation() { $this->drupalGet('admin/config/development/configuration'); $this->assertNoText('There are no configuration changes to import.'); - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); // Verify that the validation messages appear. $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:'); @@ -384,7 +384,7 @@ public function testConfigUninstallConfigException() { $this->assertText('core.extension'); // Import and verify that both do not appear anymore. - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $this->assertText('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.'); } @@ -441,7 +441,7 @@ public function testImportErrorLog() { $this->assertNoText('There are no configuration changes to import.'); // Attempt to import configuration and verify that an error message appears. - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $this->assertText('Deleted and replaced configuration entity "' . $name_secondary . '"'); $this->assertText('The configuration was imported with errors.'); $this->assertNoText('The configuration was imported successfully.'); @@ -471,7 +471,7 @@ public function testEntityBundleDelete() { // Attempt to import configuration and verify that an error message appears // and the node type, body field and entity displays are still scheduled for // removal. - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $validation_message = t('Entities exist of type %entity_type and %bundle_label %bundle. These entities need to be deleted before importing.', ['%entity_type' => $node->getEntityType()->getLabel(), '%bundle_label' => $node->getEntityType()->getBundleLabel(), '%bundle' => $node_type->label()]); $this->assertRaw($validation_message); $this->assertText('node.type.' . $node_type->id()); @@ -482,7 +482,7 @@ public function testEntityBundleDelete() { // Delete the node and try to import again. $node->delete(); - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $this->assertNoRaw($validation_message); $this->assertText('There are no configuration changes to import.'); $this->assertNoText('node.type.' . $node_type->id()); @@ -519,7 +519,7 @@ public function testExtensionValidation() { $core['theme']['does_not_exist'] = 0; $sync->write('core.extension', $core); - $this->drupalPostForm('admin/config/development/configuration', [], t('Import all')); + $this->drupalPostForm('admin/config/development/configuration', [], 'Import all'); $this->assertText('The configuration cannot be imported because it failed validation for the following reasons:'); $this->assertText('Unable to uninstall the Text module since the Node module is installed.'); $this->assertText('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.'); @@ -534,7 +534,7 @@ public function testBatchErrors() { $new_site_name = 'Config import test ' . $this->randomString(); $this->prepareSiteNameUpdate($new_site_name); \Drupal::state()->set('config_import_steps_alter.error', TRUE); - $this->drupalPostForm('admin/config/development/configuration', [], t('Import all')); + $this->drupalPostForm('admin/config/development/configuration', [], 'Import all'); $this->assertSession()->responseContains('_config_import_test_config_import_steps_alter batch error'); $this->assertSession()->responseContains('_config_import_test_config_import_steps_alter ConfigImporter error'); $this->assertSession()->responseContains('The configuration was imported with errors.'); diff --git a/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php index e3e6d6aae7fdf7b1997b6287ce6f938c36f1caca..8d63151ba001b5274e21f6b35ece9a7e91b99035 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php @@ -52,7 +52,7 @@ public function testImport() { // Attempt to upload a non-tar file. $text_file = $this->getTestFiles('text')[0]; $edit = ['files[import_tarball]' => \Drupal::service('file_system')->realpath($text_file->uri)]; - $this->drupalPostForm('admin/config/development/configuration/full/import', $edit, t('Upload')); + $this->drupalPostForm('admin/config/development/configuration/full/import', $edit, 'Upload'); $this->assertText('Could not extract the contents of the tar file'); // Make the sync directory read-only. diff --git a/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php b/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php index a1a430ee2be1e496737748383669194c2a82e328..c664adf0ec6c0c1484b1f78ad58e257f7643449f 100644 --- a/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigInstallWebTest.php @@ -135,19 +135,19 @@ public function testPreExistingConfigInstall() { // will install the config_test module first because it is a dependency of // config_install_fail_test. // @see \Drupal\system\Form\ModulesListForm::submitForm() - $this->drupalPostForm('admin/modules', ['modules[config_test][enable]' => TRUE, 'modules[config_install_fail_test][enable]' => TRUE], t('Install')); + $this->drupalPostForm('admin/modules', ['modules[config_test][enable]' => TRUE, 'modules[config_install_fail_test][enable]' => TRUE], 'Install'); $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default already exists in active configuration.'); // Uninstall the config_test module to test the confirm form. - $this->drupalPostForm('admin/modules/uninstall', ['uninstall[config_test]' => TRUE], t('Uninstall')); - $this->drupalPostForm(NULL, [], t('Uninstall')); + $this->drupalPostForm('admin/modules/uninstall', ['uninstall[config_test]' => TRUE], 'Uninstall'); + $this->drupalPostForm(NULL, [], 'Uninstall'); // Try to install config_install_fail_test without selecting config_test. // The user is shown a confirm form because the config_test module is a // dependency. // @see \Drupal\system\Form\ModulesListConfirmForm::submitForm() - $this->drupalPostForm('admin/modules', ['modules[config_install_fail_test][enable]' => TRUE], t('Install')); - $this->drupalPostForm(NULL, [], t('Continue')); + $this->drupalPostForm('admin/modules', ['modules[config_install_fail_test][enable]' => TRUE], 'Install'); + $this->drupalPostForm(NULL, [], 'Continue'); $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default already exists in active configuration.'); // Test that collection configuration clashes during a module install are @@ -160,7 +160,7 @@ public function testPreExistingConfigInstall() { ->set('label', 'Je suis Charlie') ->save(); - $this->drupalPostForm('admin/modules', ['modules[config_install_fail_test][enable]' => TRUE], t('Install')); + $this->drupalPostForm('admin/modules', ['modules[config_install_fail_test][enable]' => TRUE], 'Install'); $this->assertRaw('Unable to install Configuration install fail test, config_test.dynamic.dotted.default, language/fr/config_test.dynamic.dotted.default already exist in active configuration.'); // Test installing a theme through the UI that has existing configuration. @@ -191,16 +191,16 @@ public function testUnmetDependenciesInstall() { $this->drupalLogin($this->adminUser); // We need to install separately since config_install_dependency_test does // not depend on config_test and order is important. - $this->drupalPostForm('admin/modules', ['modules[config_test][enable]' => TRUE], t('Install')); - $this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], t('Install')); + $this->drupalPostForm('admin/modules', ['modules[config_test][enable]' => TRUE], 'Install'); + $this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], 'Install'); $this->assertRaw('Unable to install Config install dependency test due to unmet dependencies: config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test, config_test.dynamic.dotted.english)'); - $this->drupalPostForm('admin/modules', ['modules[config_test_language][enable]' => TRUE], t('Install')); - $this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], t('Install')); + $this->drupalPostForm('admin/modules', ['modules[config_test_language][enable]' => TRUE], 'Install'); + $this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], 'Install'); $this->assertRaw('Unable to install Config install dependency test due to unmet dependencies: config_test.dynamic.other_module_test_with_dependency (config_other_module_config_test)'); - $this->drupalPostForm('admin/modules', ['modules[config_other_module_config_test][enable]' => TRUE], t('Install')); - $this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], t('Install')); + $this->drupalPostForm('admin/modules', ['modules[config_other_module_config_test][enable]' => TRUE], 'Install'); + $this->drupalPostForm('admin/modules', ['modules[config_install_dependency_test][enable]' => TRUE], 'Install'); $this->rebuildContainer(); $this->assertInstanceOf(ConfigTest::class, \Drupal::entityTypeManager()->getStorage('config_test')->load('other_module_test_with_dependency')); } @@ -210,7 +210,7 @@ public function testUnmetDependenciesInstall() { */ public function testConfigModuleRequirements() { $this->drupalLogin($this->adminUser); - $this->drupalPostForm('admin/modules', ['modules[config][enable]' => TRUE], t('Install')); + $this->drupalPostForm('admin/modules', ['modules[config][enable]' => TRUE], 'Install'); $directory = Settings::get('config_sync_directory'); try { diff --git a/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php b/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php index b2e484a360296820c01e2f8f6b50f2ba6cc5b5b0..6b3335354bedec7c083fedac4265159565fe36e1 100644 --- a/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigLanguageOverrideWebTest.php @@ -55,7 +55,7 @@ public function testSiteNameTranslation() { 'label' => $name, 'direction' => LanguageInterface::DIRECTION_LTR, ]; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add custom language'); \Drupal::languageManager() ->getLanguageConfigOverride($langcode, 'system.site') ->set('name', 'XX site name') diff --git a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php index 273448d1bbeb521549fb9dcab348d028ebaeef0a..ce3234b5adc5026783621a345566193b8f803638 100644 --- a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php +++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php @@ -52,7 +52,7 @@ public function testImport() { 'import' => '{{{', ]; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); // Assert the static portion of the error since different parsers could give different text in their error. $this->assertText('The import failed with the following message: '); @@ -67,15 +67,15 @@ public function testImport() { 'import' => $import, ]; // Attempt an import with a missing ID. - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertText('Missing ID key "id" for this Test configuration import.'); // Perform an import with no specified UUID and a unique ID. $this->assertNull($storage->load('first')); $edit['import'] = "id: first\n" . $edit['import']; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertRaw(t('Are you sure you want to create a new %name @type?', ['%name' => 'first', '@type' => 'test configuration'])); - $this->drupalPostForm(NULL, [], t('Confirm')); + $this->drupalPostForm(NULL, [], 'Confirm'); $entity = $storage->load('first'); $this->assertIdentical($entity->label(), 'First'); $this->assertIdentical($entity->id(), 'first'); @@ -83,19 +83,19 @@ public function testImport() { $this->assertRaw(t('The configuration was imported successfully.')); // Attempt an import with an existing ID but missing UUID. - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertText('An entity with this machine name already exists but the import did not specify a UUID.'); // Attempt an import with a mismatched UUID and existing ID. $edit['import'] .= "\nuuid: " . $uuid->generate(); - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertText('An entity with this machine name already exists but the UUID does not match.'); // Attempt an import with a custom ID. $edit['custom_entity_id'] = 'custom_id'; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertRaw(t('Are you sure you want to create a new %name @type?', ['%name' => 'custom_id', '@type' => 'test configuration'])); - $this->drupalPostForm(NULL, [], t('Confirm')); + $this->drupalPostForm(NULL, [], 'Confirm'); $this->assertRaw(t('The configuration was imported successfully.')); // Perform an import with a unique ID and UUID. @@ -112,9 +112,9 @@ public function testImport() { ]; $second_uuid = $uuid->generate(); $edit['import'] .= "\nuuid: " . $second_uuid; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertRaw(t('Are you sure you want to create a new %name @type?', ['%name' => 'second', '@type' => 'test configuration'])); - $this->drupalPostForm(NULL, [], t('Confirm')); + $this->drupalPostForm(NULL, [], 'Confirm'); $entity = $storage->load('second'); $this->assertRaw(t('The configuration was imported successfully.')); $this->assertIdentical($entity->label(), 'Second'); @@ -135,9 +135,9 @@ public function testImport() { 'config_type' => 'config_test', 'import' => $import, ]; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertRaw(t('Are you sure you want to update the %name @type?', ['%name' => 'second', '@type' => 'test configuration'])); - $this->drupalPostForm(NULL, [], t('Confirm')); + $this->drupalPostForm(NULL, [], 'Confirm'); $entity = $storage->load('second'); $this->assertRaw(t('The configuration was imported successfully.')); $this->assertIdentical($entity->label(), 'Second updated'); @@ -158,7 +158,7 @@ public function testImport() { 'config_type' => 'config_test', 'import' => $import, ]; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertRaw(t('Configuration %name depends on the %owner module that will not be installed after import.', ['%name' => 'config_test.dynamic.second', '%owner' => 'does_not_exist'])); // Try to preform an update which would create a PHP object if Yaml parsing @@ -176,7 +176,7 @@ public function testImport() { 'config_type' => 'config_test', 'import' => $import, ]; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); if (extension_loaded('yaml')) { // If the yaml extension is loaded it will work but not create the PHP // object. @@ -184,7 +184,7 @@ public function testImport() { '%name' => 'second', '@type' => 'test configuration', ])); - $this->drupalPostForm(NULL, [], t('Confirm')); + $this->drupalPostForm(NULL, [], 'Confirm'); $entity = $storage->load('second'); $this->assertRaw(t('The configuration was imported successfully.')); $this->assertIsString($entity->label()); @@ -212,9 +212,9 @@ public function testImportSimpleConfiguration() { 'config_name' => $config->getName(), 'import' => Yaml::encode($config->get()), ]; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertRaw(t('Are you sure you want to update the %name @type?', ['%name' => $config->getName(), '@type' => 'simple configuration'])); - $this->drupalPostForm(NULL, [], t('Confirm')); + $this->drupalPostForm(NULL, [], 'Confirm'); $this->drupalGet(''); $this->assertText('Test simple import'); @@ -228,11 +228,11 @@ public function testImportSimpleConfiguration() { 'config_name' => 'core.extension', 'import' => Yaml::encode($config_data), ]; - $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, 'Import'); $this->assertText('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.'); // Try to import without any values. - $this->drupalPostForm('admin/config/development/configuration/single/import', [], t('Import')); + $this->drupalPostForm('admin/config/development/configuration/single/import', [], 'Import'); $this->assertText('Configuration type field is required.'); $this->assertText('Paste your configuration here field is required.'); } diff --git a/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php b/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php index c1d98ae77ce8fd034d092443af41ef8b33015f64..e17dcaf09911fc319864a1c4e2eee25d776eb6d0 100644 --- a/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php +++ b/core/modules/config/tests/src/Functional/LanguageNegotiationFormOverrideTest.php @@ -38,7 +38,7 @@ public function testFormWithOverride() { $edit = [ 'predefined_langcode' => 'es', ]; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); // Overridden string for language-negotiation should not exist in the form. $this->drupalGet('admin/config/regional/language/detection/url'); diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php index a4d174a8c79772e5d32aab7bfa07d7cd80496ce6..b91b9ce7eed3a42055326fa279515e5226253a03 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationInstallTest.php @@ -60,13 +60,13 @@ protected function getPo($langcode) { } public function testConfigTranslation() { - $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'en'], t('Add custom language')); - $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'fr'], t('Add custom language')); + $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'en'], 'Add custom language'); + $this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'fr'], 'Add custom language'); $edit = [ 'modules[config_translation][enable]' => TRUE, ]; - $this->drupalPostForm('admin/modules', $edit, t('Install')); + $this->drupalPostForm('admin/modules', $edit, 'Install'); $this->drupalGet('/admin/structure/types/manage/article/fields'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php index edb5fc2fac783a1f4baaa088a7ce2de16bfa21ff..af664351a840d3d3fce7daf910e238e61b9ec02c 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationListUiTest.php @@ -129,7 +129,7 @@ protected function doMenuListTest() { 'label' => $label, ]; // Create the menu by posting the form. - $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save')); + $this->drupalPostForm('admin/structure/menu/add', $edit, 'Save'); // Get the Menu listing. $this->drupalGet('admin/structure/menu'); @@ -371,7 +371,7 @@ public function doResponsiveImageListTest() { $edit['id'] = strtolower($edit['label']); $edit['fallback_image_style'] = 'thumbnail'; - $this->drupalPostForm('admin/config/media/responsive-image-style/add', $edit, t('Save')); + $this->drupalPostForm('admin/config/media/responsive-image-style/add', $edit, 'Save'); $this->assertRaw(t('Responsive image style %label saved.', ['%label' => $edit['label']])); // Get the responsive image style listing. diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php index af4e6a146cda9bfb863b320a2912917a9cb87df2..69afb28211820e5934c9992c55c67accbb71c67f 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php @@ -153,7 +153,7 @@ public function testSiteInformationTranslationUi() { // original form. $this->clickLink(t('Edit')); // Also check that saving the form leads back to the translation overview. - $this->drupalPostForm(NULL, [], t('Save configuration')); + $this->drupalPostForm(NULL, [], 'Save configuration'); $this->assertSession()->addressEquals($translation_base_url); // Check 'Add' link of French to visit add page. @@ -170,7 +170,7 @@ public function testSiteInformationTranslationUi() { 'translation[config_names][system.site][slogan]' => $fr_site_slogan, ]; - $this->drupalPostForm("$translation_base_url/fr/add", $edit, t('Save translation')); + $this->drupalPostForm("$translation_base_url/fr/add", $edit, 'Save translation'); $this->assertRaw(t('Successfully saved @language translation.', ['@language' => 'French'])); // Check for edit, delete links (and no 'add' link) for French language. @@ -202,14 +202,14 @@ public function testSiteInformationTranslationUi() { 'langcode' => 'fr', 'translation' => 'untranslated', ]; - $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); + $this->drupalPostForm('admin/config/regional/translate', $search, 'Filter'); $textarea = current($this->xpath('//textarea')); $lid = $textarea->getAttribute('name'); $edit = [ $lid => $fr_site_name_label, ]; - $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations')); + $this->drupalPostForm('admin/config/regional/translate', $edit, 'Save translations'); // Ensure that the label is in French (and not in English). $this->drupalGet("fr/$translation_base_url/fr/edit"); @@ -247,7 +247,7 @@ public function testSourceValueDuplicateSave() { 'translation[config_names][system.site][slogan]' => 'FR ' . $site_slogan, ]; // First time, no overrides, so just Add link. - $this->drupalPostForm("$translation_base_url/fr/add", $edit, t('Save translation')); + $this->drupalPostForm("$translation_base_url/fr/add", $edit, 'Save translation'); // Read overridden file from active config. $override = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'system.site'); @@ -269,7 +269,7 @@ public function testSourceValueDuplicateSave() { 'translation[config_names][system.site][name]' => $site_name, 'translation[config_names][system.site][slogan]' => 'FR ' . $site_slogan, ]; - $this->drupalPostForm(NULL, $edit, t('Save translation')); + $this->drupalPostForm(NULL, $edit, 'Save translation'); $this->assertRaw(t('Successfully updated @language translation.', ['@language' => 'French'])); $override = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'system.site'); @@ -284,7 +284,7 @@ public function testSourceValueDuplicateSave() { 'translation[config_names][system.site][name]' => $site_name, 'translation[config_names][system.site][slogan]' => $site_slogan, ]; - $this->drupalPostForm(NULL, $edit, t('Save translation')); + $this->drupalPostForm(NULL, $edit, 'Save translation'); $override = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'system.site'); // Expect no language specific file. @@ -323,7 +323,7 @@ public function testContactConfigEntityTranslation() { 'recipients' => 'sales@example.com,support@example.com', 'reply' => 'Thank you for your mail', ]; - $this->drupalPostForm('admin/structure/contact/manage/feedback', $edit, t('Save')); + $this->drupalPostForm('admin/structure/contact/manage/feedback', $edit, 'Save'); // Ensure translation link is present. $translation_base_url = 'admin/structure/contact/manage/feedback/translate'; @@ -356,7 +356,7 @@ public function testContactConfigEntityTranslation() { ]; // Save language specific version of form. - $this->drupalPostForm($translation_page_url, $edit, t('Save translation')); + $this->drupalPostForm($translation_page_url, $edit, 'Save translation'); // Expect translated values in language specific file. $override = \Drupal::languageManager()->getLanguageConfigOverride($langcode, 'contact.form.feedback'); @@ -380,7 +380,7 @@ public function testContactConfigEntityTranslation() { 'subject[0][value]' => 'Test subject', 'message[0][value]' => 'Test message', ]; - $this->drupalPostForm(NULL, $edit, t('Send message')); + $this->drupalPostForm(NULL, $edit, 'Send message'); } // Now that all language translations are present, check translation and @@ -415,7 +415,7 @@ public function testContactConfigEntityTranslation() { // Assert link back to list page to cancel delete is present. $this->assertSession()->linkByHrefExists($translation_base_url); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertRaw(t('@language translation of %label was deleted', $replacements)); $this->assertSession()->linkByHrefExists("$translation_base_url/$langcode/add"); $this->assertSession()->linkByHrefNotExists("translation_base_url/$langcode/edit"); @@ -458,7 +458,7 @@ public function testDateFormatTranslation() { 'id' => 'custom_medium', 'date_format_pattern' => 'Y. m. d. H:i', ]; - $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); + $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, 'Add format'); // Test translating a default shipped format and our custom format. $formats = [ @@ -488,7 +488,7 @@ public function testDateFormatTranslation() { ]; // Save language specific version of form. - $this->drupalPostForm($translation_page_url, $edit, t('Save translation')); + $this->drupalPostForm($translation_page_url, $edit, 'Save translation'); // Get translation and check we've got the right value. $override = \Drupal::languageManager()->getLanguageConfigOverride('fr', 'core.date_format.' . $id); @@ -529,7 +529,7 @@ public function testAccountSettingsConfigurationTranslation() { 'translation[config_names][user.mail][status_blocked][body]' => 'Testing account blocked body.', ]; - $this->drupalPostForm('admin/config/people/accounts/translate/fr/add', $edit, t('Save translation')); + $this->drupalPostForm('admin/config/people/accounts/translate/fr/add', $edit, 'Save translation'); // Make sure the changes are saved and loaded back properly. $this->drupalGet('admin/config/people/accounts/translate/fr/edit'); @@ -617,7 +617,7 @@ public function testViewsTranslationUI() { 'translation[config_names][views.view.frontpage][display][default][display_title]' => $display_settings_master . " FR", 'translation[config_names][views.view.frontpage][display][default][display_options][title]' => $display_options_master . " FR", ]; - $this->drupalPostForm("$translation_base_url/fr/add", $edit, t('Save translation')); + $this->drupalPostForm("$translation_base_url/fr/add", $edit, 'Save translation'); $this->assertRaw(t('Successfully saved @language translation.', ['@language' => 'French'])); // Check for edit, delete links (and no 'add' link) for French language. @@ -653,7 +653,7 @@ public function testPluralConfigStringsSourceElements() { $this->drupalPostForm('admin/config/regional/translate/import', [ 'langcode' => $langcode, 'files[file]' => $name, - ], t('Import')); + ], 'Import'); // Change the config langcode of the 'files' view. $config = \Drupal::service('config.factory')->getEditable('views.view.files'); @@ -689,7 +689,7 @@ public function testPluralConfigStrings() { $this->drupalPostForm('admin/config/regional/translate/import', [ 'langcode' => 'sl', 'files[file]' => $name, - ], t('Import')); + ], 'Import'); // Translate the files view, as this one uses numeric formatters. $description = 'Singular form'; @@ -713,7 +713,7 @@ public function testPluralConfigStrings() { 'translation[config_names][views.view.files][display][default][display_options][fields][count][format_plural_string][2]' => $field_value_plural . ' 2 SL', 'translation[config_names][views.view.files][display][default][display_options][fields][count][format_plural_string][3]' => $field_value_plural . ' 3 SL', ]; - $this->drupalPostForm($translation_url, $edit, t('Save translation')); + $this->drupalPostForm($translation_url, $edit, 'Save translation'); // Make sure the values have changed. $this->drupalGet($translation_url); @@ -824,7 +824,7 @@ public function testLocaleDBStorage() { 'label' => $name, 'direction' => Language::DIRECTION_LTR, ]; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add custom language'); // Make sure there is no translation stored in locale storage before edit. $translation = $this->getTranslation('user.settings', 'anonymous', 'fr'); @@ -834,7 +834,7 @@ public function testLocaleDBStorage() { $edit = [ 'translation[config_names][user.settings][anonymous]' => 'Anonyme', ]; - $this->drupalPostForm('admin/config/people/accounts/translate/fr/add', $edit, t('Save translation')); + $this->drupalPostForm('admin/config/people/accounts/translate/fr/add', $edit, 'Save translation'); // Make sure translation stored in locale storage after saved language // specific configuration translation. @@ -845,7 +845,7 @@ public function testLocaleDBStorage() { $edit = [ 'translation[config_names][user.settings][anonymous]' => 'Anonymous', ]; - $this->drupalPostForm('admin/config/people/accounts/translate/fr/edit', $edit, t('Save translation')); + $this->drupalPostForm('admin/config/people/accounts/translate/fr/edit', $edit, 'Save translation'); // Make sure there is no translation stored in locale storage after revert. $translation = $this->getTranslation('user.settings', 'anonymous', 'fr'); @@ -859,18 +859,18 @@ public function testSingleLanguageUI() { $this->drupalLogin($this->adminUser); // Delete French language - $this->drupalPostForm('admin/config/regional/language/delete/fr', [], t('Delete')); + $this->drupalPostForm('admin/config/regional/language/delete/fr', [], 'Delete'); $this->assertRaw(t('The %language (%langcode) language has been removed.', ['%language' => 'French', '%langcode' => 'fr'])); // Change default language to Tamil. $edit = [ 'site_default_language' => 'ta', ]; - $this->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/language', $edit, 'Save configuration'); $this->assertRaw(t('Configuration saved.')); // Delete English language - $this->drupalPostForm('admin/config/regional/language/delete/en', [], t('Delete')); + $this->drupalPostForm('admin/config/regional/language/delete/en', [], 'Delete'); $this->assertRaw(t('The %language (%langcode) language has been removed.', ['%language' => 'English', '%langcode' => 'en'])); // Visit account setting translation page, this should not @@ -924,7 +924,7 @@ public function testSequenceTranslation() { 'translation[config_names][config_translation_test.content][animals][1]' => 'llama - FR', 'translation[config_names][config_translation_test.content][animals][2]' => 'elephant - FR', ]; - $this->drupalPostForm('admin/config/media/file-system/translate/fr/add', $edit, t('Save translation')); + $this->drupalPostForm('admin/config/media/file-system/translate/fr/add', $edit, 'Save translation'); $this->container->get('language.config_factory_override') ->setLanguage(new Language(['id' => 'fr'])); @@ -976,7 +976,7 @@ public function testTextFormatTranslation() { ]; // Save language specific version of form. - $this->drupalPostForm($translation_page_url, $edit, t('Save translation')); + $this->drupalPostForm($translation_page_url, $edit, 'Save translation'); // Get translation and check we've got the right value. $expected = [ @@ -1010,7 +1010,7 @@ public function testTextFormatTranslation() { $this->drupalLogin($this->translatorUser); $this->drupalGet($translation_page_url); $this->assertDisabledTextarea('edit-translation-config-names-config-translation-testcontent-content-value'); - $this->drupalPostForm(NULL, [], t('Save translation')); + $this->drupalPostForm(NULL, [], 'Save translation'); // Check that submitting the form did not update the text format of the // translation. $actual = $config_factory @@ -1023,7 +1023,7 @@ public function testTextFormatTranslation() { $edit = [ 'translation[config_names][config_translation_test.content][content][format]' => 'full_html', ]; - $this->drupalPostForm($translation_page_url, $edit, t('Save translation')); + $this->drupalPostForm($translation_page_url, $edit, 'Save translation'); $expected = [ 'value' => '

Hello World - FR

', 'format' => 'full_html', @@ -1118,7 +1118,7 @@ protected function setSiteInformation($site_name, $site_slogan) { 'site_name' => $site_name, 'site_slogan' => $site_slogan, ]; - $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/system/site-information', $edit, 'Save configuration'); $this->assertRaw(t('The configuration options have been saved.')); } diff --git a/core/modules/contact/tests/src/Functional/ContactLanguageTest.php b/core/modules/contact/tests/src/Functional/ContactLanguageTest.php index a0690a84d514322ee819e4fc870d060afe685155..417e07d442611f3c299112b50e556d05ac3972cb 100644 --- a/core/modules/contact/tests/src/Functional/ContactLanguageTest.php +++ b/core/modules/contact/tests/src/Functional/ContactLanguageTest.php @@ -58,7 +58,7 @@ public function testContactLanguage() { $settings_path = 'admin/config/regional/content-language'; $edit['entity_types[contact_message]'] = TRUE; $edit['settings[contact_message][feedback][settings][language][language_alterable]'] = TRUE; - $this->drupalPostForm($settings_path, $edit, t('Save configuration')); + $this->drupalPostForm($settings_path, $edit, 'Save configuration'); // Ensure that contact form now shows the language select. $this->drupalGet('contact'); diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index e8abc2601dfb58d8f91aeb578d734146c451b7cc..2cea31d68b1f8aa738d6937bc7c76f2d2977fc42 100644 --- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -202,7 +202,7 @@ public function testPersonalContactAccess() { // Disable the personal contact form. $this->drupalLogin($this->adminUser); $edit = ['contact_default_status' => FALSE]; - $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration'); $this->assertText('The configuration options have been saved.', 'Setting successfully saved.'); $this->drupalLogout(); @@ -239,7 +239,7 @@ public function testPersonalContactAccess() { $this->drupalGet('user/' . $this->webUser->id() . '/edit'); $this->assertSession()->checkboxNotChecked('edit-contact--2'); $this->assertNull(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form disabled'); - $this->drupalPostForm(NULL, ['contact' => TRUE], t('Save')); + $this->drupalPostForm(NULL, ['contact' => TRUE], 'Save'); $this->assertSession()->checkboxChecked('edit-contact--2'); $this->assertNotEmpty(\Drupal::service('user.data')->get('contact', $this->webUser->id(), 'enabled'), 'Personal contact form enabled'); @@ -320,7 +320,7 @@ protected function checkContactAccess($response, $contact_value = NULL) { if (isset($contact_value)) { $edit['contact'] = $contact_value; } - $this->drupalPostForm('admin/people/create', $edit, t('Create new account')); + $this->drupalPostForm('admin/people/create', $edit, 'Create new account'); $user = user_load_by_name($name); $this->drupalLogout(); @@ -345,7 +345,7 @@ protected function submitPersonalContact(AccountInterface $account, array $messa 'subject[0][value]' => $this->randomMachineName(16) . '< " =+ >', 'message[0][value]' => $this->randomMachineName(64) . '< " =+ >', ]; - $this->drupalPostForm('user/' . $account->id() . '/contact', $message, t('Send message')); + $this->drupalPostForm('user/' . $account->id() . '/contact', $message, 'Send message'); return $message; } diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php index 394ca7ed0706d6281e8406968f224f11924fc320..06c548cb30663e918155ce83112ee01658ca97e0 100644 --- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -106,7 +106,7 @@ public function testSiteWideContact() { // Set settings. $edit = []; $edit['contact_default_status'] = TRUE; - $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration'); $this->assertText('The configuration options have been saved.'); $this->drupalGet('admin/structure/contact'); @@ -333,7 +333,7 @@ public function testSiteWideContact() { 'message[0][value]' => $this->randomMachineName(), $field_name . '[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm(NULL, $edit, t('Send message')); + $this->drupalPostForm(NULL, $edit, 'Send message'); $mails = $this->getMails(); $mail = array_pop($mails); $this->assertEqual($mail['subject'], t('[@label] @subject', ['@label' => $label, '@subject' => $edit['subject[0][value]']])); @@ -355,7 +355,7 @@ public function testSiteWideContact() { 'message[0][value]' => $this->randomMachineName(), $field_name . '[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm(NULL, $edit, t('Send message')); + $this->drupalPostForm(NULL, $edit, 'Send message'); $this->assertText('Thanks for your submission.'); $this->assertSession()->addressEquals('user/' . $admin_user->id()); @@ -375,7 +375,7 @@ public function testSiteWideContact() { 'message[0][value]' => $this->randomMachineName(), $field_name . '[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm(NULL, $edit, t('Send message')); + $this->drupalPostForm(NULL, $edit, 'Send message'); $result = $this->xpath('//div[@role=:role]', [':role' => 'contentinfo']); $this->assertCount(0, $result, 'Messages not found.'); $this->assertSession()->addressEquals('user/' . $admin_user->id()); @@ -387,7 +387,7 @@ public function testSiteWideContact() { 'message[0][value]' => $this->randomMachineName(), $field_name . '[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm($form->toUrl('canonical'), $edit, t('Preview')); + $this->drupalPostForm($form->toUrl('canonical'), $edit, 'Preview'); // Message is now by default displayed twice, once for the form element and // once for the viewed message. @@ -400,9 +400,9 @@ public function testSiteWideContact() { $display_edit = [ 'fields[message][label]' => 'hidden', ]; - $this->drupalPostForm('admin/structure/contact/manage/' . $contact_form . '/display', $display_edit, t('Save')); + $this->drupalPostForm('admin/structure/contact/manage/' . $contact_form . '/display', $display_edit, 'Save'); - $this->drupalPostForm($form->toUrl('canonical'), $edit, t('Preview')); + $this->drupalPostForm($form->toUrl('canonical'), $edit, 'Preview'); // Message should only be displayed once now. $page_text = $this->getSession()->getPage()->getText(); $this->assertEquals(1, substr_count($page_text, t('Message'))); @@ -505,7 +505,7 @@ public function addContactForm($id, $label, $recipients, $reply, $selected, $mes $edit['reply'] = $reply; $edit['selected'] = ($selected ? TRUE : FALSE); $edit += $third_party_settings; - $this->drupalPostForm('admin/structure/contact/add', $edit, t('Save')); + $this->drupalPostForm('admin/structure/contact/add', $edit, 'Save'); } /** @@ -536,7 +536,7 @@ public function updateContactForm($id, $label, $recipients, $reply, $selected, $ $edit['selected'] = ($selected ? TRUE : FALSE); $edit['message'] = $message; $edit['redirect'] = $redirect; - $this->drupalPostForm("admin/structure/contact/manage/$id", $edit, t('Save')); + $this->drupalPostForm("admin/structure/contact/manage/$id", $edit, 'Save'); } /** @@ -560,10 +560,10 @@ public function submitContact($name, $mail, $subject, $id, $message) { $edit['subject[0][value]'] = $subject; $edit['message[0][value]'] = $message; if ($id == $this->config('contact.settings')->get('default_form')) { - $this->drupalPostForm('contact', $edit, t('Send message')); + $this->drupalPostForm('contact', $edit, 'Send message'); } else { - $this->drupalPostForm('contact/' . $id, $edit, t('Send message')); + $this->drupalPostForm('contact/' . $id, $edit, 'Send message'); } } @@ -579,7 +579,7 @@ public function deleteContactForms() { $this->assertSession()->statusCodeEquals(403); } else { - $this->drupalPostForm("admin/structure/contact/manage/$id/delete", [], t('Delete')); + $this->drupalPostForm("admin/structure/contact/manage/$id/delete", [], 'Delete'); $this->assertRaw(t('The contact form %label has been deleted.', ['%label' => $contact_form->label()])); $this->assertNull(ContactForm::load($id), new FormattableMarkup('Form %contact_form not found', ['%contact_form' => $contact_form->label()])); } diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php index 4e57a16624cf61fcc13c588ef26bd4bfe4ed00d0..10707a7931e47ef27b0904ea7aba027fb68cf2df 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php @@ -90,7 +90,7 @@ public function testModerationForm() { $this->drupalPostForm($edit_path, [ 'body[0][value]' => 'Second version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); // The canonical view should have a moderation form, because it is not the // live revision. @@ -102,7 +102,7 @@ public function testModerationForm() { $this->drupalPostForm($edit_path, [ 'body[0][value]' => 'Second version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Preview')); + ], 'Preview'); // The preview view should not have a moderation form. $preview_url = Url::fromRoute('entity.node.preview', [ @@ -122,7 +122,7 @@ public function testModerationForm() { $this->drupalPostForm($edit_path, [ 'body[0][value]' => 'Third version of the content.', 'moderation_state[0][state]' => 'published', - ], t('Save')); + ], 'Save'); // Check widget default value. $this->drupalGet($edit_path); @@ -152,7 +152,7 @@ public function testModerationForm() { $this->drupalPostForm($edit_path, [ 'body[0][value]' => 'Fourth version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); // The published view should not have a moderation form, because it is the // live revision. @@ -170,7 +170,7 @@ public function testModerationForm() { // Submit the moderation form to change status to published. $this->drupalPostForm($latest_version_path, [ 'new_state' => 'published', - ], t('Apply')); + ], 'Apply'); // The latest version page should not show, because there is no // pending revision. @@ -187,7 +187,7 @@ public function testNonBundleModerationForm() { $this->workflow->save(); // Create new moderated content in draft. - $this->drupalPostForm('entity_test_mulrevpub/add', ['moderation_state[0][state]' => 'draft'], t('Save')); + $this->drupalPostForm('entity_test_mulrevpub/add', ['moderation_state[0][state]' => 'draft'], 'Save'); // The latest version page should not show, because there is no pending // revision. @@ -195,7 +195,7 @@ public function testNonBundleModerationForm() { $this->assertSession()->statusCodeEquals(403); // Update the draft. - $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'draft'], t('Save')); + $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'draft'], 'Save'); // The latest version page should not show, because there is still no // pending revision. @@ -203,7 +203,7 @@ public function testNonBundleModerationForm() { $this->assertSession()->statusCodeEquals(403); // Publish the draft. - $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'published'], t('Save')); + $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'published'], 'Save'); // The published view should not have a moderation form, because it is the // default revision. @@ -217,7 +217,7 @@ public function testNonBundleModerationForm() { $this->assertSession()->statusCodeEquals(403); // Make a pending revision. - $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'draft'], t('Save')); + $this->drupalPostForm('entity_test_mulrevpub/manage/1/edit', ['moderation_state[0][state]' => 'draft'], 'Save'); // The published view should not have a moderation form, because it is the // default revision. @@ -235,7 +235,7 @@ public function testNonBundleModerationForm() { // Submit the moderation form to change status to published. $this->drupalPostForm('entity_test_mulrevpub/manage/1/latest', [ 'new_state' => 'published', - ], t('Apply')); + ], 'Apply'); // The latest version page should not show, because there is no // pending revision. @@ -260,7 +260,7 @@ public function testModerationFormSetsRevisionAuthor() { $this->drupalLogin($another_user); $this->drupalPostForm(sprintf('node/%d/latest', $node->id()), [ 'new_state' => 'published', - ], t('Apply')); + ], 'Apply'); $this->drupalGet(sprintf('node/%d/revisions', $node->id())); $this->assertText('by ' . $another_user->getAccountName()); @@ -280,7 +280,7 @@ public function testContentTranslationNodeForm() { $edit = [ 'predefined_langcode' => 'fr', ]; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); // Enable content translation on articles. $this->drupalGet('admin/config/regional/content-language'); @@ -289,7 +289,7 @@ public function testContentTranslationNodeForm() { 'settings[node][moderated_content][translatable]' => TRUE, 'settings[node][moderated_content][settings][language][language_alterable]' => TRUE, ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); // Adding languages requires a container rebuild in the test running // environment so that multilingual services are used. @@ -300,7 +300,7 @@ public function testContentTranslationNodeForm() { 'title[0][value]' => 'Some moderated content', 'body[0][value]' => 'First version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); $this->assertNotEmpty($this->xpath('//ul[@class="entity-moderation-form"]')); $node = $this->drupalGetNodeByTitle('Some moderated content'); @@ -322,7 +322,7 @@ public function testContentTranslationNodeForm() { $this->drupalPostForm(NULL, [ 'body[0][value]' => 'Second version of the content.', 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->drupalGet($latest_version_path, ['language' => $french]); $this->assertSession()->statusCodeEquals('403'); @@ -346,7 +346,7 @@ public function testContentTranslationNodeForm() { $this->drupalPostForm(NULL, [ 'body[0][value]' => 'Third version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->drupalGet($latest_version_path, ['language' => $french]); $this->assertNotEmpty($this->xpath('//ul[@class="entity-moderation-form"]')); @@ -366,7 +366,7 @@ public function testContentTranslationNodeForm() { $this->drupalPostForm(NULL, [ 'body[0][value]' => 'Fifth version of the content.', 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->drupalGet($latest_version_path, ['language' => $french]); $this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]')); @@ -379,7 +379,7 @@ public function testContentTranslationNodeForm() { $this->drupalPostForm(NULL, [ 'body[0][value]' => 'Sixth version of the content.', 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->drupalGet($latest_version_path); $this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]')); @@ -398,7 +398,7 @@ public function testContentTranslationNodeForm() { $this->drupalPostForm(NULL, [ 'body[0][value]' => 'Seventh version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->drupalGet($latest_version_path); $this->assertNotEmpty($this->xpath('//ul[@class="entity-moderation-form"]')); @@ -413,7 +413,7 @@ public function testContentTranslationNodeForm() { $this->drupalPostForm(NULL, [ 'body[0][value]' => 'Eighth version of the content.', 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->drupalGet($latest_version_path); $this->assertEmpty($this->xpath('//ul[@class="entity-moderation-form"]')); @@ -434,7 +434,7 @@ public function testContentTranslationNodeForm() { $this->drupalPostForm('node/add/moderated_content', [ 'title[0][value]' => 'Third moderated content', 'moderation_state[0][state]' => 'published', - ], t('Save')); + ], 'Save'); $node = $this->drupalGetNodeByTitle('Third moderated content'); $this->assertNotEmpty($node->language(), 'en'); @@ -448,7 +448,7 @@ public function testContentTranslationNodeForm() { $this->assertSession()->optionExists('moderation_state[0][state]', 'archived'); $this->drupalPostForm(NULL, [ 'moderation_state[0][state]' => 'draft', - ], t('Save (this translation)')); + ], 'Save (this translation)'); // Add another draft for the translation (revision 3). $this->drupalGet($edit_path, ['language' => $french]); @@ -457,7 +457,7 @@ public function testContentTranslationNodeForm() { $this->assertSession()->optionNotExists('moderation_state[0][state]', 'archived'); $this->drupalPostForm(NULL, [ 'moderation_state[0][state]' => 'draft', - ], t('Save (this translation)')); + ], 'Save (this translation)'); // Updating and publishing the french translation is still possible. $this->drupalGet($edit_path, ['language' => $french]); @@ -466,7 +466,7 @@ public function testContentTranslationNodeForm() { $this->assertSession()->optionNotExists('moderation_state[0][state]', 'archived'); $this->drupalPostForm(NULL, [ 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); // Now the french translation is published, an english draft can be added. $this->drupalGet($edit_path); @@ -475,7 +475,7 @@ public function testContentTranslationNodeForm() { $this->assertSession()->optionExists('moderation_state[0][state]', 'archived'); $this->drupalPostForm(NULL, [ 'moderation_state[0][state]' => 'draft', - ], t('Save (this translation)')); + ], 'Save (this translation)'); } /** diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php index 00566a8039adf2b6e328198df6a89e3fb1db6483..adc787b9bcb311d47e9f9e1e1dead0fe4389d74b 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php @@ -44,7 +44,7 @@ protected function setUp(): void { $edit = [ 'predefined_langcode' => $langcode, ]; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); } // Enable content translation on articles. @@ -54,7 +54,7 @@ protected function setUp(): void { 'settings[node][article][translatable]' => TRUE, 'settings[node][article][settings][language][language_alterable]' => TRUE, ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); // Adding languages requires a container rebuild in the test running // environment so that multilingual services are used. @@ -71,7 +71,7 @@ public function testTranslateModeratedContent() { 'langcode[0][value]' => 'en', 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm('node/add/article', $edit, t('Save')); + $this->drupalPostForm('node/add/article', $edit, 'Save'); $this->assertText('Article Published English node has been created.'); $english_node = $this->drupalGetNodeByTitle('Published English node'); @@ -82,7 +82,7 @@ public function testTranslateModeratedContent() { 'title[0][value]' => 'French node Draft', 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); // Here the error has occurred "The website encountered an unexpected error. // Please try again later." // If the translation has got lost. @@ -94,7 +94,7 @@ public function testTranslateModeratedContent() { 'langcode[0][value]' => 'en', 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/add/article', $edit, t('Save')); + $this->drupalPostForm('node/add/article', $edit, 'Save'); $this->assertText('Article English node has been created.'); $english_node = $this->drupalGetNodeByTitle('English node'); @@ -105,7 +105,7 @@ public function testTranslateModeratedContent() { 'title[0][value]' => 'French node', 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $this->assertText('Article French node has been updated.'); $english_node = $this->drupalGetNodeByTitle('English node', TRUE); @@ -113,7 +113,7 @@ public function testTranslateModeratedContent() { // unpublished. $this->drupalPostForm('node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->assertText('Article English node has been updated.'); $english_node = $this->drupalGetNodeByTitle('English node', TRUE); $french_node = $english_node->getTranslation('fr'); @@ -130,7 +130,7 @@ public function testTranslateModeratedContent() { 'title[0][value]' => 'Another node', 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('node/add/article', $edit, t('Save')); + $this->drupalPostForm('node/add/article', $edit, 'Save'); $this->assertText('Article Another node has been created.'); $english_node = $this->drupalGetNodeByTitle('Another node'); @@ -141,7 +141,7 @@ public function testTranslateModeratedContent() { 'title[0][value]' => 'Translated node', 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $this->assertText('Article Translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); @@ -149,7 +149,7 @@ public function testTranslateModeratedContent() { // unpublished. $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->assertText('Article Translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); @@ -163,7 +163,7 @@ public function testTranslateModeratedContent() { 'title[0][value]' => 'New draft of translated node', 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', $edit, t('Save (this translation)')); + $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', $edit, 'Save (this translation)'); $this->assertText('Article New draft of translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); @@ -174,7 +174,7 @@ public function testTranslateModeratedContent() { // Publish the French article before testing the archive transition. $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->assertText('Article New draft of translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); @@ -185,7 +185,7 @@ public function testTranslateModeratedContent() { // Publish the English article before testing the archive transition. $this->drupalPostForm('node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->assertText('Article Another node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $this->assertEqual($english_node->moderation_state->value, 'published'); @@ -193,11 +193,11 @@ public function testTranslateModeratedContent() { // Archive the node and its translation. $this->drupalPostForm('node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'archived', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->assertText('Article Another node has been updated.'); $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'archived', - ], t('Save (this translation)')); + ], 'Save (this translation)'); $this->assertText('Article New draft of translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); @@ -466,7 +466,7 @@ protected function submitNodeForm($title, $moderation_state, $default_translatio $default_translation = TRUE; $edit['langcode[0][value]'] = $langcode; } - $submit = $default_translation ? t('Save') : t('Save (this translation)'); + $submit = $default_translation ? 'Save' : 'Save (this translation)'; $this->drupalPostForm(NULL, $edit, $submit); $message = $is_new ? "Article $title has been created." : "Article $title has been updated."; $this->assertSession()->pageTextContains($message); diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php index 217df4cdb53b2ba5b89f1916d81eb81940a5e86d..dff3847ea0c94ca6890e90e44d10240caa5e9a02 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationRevisionRevertTest.php @@ -67,13 +67,13 @@ public function testEditingAfterRevertRevision() { $this->drupalPostForm('node/add/moderated_bundle', [ 'title[0][value]' => 'First draft node', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); // Now make it published. $this->drupalPostForm('node/1/edit', [ 'title[0][value]' => 'Published node', 'moderation_state[0][state]' => 'published', - ], t('Save')); + ], 'Save'); // Check the editing form that show the published title. $this->drupalGet('node/1/edit'); @@ -93,7 +93,7 @@ public function testEditingAfterRevertRevision() { // Try to save the node. $this->drupalPostForm('node/1/edit', [ 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); // Check if the submission passed the EntityChangedConstraintValidator. $this->assertSession() diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php index 2296f73be6c3e6a4b9831c4853cb1f9a275c6b70..a2062ebc94927bdd6ed41eab416f87b7d283a1e4 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php @@ -58,7 +58,7 @@ public function testCustomBlockModeration() { // Enable moderation for custom blocks. $edit['bundles[basic]'] = TRUE; - $this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/block_content', $edit, t('Save')); + $this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/block_content', $edit, 'Save'); // Create a custom block at block/add and save it as draft. $body = 'Body of moderated block'; @@ -67,7 +67,7 @@ public function testCustomBlockModeration() { 'moderation_state[0][state]' => 'draft', 'body[0][value]' => $body, ]; - $this->drupalPostForm('block/add', $edit, t('Save')); + $this->drupalPostForm('block/add', $edit, 'Save'); $this->assertText('basic Moderated block has been created.'); // Place the block in the Sidebar First region. @@ -78,7 +78,7 @@ public function testCustomBlockModeration() { ]; $block = BlockContent::load(1); $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default'); - $this->drupalPostForm($url, $instance, t('Save block')); + $this->drupalPostForm($url, $instance, 'Save block'); // Navigate to home page and check that the block is visible. It should be // visible because it is the default revision. @@ -91,7 +91,7 @@ public function testCustomBlockModeration() { 'body[0][value]' => $updated_body, 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('block/' . $block->id(), $edit, t('Save')); + $this->drupalPostForm('block/' . $block->id(), $edit, 'Save'); $this->assertText('basic Moderated block has been updated.'); // Navigate to the home page and check that the block shows the updated @@ -103,7 +103,7 @@ public function testCustomBlockModeration() { // Publish the block so we can create a pending revision. $this->drupalPostForm('block/' . $block->id(), [ 'moderation_state[0][state]' => 'published', - ], t('Save')); + ], 'Save'); // Create a pending revision. $pending_revision_body = 'This is the pending revision body value'; @@ -111,7 +111,7 @@ public function testCustomBlockModeration() { 'body[0][value]' => $pending_revision_body, 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm('block/' . $block->id(), $edit, t('Save')); + $this->drupalPostForm('block/' . $block->id(), $edit, 'Save'); $this->assertText('basic Moderated block has been updated.'); // Navigate to home page and check that the pending revision doesn't show, @@ -123,7 +123,7 @@ public function testCustomBlockModeration() { $edit = [ 'new_state' => 'published', ]; - $this->drupalPostForm('block/' . $block->id() . '/latest', $edit, t('Apply')); + $this->drupalPostForm('block/' . $block->id() . '/latest', $edit, 'Apply'); $this->assertText('The moderation state has been updated.'); // Navigate to home page and check that the pending revision is now the diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php index 8044b01a65189a1e997912a9975515f66ff26097..21b042f1f61ea09103cb5e63f2919dd15d83c916 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php @@ -34,7 +34,7 @@ public function testCreatingContent() { $this->drupalPostForm('node/add/moderated_content', [ 'title[0][value]' => 'moderated content', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); $node = $this->getNodeByTitle('moderated content'); if (!$node) { $this->fail('Test node was not saved correctly.'); @@ -45,7 +45,7 @@ public function testCreatingContent() { // Set up published revision. $this->drupalPostForm($path, [ 'moderation_state[0][state]' => 'published', - ], t('Save')); + ], 'Save'); \Drupal::entityTypeManager()->getStorage('node')->resetCache([$node->id()]); /* @var \Drupal\node\NodeInterface $node */ $node = \Drupal::entityTypeManager()->getStorage('node')->load($node->id()); @@ -56,12 +56,12 @@ public function testCreatingContent() { $this->assertNoText('Published'); // Delete the node. - $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete')); + $this->drupalPostForm('node/' . $node->id() . '/delete', [], 'Delete'); $this->assertText('The Moderated content moderated content has been deleted.'); // Disable content moderation. $edit['bundles[moderated_content]'] = FALSE; - $this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', $edit, t('Save')); + $this->drupalPostForm('admin/config/workflow/workflows/manage/editorial/type/node', $edit, 'Save'); // Ensure the parent environment is up-to-date. // @see content_moderation_workflow_insert() \Drupal::service('entity_type.bundle.info')->clearCachedBundles(); @@ -70,7 +70,7 @@ public function testCreatingContent() { // Create a new node. $this->drupalPostForm('node/add/moderated_content', [ 'title[0][value]' => 'non-moderated content', - ], t('Save')); + ], 'Save'); $node = $this->getNodeByTitle('non-moderated content'); if (!$node) { @@ -88,7 +88,7 @@ public function testFormSaveDestination() { 'title[0][value]' => 'Some moderated content', 'body[0][value]' => 'First version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); $node = $this->drupalGetNodeByTitle('Some moderated content'); $edit_path = sprintf('node/%d/edit', $node->id()); @@ -103,7 +103,7 @@ public function testFormSaveDestination() { $this->drupalPostForm($edit_path, [ 'body[0][value]' => 'Second version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); $this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()])); $this->assertText('Second version of the content.'); @@ -112,7 +112,7 @@ public function testFormSaveDestination() { $this->drupalPostForm($edit_path, [ 'body[0][value]' => 'Third version of the content.', 'moderation_state[0][state]' => 'published', - ], t('Save')); + ], 'Save'); $this->assertSession()->addressEquals(Url::fromRoute('entity.node.canonical', ['node' => $node->id()])); $this->assertText('Third version of the content.'); @@ -121,7 +121,7 @@ public function testFormSaveDestination() { $this->drupalPostForm($edit_path, [ 'body[0][value]' => 'Fourth version of the content.', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); $this->assertSession()->addressEquals(Url::fromRoute('entity.node.latest_version', ['node' => $node->id()])); $this->assertText('Fourth version of the content.'); } diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php index 44c714dd7db3b2211cf674ecd98f677ceb03e219..247f78a4b98d25040ae99dfb4ea1ef03019cc636 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTypeTest.php @@ -29,7 +29,7 @@ public function testNotModerated() { $this->assertRaw('Save'); $this->drupalPostForm(NULL, [ 'title[0][value]' => 'Test', - ], t('Save')); + ], 'Save'); $this->assertText('Not moderated Test has been created.'); } @@ -64,7 +64,7 @@ public function testEnablingOnExistingContent() { $this->drupalGet('node/add/not_moderated'); $this->drupalPostForm(NULL, [ 'title[0][value]' => 'Test', - ], t('Save')); + ], 'Save'); $this->assertText('Not moderated Test has been created.'); // Check that the 'Create new revision' is not disabled. diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php index 82562d94aa07a26fc27faf3d2faf2ec7581fcb3f..27ede210373203605a4c74af627bb11b12a00463 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php @@ -116,7 +116,7 @@ protected function createContentTypeFromUi($content_type_name, $content_type_id, 'name' => $content_type_name, 'type' => $content_type_id, ]; - $this->drupalPostForm(NULL, $edit, t('Save content type')); + $this->drupalPostForm(NULL, $edit, 'Save content type'); // Check the content type has been set to create new revisions. $this->assertTrue(NodeType::load($content_type_id)->shouldCreateNewRevision()); @@ -138,7 +138,7 @@ public function enableModerationThroughUi($content_type_id, $workflow_id = 'edit $this->drupalGet('/admin/config/workflow/workflows'); $this->assertSession()->linkByHrefExists('admin/config/workflow/workflows/manage/' . $workflow_id); $edit['bundles[' . $content_type_id . ']'] = TRUE; - $this->drupalPostForm('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/node', $edit, t('Save')); + $this->drupalPostForm('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/node', $edit, 'Save'); // Ensure the parent environment is up-to-date. // @see content_moderation_workflow_insert() \Drupal::service('entity_type.bundle.info')->clearCachedBundles(); diff --git a/core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php b/core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php index 6be4d3e00c12ce0b37a6f92bf6122b7e4ce727b2..23247e65b0c83be10a7853d026cfd91f29476509 100644 --- a/core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php +++ b/core/modules/content_moderation/tests/src/Functional/NodeAccessTest.php @@ -90,7 +90,7 @@ public function testPageAccess() { $this->drupalPostForm(NULL, [ 'title[0][value]' => 'moderated content', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); $node = $this->getNodeByTitle('moderated content'); if (!$node) { $this->fail('Test node was not saved correctly.'); @@ -120,7 +120,7 @@ public function testPageAccess() { $this->drupalLogin($this->adminUser); $this->drupalPostForm($edit_path, [ 'moderation_state[0][state]' => 'published', - ], t('Save')); + ], 'Save'); // Ensure access works correctly for anonymous users. $this->drupalLogout(); @@ -138,7 +138,7 @@ public function testPageAccess() { $this->drupalPostForm($edit_path, [ 'title[0][value]' => 'moderated content revised', 'moderation_state[0][state]' => 'draft', - ], t('Save')); + ], 'Save'); $this->drupalLogin($user); @@ -184,7 +184,7 @@ public function testPageAccess() { $this->assertSession()->statusCodeEquals(200); // Verify the moderation form is in place by publishing the node. - $this->drupalPostForm(NULL, [], t('Apply')); + $this->drupalPostForm(NULL, [], 'Apply'); $node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($node->id()); $this->assertEquals('published', $node->moderation_state->value); } diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php index 51058b89ee48aa0d0daf969f99220b536841d682..ffd226768bd1c2b3e0bcc6c4232e7a14e34d35c8 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationContextualLinksTest.php @@ -120,7 +120,7 @@ public function testContentTranslationContextualLinks() { 'settings[node][' . $this->bundle . '][translatable]' => TRUE, 'settings[node][' . $this->bundle . '][fields][field_test_text]' => TRUE, ]; - $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration'); $this->drupalLogout(); // Check that the link leads to the translate page. diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php index ffd8a675aa63cdfa3ce41c7377cdad625d9f34d6..b94826b1499724b47af9c9ad01df75e8f2e5e5e1 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php @@ -32,7 +32,7 @@ public function testEnable() { 'modules[content_translation][enable]' => TRUE, 'modules[language][enable]' => TRUE, ]; - $this->drupalPostForm('admin/modules', $edit, t('Install')); + $this->drupalPostForm('admin/modules', $edit, 'Install'); // Status messages are shown. $this->assertText('This site has only a single language enabled. Add at least one more language in order to translate content.'); @@ -54,7 +54,7 @@ public function testEnable() { 'entity_types[entity_test_mul]' => TRUE, 'settings[entity_test_mul][entity_test_mul][translatable]' => TRUE, ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); // No pending updates should be available. $this->drupalGet('admin/reports/status'); @@ -68,7 +68,7 @@ public function testEnable() { 'title_label' => 'title for foo', 'type' => 'foo', ]; - $this->drupalPostForm('admin/structure/types/add', $edit, t('Save content type')); + $this->drupalPostForm('admin/structure/types/add', $edit, 'Save content type'); $this->drupalGet('admin/config/regional/content-language'); $this->assertRaw('entity_types[node]'); } diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php index a68b99d53a6c786ca696c41ac26e85b24204f2e4..aabbd2c36c8176631dbfdcb6d563315e012e14bb 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationLanguageChangeTest.php @@ -68,7 +68,7 @@ protected function setUp(): void { 'settings[node][article][translatable]' => TRUE, 'settings[node][article][settings][language][language_alterable]' => TRUE, ]; - $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration'); // Add an image field. $this->drupalGet('admin/structure/types/manage/article/fields/add-field'); @@ -77,9 +77,9 @@ protected function setUp(): void { 'field_name' => 'image_field', 'label' => 'image_field', ]; - $this->drupalPostForm(NULL, $edit, t('Save and continue')); - $this->drupalPostForm(NULL, [], t('Save field settings')); - $this->drupalPostForm(NULL, [], t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save and continue'); + $this->drupalPostForm(NULL, [], 'Save field settings'); + $this->drupalPostForm(NULL, [], 'Save settings'); } /** @@ -91,12 +91,12 @@ public function testLanguageChange() { $edit = [ 'title[0][value]' => 'english_title', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Create a translation in French. $this->clickLink('Translate'); $this->clickLink('Add'); - $this->drupalPostForm(NULL, [], t('Save (this translation)')); + $this->drupalPostForm(NULL, [], 'Save (this translation)'); $this->clickLink('Translate'); // Edit English translation. @@ -107,8 +107,8 @@ public function testLanguageChange() { 'langcode[0][value]' => 'de', 'files[field_image_field_0]' => $images->uri, ]; - $this->drupalPostForm(NULL, $edit, t('Upload')); - $this->drupalPostForm(NULL, ['field_image_field[0][alt]' => 'alternative_text'], t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Upload'); + $this->drupalPostForm(NULL, ['field_image_field[0][alt]' => 'alternative_text'], 'Save (this translation)'); // Check that the translation languages are correct. $node = $this->getNodeByTitle('english_title'); @@ -127,13 +127,13 @@ public function testTitleDoesNotChangesOnChangingLanguageWidgetAndTriggeringAjax 'title[0][value]' => 'english_title', 'test_field_only_en_fr' => 'node created', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertEqual('node created', \Drupal::state()->get('test_field_only_en_fr')); // Create a translation in French. $this->clickLink('Translate'); $this->clickLink('Add'); - $this->drupalPostForm(NULL, [], t('Save (this translation)')); + $this->drupalPostForm(NULL, [], 'Save (this translation)'); $this->clickLink('Translate'); // Edit English translation. @@ -147,7 +147,7 @@ public function testTitleDoesNotChangesOnChangingLanguageWidgetAndTriggeringAjax 'langcode[0][value]' => 'de', 'files[field_image_field_0]' => $images->uri, ]; - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); // Test the expected title after triggering an ajax call with a new // language selected. $this->assertRaw('Edit Article english_title | Drupal'); @@ -155,7 +155,7 @@ public function testTitleDoesNotChangesOnChangingLanguageWidgetAndTriggeringAjax 'langcode[0][value]' => 'en', 'field_image_field[0][alt]' => 'alternative_text', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); // Check that the translation languages are correct. $node = $this->getNodeByTitle('english_title'); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php index 94de9378ad02605df38a6e1ccd9c2aa19a1e2bb3..28d9bccee97d1d309259b0f8db2d80db5b52bf5a 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php @@ -129,7 +129,7 @@ public function testOperationTranslateLink() { $this->drupalLogin($this->baseUser2); $this->drupalGet('node/' . $node->id()); $this->assertSession()->linkByHrefExists('node/' . $node->id() . '/translations'); - $this->drupalPostForm('admin/config/regional/content-language', ['settings[node][article][translatable]' => FALSE], t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', ['settings[node][article][translatable]' => FALSE], 'Save configuration'); $this->drupalGet('node/' . $node->id()); $this->assertSession()->linkByHrefNotExists('node/' . $node->id() . '/translations'); } diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php index fd1ac2eaa59f4c08589234eaa36ba8a37b212ab3..5875b3b4474a42aacd0f5d55ad945892adca0641 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationOutdatedRevisionTranslationTest.php @@ -55,7 +55,7 @@ public function testFlagAsOutdatedHidden() { 'title[0][value]' => 'Test 1.2 IT', 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); // Add a published French translation. $add_translation_url = Url::fromRoute("entity.{$this->entityTypeId}.content_translation_add", [ @@ -74,7 +74,7 @@ public function testFlagAsOutdatedHidden() { 'title[0][value]' => 'Test 1.3 FR', 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); // Create an English draft. $entity = $this->storage->loadUnchanged($id); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php index 428eed9e59243b77d3bf2bd3f8ac2686d1f7afae..f66208d1220dc3aba6517e1e533c32de55a3de49 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationPendingRevisionTestBase.php @@ -81,7 +81,7 @@ protected function enableContentModeration() { $workflow_id = 'editorial'; $this->drupalGet('/admin/config/workflow/workflows'); $edit['bundles[' . $this->bundle . ']'] = TRUE; - $this->drupalPostForm('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/' . $this->entityTypeId, $edit, t('Save')); + $this->drupalPostForm('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/' . $this->entityTypeId, $edit, 'Save'); // Ensure the parent environment is up-to-date. // @see content_moderation_workflow_insert() \Drupal::service('entity_type.bundle.info')->clearCachedBundles(); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationRevisionTranslationDeletionTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationRevisionTranslationDeletionTest.php index 83d9d2ebea71368aef0f376a4f4c53e8390e59b1..fa680fe942410397454f4c4e490ac6d49cd3e480 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationRevisionTranslationDeletionTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationRevisionTranslationDeletionTest.php @@ -77,7 +77,7 @@ public function doTestOverview($index) { 'title[0][value]' => "Test $index.2 IT", 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $entity = $this->storage->loadUnchanged($id); $this->assertFalse($entity->hasTranslation('it')); $it_revision = $this->loadRevisionTranslation($entity, 'it'); @@ -99,7 +99,7 @@ public function doTestOverview($index) { 'title[0][value]' => "Test $index.3 IT", 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $entity = $this->storage->loadUnchanged($id); $this->assertTrue($entity->hasTranslation('it')); $it_revision = $this->loadRevisionTranslation($entity, 'it'); @@ -119,7 +119,7 @@ public function doTestOverview($index) { 'title[0][value]' => "Test $index.4 EN", 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $entity = $this->storage->loadUnchanged($id); $this->assertTrue($entity->hasTranslation('it')); $en_revision = $this->loadRevisionTranslation($entity, 'en'); @@ -149,7 +149,7 @@ public function doTestOverview($index) { 'title[0][value]' => "Test $index.6 EN", 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $entity = $this->storage->loadUnchanged($id); $this->assertFalse($entity->hasTranslation('it')); $this->drupalLogin($this->currentAccount); @@ -160,7 +160,7 @@ public function doTestOverview($index) { 'title[0][value]' => "Test $index.7 IT", 'moderation_state[0][state]' => 'published', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $entity = $this->storage->loadUnchanged($id); $this->assertTrue($entity->hasTranslation('it')); $it_revision = $this->loadRevisionTranslation($entity, 'it'); @@ -174,7 +174,7 @@ public function doTestOverview($index) { 'title[0][value]' => "Test $index.8 IT", 'moderation_state[0][state]' => 'draft', ]; - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $entity = $this->storage->loadUnchanged($id); $this->assertTrue($entity->hasTranslation('it')); $it_revision = $this->loadRevisionTranslation($entity, 'it'); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php index b07f7062f664337eddb667200543e93aab7656f8..a74c7364e3a1a0aaa1a62606748109ea3dc87781 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSettingsTest.php @@ -169,7 +169,7 @@ public function testSettingsUI() { $this->drupalGet('admin/structure/types/manage/article'); $this->assertSession()->fieldExists('language_configuration[content_translation]'); $this->assertSession()->checkboxNotChecked('edit-language-configuration-content-translation'); - $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type')); + $this->drupalPostForm('admin/structure/types/manage/article', $edit, 'Save content type'); $this->drupalGet('admin/structure/types/manage/article'); $this->assertSession()->checkboxChecked('edit-language-configuration-content-translation'); @@ -195,7 +195,7 @@ public function testSettingsUI() { // Test that also the Field UI form behaves correctly. $translatable = !$translatable; $edit = ['translatable' => $translatable]; - $this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.body', $edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.body', $edit, 'Save settings'); $entity_field_manager->clearCachedFieldDefinitions(); $field = FieldConfig::loadByName('node', 'article', 'body'); $definitions = $entity_field_manager->getFieldDefinitions('node', 'article'); @@ -234,7 +234,7 @@ public function testAccountLanguageSettingsUI() { $edit = [ 'language[content_translation]' => TRUE, ]; - $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/people/accounts', $edit, 'Save configuration'); $this->drupalGet('admin/config/people/accounts'); $this->assertSession()->checkboxChecked('edit-language-content-translation'); @@ -260,7 +260,7 @@ public function testAccountLanguageSettingsUI() { * TRUE if the assertion succeeded, FALSE otherwise. */ protected function assertSettings($entity_type, $bundle, $enabled, $edit) { - $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration'); $args = ['@entity_type' => $entity_type, '@bundle' => $bundle, '@enabled' => $enabled ? 'enabled' : 'disabled']; $message = new FormattableMarkup('Translation for entity @entity_type (@bundle) is @enabled.', $args); return $this->assertEqual(\Drupal::service('content_translation.manager')->isEnabled($entity_type, $bundle), $enabled, $message); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php index 14c72d3ee95288664986d9903af4a4f967b54548..2ec9a7a50542e7104eb72b68b2fe3d61e4247cc6 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationSyncImageTest.php @@ -109,7 +109,7 @@ public function testImageFieldSync() { 'third_party_settings[content_translation][translation_sync][alt]' => FALSE, 'third_party_settings[content_translation][translation_sync][title]' => FALSE, ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); // Check that the content translation settings page reflects the changes // performed in the field edit page. @@ -121,7 +121,7 @@ public function testImageFieldSync() { 'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][alt]' => TRUE, 'settings[entity_test_mul][entity_test_mul][columns][field_test_et_ui_image][title]' => TRUE, ]; - $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration'); $errors = $this->xpath('//div[contains(@class, "messages--error")]'); $this->assertEmpty($errors, 'Settings correctly stored.'); $this->assertSession()->checkboxChecked('edit-settings-entity-test-mul-entity-test-mul-columns-field-test-et-ui-image-alt'); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php index f9ae86f2a34117b22352c67f7fd1cf471f59e21b..16f0c9eb6e75cae3b17efeee155e7c5c3a8ab431 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationUITestBase.php @@ -178,7 +178,7 @@ protected function doTestBasicTranslation() { ], ['language' => $language]); // This does not save anything, it merely reloads the form and fills in the // fields with the values from the different source language. - $this->drupalPostForm($add_url, $edit, t('Change')); + $this->drupalPostForm($add_url, $edit, 'Change'); $this->assertSession()->fieldValueEquals("{$this->fieldName}[0][value]", $values[$source_langcode][$this->fieldName][0]['value']); // Add another translation and mark the other ones as outdated. @@ -370,8 +370,8 @@ protected function doTestTranslationDeletion() { $entity = $storage->load($this->entityId); $language = ConfigurableLanguage::load($langcode); $url = $entity->toUrl('edit-form', ['language' => $language]); - $this->drupalPostForm($url, [], t('Delete translation')); - $this->drupalPostForm(NULL, [], t('Delete @language translation', ['@language' => $language->getName()])); + $this->drupalPostForm($url, [], 'Delete translation'); + $this->drupalPostForm(NULL, [], 'Delete ' . $language->getName() . ' translation'); $storage->resetCache([$this->entityId]); $entity = $storage->load($this->entityId, TRUE); $this->assertIsObject($entity); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php index 9183e69dd6665e76b70ab0aad2eda2c0d1a4bd35..3c37a708426f19b356f270995ad419c6760c28f7 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php @@ -172,7 +172,7 @@ protected function setupEntity(UserInterface $user = NULL) { 'name[0][value]' => 'translation name', 'content_translation[status]' => FALSE, ]; - $this->drupalPostForm($add_translation_url, $edit, t('Save')); + $this->drupalPostForm($add_translation_url, $edit, 'Save'); $storage->resetCache([$id]); $this->entity = $storage->load($id); diff --git a/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php b/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php index 5a3bb717872b2da875675b61ffa696a57024f28d..b0b58d513a6d101da6f820efae24566b65f2b3df 100644 --- a/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php +++ b/core/modules/content_translation/tests/src/FunctionalJavascript/ContentTranslationContextualLinksTest.php @@ -48,7 +48,7 @@ protected function setUp(): void { 'entity_types[node]' => TRUE, 'settings[node][page][translatable]' => TRUE, ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $this->drupalLogout(); // Create a translator user. diff --git a/core/modules/datetime/tests/src/Functional/DateFilterTest.php b/core/modules/datetime/tests/src/Functional/DateFilterTest.php index 0487fa1d56c0b7263ebc4150e9318fd0add16309..9f9e197d437e041c6bd286a54164e71386ff716f 100644 --- a/core/modules/datetime/tests/src/Functional/DateFilterTest.php +++ b/core/modules/datetime/tests/src/Functional/DateFilterTest.php @@ -99,8 +99,8 @@ public function testLimitExposedOperators() { $edit = []; $edit['options[operator]'] = '>'; $edit['options[expose][operator_list][]'] = ['>', '>=', 'between']; - $this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, t('Apply')); - $this->drupalPostForm('admin/structure/views/view/test_exposed_filter_datetime/edit/default', [], t('Save')); + $this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, 'Apply'); + $this->drupalPostForm('admin/structure/views/view/test_exposed_filter_datetime/edit/default', [], 'Save'); $this->drupalGet('test_exposed_filter_datetime'); $this->assertSession()->statusCodeEquals(200); @@ -118,7 +118,7 @@ public function testLimitExposedOperators() { $edit = []; $edit['options[operator]'] = '='; $edit['options[expose][operator_list][]'] = ['<', '>']; - $this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, t('Apply')); + $this->drupalPostForm('admin/structure/views/nojs/handler/test_exposed_filter_datetime/default/filter/field_date_value', $edit, 'Apply'); $this->assertText('You selected the "Is equal to" operator as the default value but is not included in the list of limited operators.'); } diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php index 6dd409f5a578ac7be6ff9d7edb9bf3b103abe41d..d0bf17eb3353dc5f7463eb06a7cdf873e6ef5632 100644 --- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php +++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php @@ -74,7 +74,7 @@ public function testDateField() { $edit = [ "{$field_name}[0][value][date]" => $date->format($date_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -86,11 +86,11 @@ public function testDateField() { $entity = EntityTest::load($id); $this->assertEqual('2012-12-31', $entity->{$field_name}->value); $this->drupalGet('entity_test/manage/' . $id . '/edit'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->drupalGet('entity_test/manage/' . $id . '/edit'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->drupalGet('entity_test/manage/' . $id . '/edit'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $entity = EntityTest::load($id); $this->assertEqual('2012-12-31', $entity->{$field_name}->value); @@ -269,7 +269,7 @@ public function testDatetimeField() { "{$field_name}[0][value][date]" => $date->format($date_format), "{$field_name}[0][value][time]" => $date->format($time_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -496,7 +496,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -536,7 +536,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -573,7 +573,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); foreach ($expected as $expected_text) { $this->assertText($expected_text); @@ -589,7 +589,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; @@ -604,7 +604,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-minute", '0')->isSelected()); } @@ -700,7 +700,7 @@ public function testDefaultValue() { $field_edit = [ 'default_value_input[default_date_type]' => 'now', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name); @@ -730,7 +730,7 @@ public function testDefaultValue() { 'default_value_input[default_date_type]' => 'relative', 'default_value_input[default_date]' => 'invalid date', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); $this->assertText('The relative date value entered is invalid.'); @@ -739,7 +739,7 @@ public function testDefaultValue() { 'default_value_input[default_date_type]' => 'relative', 'default_value_input[default_date]' => '+90 days', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name); @@ -769,7 +769,7 @@ public function testDefaultValue() { $field_edit = [ 'default_value_input[default_date_type]' => '', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name); @@ -812,7 +812,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Empty date value has been caught.'); $date_value = 'aaaa-12-01'; @@ -820,7 +820,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => '00:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', new FormattableMarkup('Invalid year value %date has been caught.', ['%date' => $date_value])); $date_value = '2012-75-01'; @@ -828,7 +828,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => '00:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', new FormattableMarkup('Invalid month value %date has been caught.', ['%date' => $date_value])); $date_value = '2012-12-99'; @@ -836,7 +836,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => '00:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', new FormattableMarkup('Invalid day value %date has been caught.', ['%date' => $date_value])); $date_value = '2012-12-01'; @@ -845,7 +845,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Empty time value has been caught.'); $date_value = '2012-12-01'; @@ -854,7 +854,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', new FormattableMarkup('Invalid hour value %time has been caught.', ['%time' => $time_value])); $date_value = '2012-12-01'; @@ -863,7 +863,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', new FormattableMarkup('Invalid minute value %time has been caught.', ['%time' => $time_value])); $date_value = '2012-12-01'; @@ -872,7 +872,7 @@ public function testInvalidField() { "{$field_name}[0][value][date]" => $date_value, "{$field_name}[0][value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', new FormattableMarkup('Invalid second value %time has been caught.', ['%time' => $time_value])); } @@ -912,7 +912,7 @@ public function testDateStorageSettings() { 'body[0][value]' => $this->randomString(), $field_name . '[0][value][date]' => '2016-04-01', ]; - $this->drupalPostForm('node/add/date_content', $edit, t('Save')); + $this->drupalPostForm('node/add/date_content', $edit, 'Save'); $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage'); $result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]"); $this->assertCount(1, $result, "Changing datetime setting is disabled."); diff --git a/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php b/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php index 266187122f8a14233755ad09d7c0ebc22a9e85df..450cd559c0d0bd096489a50e7b6a8e77dc08a39a 100644 --- a/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php +++ b/core/modules/datetime/tests/src/Functional/DateTimeTimeAgoFormatterTest.php @@ -109,7 +109,7 @@ public function testSettings() { 'fields[field_datetime][region]' => 'content', 'fields[field_datetime][type]' => 'datetime_time_ago', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->drupalPostForm(NULL, [], 'field_datetime_settings_edit'); $edit = [ diff --git a/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php b/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php index 34246b7b34ae4634d5b2eae747c92d780c891196..8922fdddfe126aed85f4d50c57dfec8ec0906991 100644 --- a/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php +++ b/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php @@ -117,7 +117,7 @@ protected function setUp(): void { */ public function testExposedGroupedFilters() { // Expose the empty and not empty operators in a grouped filter. - $this->drupalPostForm('admin/structure/views/nojs/handler/test_filter_datetime/default/filter/' . $this->fieldName . '_value', [], t('Expose filter')); + $this->drupalPostForm('admin/structure/views/nojs/handler/test_filter_datetime/default/filter/' . $this->fieldName . '_value', [], 'Expose filter'); $this->drupalPostForm(NULL, [], 'Grouped filters'); $edit = []; @@ -132,7 +132,7 @@ public function testExposedGroupedFilters() { $path = 'test_filter_datetime-path'; $this->drupalPostForm('admin/structure/views/view/test_filter_datetime/edit', [], 'Add Page'); $this->drupalPostForm('admin/structure/views/nojs/display/test_filter_datetime/page_1/path', ['path' => $path], 'Apply'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->drupalGet($path); diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php index 8cdc936c5e91db6a264fdd0652feeb5dbfd19e75..f6abf31598567a67b528cb7a535af57a7d69d235 100644 --- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php +++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php @@ -89,7 +89,7 @@ public function testDateRangeField() { "{$field_name}[0][value][date]" => $start_date->format($date_format), "{$field_name}[0][end_value][date]" => $end_date->format($date_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -103,11 +103,11 @@ public function testDateRangeField() { $this->assertEqual('2012-12-31', $entity->{$field_name}->value); $this->assertEqual('2013-06-06', $entity->{$field_name}->end_value); $this->drupalGet('entity_test/manage/' . $id . '/edit'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->drupalGet('entity_test/manage/' . $id . '/edit'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->drupalGet('entity_test/manage/' . $id . '/edit'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $entity = EntityTest::load($id); $this->assertEqual('2012-12-31', $entity->{$field_name}->value); $this->assertEqual('2013-06-06', $entity->{$field_name}->end_value); @@ -215,7 +215,7 @@ public function testDateRangeField() { "{$field_name}[0][end_value][date]" => $start_date->format($date_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -322,7 +322,7 @@ public function testDatetimeRangeField() { "{$field_name}[0][end_value][date]" => $end_date->format($date_format), "{$field_name}[0][end_value][time]" => $end_date->format($time_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -407,7 +407,7 @@ public function testDatetimeRangeField() { "{$field_name}[0][end_value][time]" => $start_date->format($time_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -495,7 +495,7 @@ public function testAlldayRangeField() { "{$field_name}[0][value][date]" => $start_date->format($date_format), "{$field_name}[0][end_value][date]" => $end_date->format($date_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -579,7 +579,7 @@ public function testAlldayRangeField() { "{$field_name}[0][value][date]" => $start_date->format($date_format), "{$field_name}[0][end_value][date]" => $start_date->format($date_format), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -767,7 +767,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][end_value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -822,7 +822,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][end_value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -868,7 +868,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][end_value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); foreach ($expected as $expected_text) { $this->assertText($expected_text); @@ -888,7 +888,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][end_value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; @@ -907,7 +907,7 @@ public function testDatelistWidget() { $edit["{$field_name}[0][end_value][$part]"] = $value; } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-minute", '0')->isSelected()); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-end-value-minute", '0')->isSelected()); @@ -1020,7 +1020,7 @@ public function testDefaultValue() { 'default_value_input[default_date_type]' => 'now', 'default_value_input[default_end_date_type]' => 'now', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name); @@ -1056,7 +1056,7 @@ public function testDefaultValue() { 'default_value_input[default_end_date_type]' => 'relative', 'default_value_input[default_end_date]' => '+1 day', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); $this->assertText('The relative start date value entered is invalid.'); $field_edit = [ @@ -1065,7 +1065,7 @@ public function testDefaultValue() { 'default_value_input[default_end_date_type]' => 'relative', 'default_value_input[default_end_date]' => 'invalid date', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); $this->assertText('The relative end date value entered is invalid.'); // Set a relative default_value. @@ -1075,7 +1075,7 @@ public function testDefaultValue() { 'default_value_input[default_end_date_type]' => 'relative', 'default_value_input[default_end_date]' => '+90 days', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name); @@ -1110,7 +1110,7 @@ public function testDefaultValue() { 'default_value_input[default_date_type]' => '', 'default_value_input[default_end_date_type]' => '', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name); @@ -1146,7 +1146,7 @@ public function testDefaultValue() { 'default_value_input[default_date_type]' => 'now', 'default_value_input[default_end_date_type]' => '', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Make sure only the start value is populated on node add page. $this->drupalGet('node/add/date_content'); @@ -1158,7 +1158,7 @@ public function testDefaultValue() { 'default_value_input[default_date_type]' => '', 'default_value_input[default_end_date_type]' => 'now', ]; - $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name, $field_edit, 'Save settings'); // Make sure only the start value is populated on node add page. $this->drupalGet('node/add/date_content'); @@ -1190,7 +1190,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Empty start date value has been caught.'); $date_value = 'aaaa-12-01'; @@ -1200,7 +1200,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid start year value ' . $date_value . ' has been caught.'); $date_value = '2012-75-01'; @@ -1210,7 +1210,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid start month value ' . $date_value . ' has been caught.'); $date_value = '2012-12-99'; @@ -1220,7 +1220,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid start day value ' . $date_value . ' has been caught.'); // Submit invalid start times and ensure they is not accepted. @@ -1231,7 +1231,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Empty start time value has been caught.'); $time_value = '49:00:00'; @@ -1241,7 +1241,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid start hour value ' . $time_value . ' has been caught.'); $time_value = '12:99:00'; @@ -1251,7 +1251,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid start minute value ' . $time_value . ' has been caught.'); $time_value = '12:15:99'; @@ -1261,7 +1261,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid start second value ' . $time_value . ' has been caught.'); // Submit invalid end dates and ensure they is not accepted. @@ -1272,7 +1272,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => $date_value, "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Empty end date value has been caught.'); $date_value = 'aaaa-12-01'; @@ -1282,7 +1282,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => $date_value, "{$field_name}[0][end_value][time]" => '00:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid end year value ' . $date_value . ' has been caught.'); $date_value = '2012-75-01'; @@ -1292,7 +1292,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => $date_value, "{$field_name}[0][end_value][time]" => '00:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid end month value ' . $date_value . ' has been caught.'); $date_value = '2012-12-99'; @@ -1302,7 +1302,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => $date_value, "{$field_name}[0][end_value][time]" => '00:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid end day value ' . $date_value . ' has been caught.'); // Submit invalid start times and ensure they is not accepted. @@ -1313,7 +1313,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Empty end time value has been caught.'); $time_value = '49:00:00'; @@ -1323,7 +1323,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid end hour value ' . $time_value . ' has been caught.'); $time_value = '12:99:00'; @@ -1333,7 +1333,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid end minute value ' . $time_value . ' has been caught.'); $time_value = '12:15:99'; @@ -1343,7 +1343,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => $time_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('date is invalid', 'Invalid end second value ' . $time_value . ' has been caught.'); $edit = [ @@ -1352,7 +1352,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2010-12-01', "{$field_name}[0][end_value][time]" => '12:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('The ' . $field_label . ' end date cannot be before the start date', 'End date before start date has been caught.'); $edit = [ @@ -1361,7 +1361,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][date]" => '2012-12-01', "{$field_name}[0][end_value][time]" => '11:00:00', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('The ' . $field_label . ' end date cannot be before the start date', 'End time before start time has been caught.'); } @@ -1402,7 +1402,7 @@ public function testDateStorageSettings() { $field_name . '[0][value][date]' => '2016-04-01', $field_name . '[0][end_value][date]' => '2016-04-02', ]; - $this->drupalPostForm('node/add/date_content', $edit, t('Save')); + $this->drupalPostForm('node/add/date_content', $edit, 'Save'); $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage'); $result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]"); $this->assertCount(1, $result, "Changing datetime setting is disabled."); diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index defc24fcb8107ec1a76353317afeaa0fd02d9930..67ad71d5da6ea2fbc5618fc50db09755639af041 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -255,7 +255,7 @@ private function verifyRowLimit($row_limit) { // Change the database log row limit. $edit = []; $edit['dblog_row_limit'] = $row_limit; - $this->drupalPostForm('admin/config/development/logging', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/development/logging', $edit, 'Save configuration'); $this->assertSession()->statusCodeEquals(200); // Check row limit variable. @@ -286,7 +286,7 @@ protected function filterLogsEntries($type = NULL, $severity = NULL) { if (isset($severity)) { $edit['severity[]'] = $severity; } - $this->drupalPostForm(NULL, $edit, t('Filter')); + $this->drupalPostForm(NULL, $edit, 'Filter'); } /** @@ -419,7 +419,7 @@ private function doUser() { $edit['pass[pass1]'] = $pass; $edit['pass[pass2]'] = $pass; $edit['status'] = 1; - $this->drupalPostForm('admin/people/create', $edit, t('Create new account')); + $this->drupalPostForm('admin/people/create', $edit, 'Create new account'); $this->assertSession()->statusCodeEquals(200); // Retrieve the user object. $user = user_load_by_name($name); @@ -442,7 +442,7 @@ private function doUser() { $this->drupalLogin($this->adminUser); // Delete the user created at the start of this test. // We need to POST here to invoke batch_process() in the internal browser. - $this->drupalPostForm('user/' . $user->id() . '/cancel', ['user_cancel_method' => 'user_cancel_reassign'], t('Cancel account')); + $this->drupalPostForm('user/' . $user->id() . '/cancel', ['user_cancel_method' => 'user_cancel_reassign'], 'Cancel account'); // View the database log report. $this->drupalGet('admin/reports/dblog'); @@ -502,17 +502,17 @@ private function doNode($type) { // (which is not triggered by drupalCreateNode). $edit = $this->getContent($type); $title = $edit['title[0][value]']; - $this->drupalPostForm('node/add/' . $type, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $type, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); // Retrieve the node object. $node = $this->drupalGetNodeByTitle($title); $this->assertNotNull($node, new FormattableMarkup('Node @title was loaded', ['@title' => $title])); // Edit the node. $edit = $this->getContentUpdate($type); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); // Delete the node. - $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete')); + $this->drupalPostForm('node/' . $node->id() . '/delete', [], 'Delete'); $this->assertSession()->statusCodeEquals(200); // View the node (to generate page not found event). $this->drupalGet('node/' . $node->id()); diff --git a/core/modules/editor/tests/src/Functional/EditorAdminTest.php b/core/modules/editor/tests/src/Functional/EditorAdminTest.php index 4015bd1403c7c3f792c95484708d25015e2aba37..2cb0c7840499756bfecf8f3e686df9d7b2cac650 100644 --- a/core/modules/editor/tests/src/Functional/EditorAdminTest.php +++ b/core/modules/editor/tests/src/Functional/EditorAdminTest.php @@ -86,7 +86,7 @@ public function testAddEditorToExistingFormat() { $edit = $this->selectUnicornEditor(); // Configure Unicorn Editor's setting to another value. $edit['editor[settings][ponies_too]'] = FALSE; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); $this->verifyUnicornEditorConfiguration('filtered_html', FALSE); // Switch back to 'None' and check the Unicorn Editor's settings are gone. @@ -174,7 +174,7 @@ protected function addEditorToNewFormat($format_id, $format_name) { 'format' => $format_id, ]; $edit += $this->selectUnicornEditor(); - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); } /** diff --git a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php index fafba031e5c6df70b89ce09b197bb9fb4226d61e..0aaf1064dbc08f36967abb13cb078f076a423900 100644 --- a/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php +++ b/core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php @@ -203,7 +203,7 @@ protected function uploadImage($uri) { 'files[fid]' => \Drupal::service('file_system')->realpath($uri), ]; $this->drupalGet('editor/dialog/image/basic_html'); - $this->drupalPostForm('editor/dialog/image/basic_html', $edit, t('Upload')); + $this->drupalPostForm('editor/dialog/image/basic_html', $edit, 'Upload'); $uploaded_image_file = $this->container->get('image.factory')->get('public://inline-images/' . basename($uri)); return [ (int) $uploaded_image_file->getWidth(), diff --git a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php index c3b00e830fe1606110d1b42c62dbcb1c2ca4cb86..c271edae88dc219242f9c1230cf30768bfedbedb 100644 --- a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php +++ b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php @@ -114,7 +114,7 @@ public function testBooleanField() { $edit = [ "{$field_name}[value]" => 1, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -144,7 +144,7 @@ public function testBooleanField() { $edit = [ 'settings[on_label]' => $on, ]; - $this->drupalPostForm('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field_name, $edit, t('Save settings')); + $this->drupalPostForm('entity_test/structure/entity_test/fields/entity_test.entity_test.' . $field_name, $edit, 'Save settings'); // Check if we see the updated labels in the creation form. $this->drupalGet('entity_test/add'); $this->assertRaw($on); @@ -233,7 +233,7 @@ public function testFormAccess() { $this->assertSession()->fieldExists("{$field_name}[value]"); // Should be posted OK. - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); @@ -244,7 +244,7 @@ public function testFormAccess() { // Field should not be there anymore. $this->assertSession()->fieldNotExists("{$field_name}[value]"); // Should still be able to post the form. - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); diff --git a/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php b/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php index 1a92eb088307cf5892da542d21742f16d4805f8c..9a32063607b5861d6bb0c025c05377b11080f292 100644 --- a/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php +++ b/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php @@ -97,7 +97,7 @@ public function testEmailField() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.'); diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php index ffc1652d3ddd230caeabdd3d6f51db81020812ed..c44856573d52c485aa1e3b31a33398a0d4567245 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php @@ -90,22 +90,22 @@ public function testFieldAdminHandler() { 'page[style][style_plugin]' => 'default', 'page[style][row_plugin]' => 'fields', ]; - $this->drupalPostForm('admin/structure/views/add', $edit, t('Save and edit')); - $this->drupalPostForm(NULL, [], t('Duplicate as Entity Reference')); + $this->drupalPostForm('admin/structure/views/add', $edit, 'Save and edit'); + $this->drupalPostForm(NULL, [], 'Duplicate as Entity Reference'); $this->clickLink(t('Settings')); $edit = [ 'style_options[search_fields][title]' => 'title', ]; - $this->drupalPostForm(NULL, $edit, t('Apply')); + $this->drupalPostForm(NULL, $edit, 'Apply'); // Set sort to NID ascending. $edit = [ 'name[node_field_data.nid]' => 1, ]; - $this->drupalPostForm('admin/structure/views/nojs/add-handler/node_test_view/entity_reference_1/sort', $edit, t('Add and configure sort criteria')); - $this->drupalPostForm(NULL, [], t('Apply')); + $this->drupalPostForm('admin/structure/views/nojs/add-handler/node_test_view/entity_reference_1/sort', $edit, 'Add and configure sort criteria'); + $this->drupalPostForm(NULL, [], 'Apply'); - $this->drupalPostForm('admin/structure/views/view/node_test_view/edit/entity_reference_1', [], t('Save')); + $this->drupalPostForm('admin/structure/views/view/node_test_view/edit/entity_reference_1', [], 'Save'); $this->clickLink(t('Settings')); // Create a test entity reference field. @@ -115,24 +115,24 @@ public function testFieldAdminHandler() { 'label' => 'Test Entity Reference Field', 'field_name' => $field_name, ]; - $this->drupalPostForm($bundle_path . '/fields/add-field', $edit, t('Save and continue')); + $this->drupalPostForm($bundle_path . '/fields/add-field', $edit, 'Save and continue'); // Set to unlimited. $edit = [ 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, ]; - $this->drupalPostForm(NULL, $edit, t('Save field settings')); + $this->drupalPostForm(NULL, $edit, 'Save field settings'); // Add the view to the test field. $edit = [ 'settings[handler]' => 'views', ]; - $this->drupalPostForm(NULL, $edit, t('Change handler')); + $this->drupalPostForm(NULL, $edit, 'Change handler'); $edit = [ 'required' => FALSE, 'settings[handler_settings][view][view_and_display]' => 'node_test_view:entity_reference_1', ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); // Create nodes. $node1 = Node::create([ @@ -156,20 +156,20 @@ public function testFieldAdminHandler() { // Try to add a new node, fill the entity reference field and submit the // form. - $this->drupalPostForm('node/add/' . $this->type, [], t('Add another item')); + $this->drupalPostForm('node/add/' . $this->type, [], 'Add another item'); $edit = [ 'title[0][value]' => 'Example', 'field_test_entity_ref_field[0][target_id]' => 'Foo Node (' . $node1->id() . ')', 'field_test_entity_ref_field[1][target_id]' => 'Foo Node (' . $node2->id() . ')', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); $edit = [ 'title[0][value]' => 'Example', 'field_test_entity_ref_field[0][target_id]' => 'Test', ]; - $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $this->type, $edit, 'Save'); // Assert that entity reference autocomplete field is validated. $this->assertText('There are no entities matching "Test"'); @@ -178,7 +178,7 @@ public function testFieldAdminHandler() { 'title[0][value]' => 'Test', 'field_test_entity_ref_field[0][target_id]' => $node1->getTitle(), ]; - $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $this->type, $edit, 'Save'); // Assert the results multiple times to avoid sorting problem of nodes with // the same title. @@ -191,7 +191,7 @@ public function testFieldAdminHandler() { 'title[0][value]' => 'Test', 'field_test_entity_ref_field[0][target_id]' => $node1->getTitle() . ' (' . $node1->id() . ')', ]; - $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $this->type, $edit, 'Save'); $this->assertSession()->linkExists($node1->getTitle()); // Tests adding default values to autocomplete widgets. @@ -202,7 +202,7 @@ public function testFieldAdminHandler() { $edit = [ 'cardinality' => -1, ]; - $this->drupalPostForm(NULL, $edit, t('Save field settings')); + $this->drupalPostForm(NULL, $edit, 'Save field settings'); $this->drupalGet($bundle_path . '/fields/' . $field_path); $term_name = $this->randomString(); $result = \Drupal::entityQuery('taxonomy_term') @@ -215,13 +215,13 @@ public function testFieldAdminHandler() { // This must be set before new entities will be auto-created. 'settings[handler_settings][auto_create]' => 1, ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); $this->drupalGet($bundle_path . '/fields/' . $field_path); $edit = [ // A term that doesn't yet exist. 'default_value_input[field_' . $taxonomy_term_field_name . '][0][target_id]' => $term_name, ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); // The term should now exist. $result = \Drupal::entityQuery('taxonomy_term') ->condition('name', $term_name) @@ -330,7 +330,7 @@ public function testMultipleTargetBundles() { 'settings[handler_settings][auto_create]' => TRUE, 'settings[handler_settings][auto_create_bundle]' => $vocabularies[1]->id(), ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); /** @var \Drupal\field\Entity\FieldConfig $field_config */ $field_config = FieldConfig::load($field_id); diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php index f775b61a0403694b9573acee94904986b8e097f2..adc5c73303ea210114a487806c09465ccedeac6a 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php @@ -86,7 +86,7 @@ public function testEntityReferenceDefaultValue() { $field_edit = [ 'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node->getTitle() . ' (' . $referenced_node->id() . ')', ]; - $this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, 'Save settings'); // Check that default value is selected in default value form. $this->drupalGet('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name); @@ -150,7 +150,7 @@ public function testEntityReferenceDefaultConfigValue() { 'default_value_input[' . $field_name . '][0][target_id]' => $referenced_node_type->label() . ' (' . $referenced_node_type->id() . ')', 'default_value_input[' . $field_name . '][1][target_id]' => $referenced_node_type2->label() . ' (' . $referenced_node_type2->id() . ')', ]; - $this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/reference_content/fields/node.reference_content.' . $field_name, $field_edit, 'Save settings'); // Check that the field has a dependency on the default value. $config_entity = $this->config('field.field.node.reference_content.' . $field_name)->get(); diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php index b8893e534e126884398d610b248d187ad3f1b2c8..c609637a5d5c6136f4f0aba582a14b002f8141a3 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php @@ -163,7 +163,7 @@ public function testEntityReferenceDisplay() { // Disable translation for referrer content type. $this->drupalLogin($this->rootUser); - $this->drupalPostForm('admin/config/regional/content-language', ['settings[node][referrer][translatable]' => FALSE], t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', ['settings[node][referrer][translatable]' => FALSE], 'Save configuration'); $this->drupalLogout(); // Create a referrer entity without translation. diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php index 82804909e76bb8988f6bb77f8d55dffaf65e103c..aa19bb1039952e794bb59e4d3b21482a21aa9df3 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php @@ -92,7 +92,7 @@ public function testSupportedEntityTypesAndWidgets() { // Test an input of the entity label without an ' (entity_id)' suffix. $this->fieldName . '[1][target_id]' => $referenced_entities[1]->label(), ]; - $this->drupalPostForm($this->entityType . '/add', $edit, t('Save')); + $this->drupalPostForm($this->entityType . '/add', $edit, 'Save'); $this->assertFieldValues($entity_name, $referenced_entities); // Try to post the form again with no modification and check if the field @@ -104,7 +104,7 @@ public function testSupportedEntityTypesAndWidgets() { $this->assertSession()->fieldValueEquals($this->fieldName . '[0][target_id]', $referenced_entities[0]->label() . ' (' . $referenced_entities[0]->id() . ')'); $this->assertSession()->fieldValueEquals($this->fieldName . '[1][target_id]', $referenced_entities[1]->label() . ' (' . $referenced_entities[1]->id() . ')'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertFieldValues($entity_name, $referenced_entities); // Test the 'entity_reference_autocomplete_tags' widget. @@ -121,7 +121,7 @@ public function testSupportedEntityTypesAndWidgets() { 'name[0][value]' => $entity_name, $this->fieldName . '[target_id]' => $target_id, ]; - $this->drupalPostForm($this->entityType . '/add', $edit, t('Save')); + $this->drupalPostForm($this->entityType . '/add', $edit, 'Save'); $this->assertFieldValues($entity_name, $referenced_entities); // Try to post the form again with no modification and check if the field @@ -130,7 +130,7 @@ public function testSupportedEntityTypesAndWidgets() { $this->drupalGet($this->entityType . '/manage/' . $entity->id() . '/edit'); $this->assertSession()->fieldValueEquals($this->fieldName . '[target_id]', $target_id . ' (' . $referenced_entities[1]->id() . ')'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertFieldValues($entity_name, $referenced_entities); // Test all the other widgets supported by the entity reference field. @@ -147,7 +147,7 @@ public function testSupportedEntityTypesAndWidgets() { 'type' => $widget_type, ])->save(); - $this->drupalPostForm($this->entityType . '/manage/' . $entity->id() . '/edit', [], t('Save')); + $this->drupalPostForm($this->entityType . '/manage/' . $entity->id() . '/edit', [], 'Save'); $this->assertFieldValues($entity_name, $referenced_entities); } @@ -163,7 +163,7 @@ public function testSupportedEntityTypesAndWidgets() { if ($key == 'content') { $field_edit['settings[handler_settings][target_bundles][' . $referenced_entities[0]->getEntityTypeId() . ']'] = TRUE; } - $this->drupalPostForm($this->entityType . '/structure/' . $this->bundle . '/fields/' . $this->entityType . '.' . $this->bundle . '.' . $this->fieldName, $field_edit, t('Save settings')); + $this->drupalPostForm($this->entityType . '/structure/' . $this->bundle . '/fields/' . $this->entityType . '.' . $this->bundle . '.' . $this->fieldName, $field_edit, 'Save settings'); // Ensure the configuration has the expected dependency on the entity that // is being used a default value. $field = FieldConfig::loadByName($this->entityType, $this->bundle, $this->fieldName); diff --git a/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php b/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php index d1c7647aab80c9eaa7dbc8371b19e54726b43594..5441d75bb1c07067839d098c03d4d20b5324190a 100644 --- a/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php +++ b/core/modules/field/tests/src/Functional/FieldImportDeleteUninstallUiTest.php @@ -116,7 +116,7 @@ public function testImportDeleteUninstall() { // This will purge all the data, delete the field and uninstall the // Telephone and Text modules. - $this->drupalPostForm(NULL, [], t('Import all')); + $this->drupalPostForm(NULL, [], 'Import all'); $this->assertNoText('Field data will be deleted by this synchronization.'); $this->rebuildContainer(); $this->assertFalse(\Drupal::moduleHandler()->moduleExists('telephone')); diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index 976ecc9a262fc73419fbdf552959261d3ebe6023..e54634b2df9a1d5788d95e6fdf5dbacaaea4a0f4 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -137,7 +137,7 @@ public function testFieldFormSingle() { $edit = [ "{$field_name}[0][value]" => -1, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name does not accept the value -1.', ['%name' => $this->field['label']])); // TODO : check that the correct field is flagged for error. @@ -146,7 +146,7 @@ public function testFieldFormSingle() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -165,7 +165,7 @@ public function testFieldFormSingle() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('entity_test ' . $id . ' has been updated.', 'Entity was updated'); $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]); $entity = EntityTest::load($id); @@ -176,7 +176,7 @@ public function testFieldFormSingle() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save')); + $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, 'Save'); $this->assertText('entity_test ' . $id . ' has been updated.', 'Entity was updated'); $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]); $entity = EntityTest::load($id); @@ -208,7 +208,7 @@ public function testFieldFormDefaultValue() { $edit = [ "{$field_name}[0][value]" => '', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created.'); @@ -230,7 +230,7 @@ public function testFieldFormSingleRequired() { // Submit with missing required value. $edit = []; - $this->drupalPostForm('entity_test/add', $edit, t('Save')); + $this->drupalPostForm('entity_test/add', $edit, 'Save'); $this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']])); // Create an entity @@ -238,7 +238,7 @@ public function testFieldFormSingleRequired() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -250,7 +250,7 @@ public function testFieldFormSingleRequired() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save')); + $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, 'Save'); $this->assertRaw(t('@name field is required.', ['@name' => $this->field['label']])); } @@ -276,7 +276,7 @@ public function testFieldFormUnlimited() { $this->assertTrue(isset($elements[0]), 'aria-describedby attribute is properly placed on multiple value widgets.'); // Press 'add more' button -> 2 widgets. - $this->drupalPostForm(NULL, [], t('Add another item')); + $this->drupalPostForm(NULL, [], 'Add another item'); $this->assertSession()->fieldValueEquals("{$field_name}[0][value]", ''); $this->assertSession()->fieldValueEquals("{$field_name}[1][value]", ''); // Verify that no extraneous widget is displayed. @@ -284,7 +284,7 @@ public function testFieldFormUnlimited() { // TODO : check that non-field inputs are preserved ('title'), etc. // Yet another time so that we can play with more values -> 3 widgets. - $this->drupalPostForm(NULL, [], t('Add another item')); + $this->drupalPostForm(NULL, [], 'Add another item'); // Prepare values and weights. $count = 3; @@ -309,7 +309,7 @@ public function testFieldFormUnlimited() { } // Press 'add more' button -> 4 widgets - $this->drupalPostForm(NULL, $edit, t('Add another item')); + $this->drupalPostForm(NULL, $edit, 'Add another item'); for ($delta = 0; $delta <= $delta_range; $delta++) { $this->assertSession()->fieldValueEquals("{$field_name}[$delta][value]", $values[$delta]); $this->assertSession()->fieldValueEquals("{$field_name}[$delta][_weight]", $weights[$delta]); @@ -324,7 +324,7 @@ public function testFieldFormUnlimited() { $this->assertSession()->fieldNotExists("{$field_name}[" . ($delta + 1) . '][value]'); // Submit the form and create the entity. - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -410,7 +410,7 @@ public function testFieldFormMultivalueWithRequiredRadio() { $this->drupalGet('entity_test/add'); // Press the 'Add more' button. - $this->drupalPostForm(NULL, [], t('Add another item')); + $this->drupalPostForm(NULL, [], 'Add another item'); // Verify that no error is thrown by the radio element. $this->assertSession()->elementNotExists('xpath', '//div[contains(@class, "error")]'); @@ -448,7 +448,7 @@ public function testFieldFormMultipleWidget() { $edit = [ $field_name => '1, 2, 3', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; @@ -462,7 +462,7 @@ public function testFieldFormMultipleWidget() { // Submit the form with more values than the field accepts. $edit = [$field_name => '1, 2, 3, 4, 5']; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw('this field cannot hold more than 4 values'); // Check that the field values were not submitted. $this->assertFieldValues($entity_init, $field_name, [1, 2, 3]); @@ -542,7 +542,7 @@ public function testFieldFormAccess() { $edit = [ "{$field_name}[0][value]" => 1, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match("|$entity_type/manage/(\d+)|", $this->getUrl(), $match); $id = $match[1]; @@ -558,7 +558,7 @@ public function testFieldFormAccess() { "{$field_name}[0][value]" => 2, 'revision' => TRUE, ]; - $this->drupalPostForm($entity_type . '/manage/' . $id . '/edit', $edit, t('Save')); + $this->drupalPostForm($entity_type . '/manage/' . $id . '/edit', $edit, 'Save'); // Check that the new revision has the expected values. $storage->resetCache([$id]); @@ -598,7 +598,7 @@ public function testHiddenField() { // Create an entity and test that the default value is assigned correctly to // the field that uses the hidden widget. $this->assertSession()->fieldNotExists("{$field_name}[0][value]"); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); preg_match('|' . $entity_type . '/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test_rev ' . $id . ' has been created.', 'Entity was created'); @@ -626,7 +626,7 @@ public function testHiddenField() { // Update the entity. $value = mt_rand(1, 127); $edit = ["{$field_name}[0][value]" => $value]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('entity_test_rev ' . $id . ' has been updated.', 'Entity was updated'); $storage->resetCache([$id]); $entity = $storage->load($id); @@ -640,7 +640,7 @@ public function testHiddenField() { // Create a new revision. $edit = ['revision' => TRUE]; - $this->drupalPostForm($entity_type . '/manage/' . $id . '/edit', $edit, t('Save')); + $this->drupalPostForm($entity_type . '/manage/' . $id . '/edit', $edit, 'Save'); // Check that the expected value has been carried over to the new revision. $storage->resetCache([$id]); diff --git a/core/modules/field/tests/src/Functional/NestedFormTest.php b/core/modules/field/tests/src/Functional/NestedFormTest.php index b3c4d2a68757c6bd72d227d96f35791f6056000a..a009a92828c0d3c1c9de559bdaeb4c5117bf44bc 100644 --- a/core/modules/field/tests/src/Functional/NestedFormTest.php +++ b/core/modules/field/tests/src/Functional/NestedFormTest.php @@ -114,7 +114,7 @@ public function testNestedFieldForm() { 'entity_2[field_unlimited][0][value]' => 12, 'entity_2[field_unlimited][1][value]' => 13, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $entity_1 = $storage->load(1); $entity_2 = $storage->load(2); $this->assertFieldValues($entity_1, 'field_single', [1]); @@ -127,14 +127,14 @@ public function testNestedFieldForm() { $edit = [ 'field_unlimited[1][value]' => -1, ]; - $this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save')); + $this->drupalPostForm('test-entity/nested/1/2', $edit, 'Save'); $this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field'])); $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-field-unlimited-1-value']); $this->assertCount(1, $error_field, 'Entity 1: the error was flagged on the correct element.'); $edit = [ 'entity_2[field_unlimited][1][value]' => -1, ]; - $this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save')); + $this->drupalPostForm('test-entity/nested/1/2', $edit, 'Save'); $this->assertRaw(t('%label does not accept the value -1', ['%label' => 'Unlimited field'])); $error_field = $this->xpath('//input[@id=:id and contains(@class, "error")]', [':id' => 'edit-entity-2-field-unlimited-1-value']); $this->assertCount(1, $error_field, 'Entity 2: the error was flagged on the correct element.'); @@ -146,7 +146,7 @@ public function testNestedFieldForm() { 'entity_2[field_unlimited][0][_weight]' => 0, 'entity_2[field_unlimited][1][_weight]' => -1, ]; - $this->drupalPostForm('test-entity/nested/1/2', $edit, t('Save')); + $this->drupalPostForm('test-entity/nested/1/2', $edit, 'Save'); $this->assertFieldValues($entity_1, 'field_unlimited', [3, 2]); $this->assertFieldValues($entity_2, 'field_unlimited', [13, 12]); @@ -170,7 +170,7 @@ public function testNestedFieldForm() { $this->assertSession()->fieldValueEquals('entity_2[field_unlimited][2][value]', 15); $this->assertSession()->fieldValueEquals('entity_2[field_unlimited][3][value]', ''); // Save the form and check values are saved correctly. - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertFieldValues($entity_1, 'field_unlimited', [3, 2]); $this->assertFieldValues($entity_2, 'field_unlimited', [13, 14, 15]); } diff --git a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php index 590a2e72eca7321622fbca51b934d26500300dc0..37fcbdebcc2645aa61d9f96cadcfed33c533c585 100644 --- a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php +++ b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php @@ -83,7 +83,7 @@ public function testNumberDecimalField() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -103,7 +103,7 @@ public function testNumberDecimalField() { $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } @@ -121,7 +121,7 @@ public function testNumberDecimalField() { $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } } @@ -198,7 +198,7 @@ public function testNumberIntegerField() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -208,7 +208,7 @@ public function testNumberIntegerField() { $edit = [ "{$field_name}[0][value]" => $minimum - 1, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name must be higher than or equal to %minimum.', ['%name' => $field_name, '%minimum' => $minimum])); // Try to set a decimal value @@ -216,7 +216,7 @@ public function testNumberIntegerField() { $edit = [ "{$field_name}[0][value]" => 1.5, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name is not a valid number.', ['%name' => $field_name])); // Try to set a value above the maximum value @@ -224,7 +224,7 @@ public function testNumberIntegerField() { $edit = [ "{$field_name}[0][value]" => $maximum + 1, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name must be lower than or equal to %maximum.', ['%name' => $field_name, '%maximum' => $maximum])); // Try to set a wrong integer value. @@ -232,7 +232,7 @@ public function testNumberIntegerField() { $edit = [ "{$field_name}[0][value]" => '20-40', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); // Test with valid entries. @@ -247,7 +247,7 @@ public function testNumberIntegerField() { $edit = [ "{$field_name}[0][value]" => $valid_entry, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -271,7 +271,7 @@ public function testNumberIntegerField() { $edit = [ "{$field_name}[0][value]" => $integer_value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -327,7 +327,7 @@ public function testNumberFloatField() { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); @@ -351,7 +351,7 @@ public function testNumberFloatField() { $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } @@ -369,7 +369,7 @@ public function testNumberFloatField() { $edit = [ "{$field_name}[0][value]" => $wrong_entry, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('%name must be a number.', ['%name' => $field_name])); } } @@ -434,7 +434,7 @@ public function assertSetMinimumValue($field, $minimum_value) { $edit = [ 'settings[min]' => $minimum_value, ]; - $this->drupalPostForm($field_configuration_url, $edit, t('Save settings')); + $this->drupalPostForm($field_configuration_url, $edit, 'Save settings'); // Check if an error message is shown. $this->assertNoRaw(t('%name is not a valid number.', ['%name' => t('Minimum')])); // Check if a success message is shown. diff --git a/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php b/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php index cf2fb1dc7c9080c9065bd1617827e866dc533ea5..4f3d1531b4b3c928239305b07cadb94939244833 100644 --- a/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php +++ b/core/modules/field/tests/src/Functional/ReEnableModuleFieldTest.php @@ -91,7 +91,7 @@ public function testReEnabledField() { 'title[0][value]' => $this->randomMachineName(), 'field_telephone[0][value]' => "123456789", ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(''); // Test that the module can't be uninstalled from the UI while there is data diff --git a/core/modules/field/tests/src/Functional/String/StringFieldTest.php b/core/modules/field/tests/src/Functional/String/StringFieldTest.php index c8e66c0d1f5c1a9501e2d230aeeabb86fbaa8185..0943858886bbf49bd080e24b9c7de764d44d8a17 100644 --- a/core/modules/field/tests/src/Functional/String/StringFieldTest.php +++ b/core/modules/field/tests/src/Functional/String/StringFieldTest.php @@ -99,7 +99,7 @@ public function _testTextfieldWidgets($field_type, $widget_type) { $edit = [ "{$field_name}[0][value]" => $value, ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); diff --git a/core/modules/field/tests/src/Functional/TranslationWebTest.php b/core/modules/field/tests/src/Functional/TranslationWebTest.php index 3367d271f1434ac3b5d15acfe47bd0b5c5a6165a..f8df68d70a2efd1dee6748363e6ffac8a761909c 100644 --- a/core/modules/field/tests/src/Functional/TranslationWebTest.php +++ b/core/modules/field/tests/src/Functional/TranslationWebTest.php @@ -120,7 +120,7 @@ public function testFieldFormTranslationRevisions() { "{$field_name}[0][value]" => $entity->{$field_name}->value, 'revision' => TRUE, ]; - $this->drupalPostForm($this->entityTypeId . '/manage/' . $entity->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm($this->entityTypeId . '/manage/' . $entity->id() . '/edit', $edit, 'Save'); // Check translation revisions. $this->checkTranslationRevisions($entity->id(), $entity->getRevisionId(), $available_langcodes); diff --git a/core/modules/field/tests/src/Functional/Views/FieldUITest.php b/core/modules/field/tests/src/Functional/Views/FieldUITest.php index 28b336779a46e952deb4706c50435c42146acfdb..e7c7be5875d8978d454ce0752c947ec7a43273c6 100644 --- a/core/modules/field/tests/src/Functional/Views/FieldUITest.php +++ b/core/modules/field/tests/src/Functional/Views/FieldUITest.php @@ -69,18 +69,18 @@ public function testHandlerUI() { sort($options, SORT_STRING); $this->assertEqual($options, ['text_default', 'text_trimmed'], 'The text formatters for a simple text field appear as expected.'); - $this->drupalPostForm(NULL, ['options[type]' => 'text_trimmed'], t('Apply')); + $this->drupalPostForm(NULL, ['options[type]' => 'text_trimmed'], 'Apply'); $this->drupalGet($url); $this->assertTrue($this->assertSession()->optionExists('edit-options-type', 'text_trimmed')->isSelected()); $random_number = rand(100, 400); - $this->drupalPostForm(NULL, ['options[settings][trim_length]' => $random_number], t('Apply')); + $this->drupalPostForm(NULL, ['options[settings][trim_length]' => $random_number], 'Apply'); $this->drupalGet($url); $this->assertSession()->fieldValueEquals('options[settings][trim_length]', $random_number); // Save the view and test whether the settings are saved. - $this->drupalPostForm('admin/structure/views/view/test_view_fieldapi', [], t('Save')); + $this->drupalPostForm('admin/structure/views/view/test_view_fieldapi', [], 'Save'); $view = Views::getView('test_view_fieldapi'); $view->initHandlers(); $this->assertEqual($view->field['field_name_0']->options['type'], 'text_trimmed'); @@ -89,8 +89,8 @@ public function testHandlerUI() { // Now change the formatter back to 'default' which doesn't have any // settings. We want to ensure that the settings are empty then. $edit['options[type]'] = 'text_default'; - $this->drupalPostForm('admin/structure/views/nojs/handler/test_view_fieldapi/default/field/field_name_0', $edit, t('Apply')); - $this->drupalPostForm('admin/structure/views/view/test_view_fieldapi', [], t('Save')); + $this->drupalPostForm('admin/structure/views/nojs/handler/test_view_fieldapi/default/field/field_name_0', $edit, 'Apply'); + $this->drupalPostForm('admin/structure/views/view/test_view_fieldapi', [], 'Save'); $view = Views::getView('test_view_fieldapi'); $view->initHandlers(); $this->assertEqual($view->field['field_name_0']->options['type'], 'text_default'); @@ -107,7 +107,7 @@ public function testHandlerUI() { public function testHandlerUIAggregation() { // Enable aggregation. $edit = ['group_by' => '1']; - $this->drupalPostForm('admin/structure/views/nojs/display/test_view_fieldapi/default/group_by', $edit, t('Apply')); + $this->drupalPostForm('admin/structure/views/nojs/display/test_view_fieldapi/default/group_by', $edit, 'Apply'); $url = "admin/structure/views/nojs/handler/test_view_fieldapi/default/field/field_name_0"; $this->drupalGet($url); @@ -143,7 +143,7 @@ public function testBooleanFilterHandler() { $field->save(); $url = "admin/structure/views/nojs/add-handler/test_view_fieldapi/default/filter"; - $this->drupalPostForm($url, ['name[node__' . $field_name . '.' . $field_name . '_value]' => TRUE], t('Add and configure @handler', ['@handler' => t('filter criteria')])); + $this->drupalPostForm($url, ['name[node__' . $field_name . '.' . $field_name . '_value]' => TRUE], 'Add and configure filter criteria'); $this->assertSession()->statusCodeEquals(200); // Verify that using a boolean field as a filter also results in using the // boolean plugin. diff --git a/core/modules/field/tests/src/FunctionalJavascript/Boolean/BooleanFormatterSettingsTest.php b/core/modules/field/tests/src/FunctionalJavascript/Boolean/BooleanFormatterSettingsTest.php index a8629e0a8ce29c67caef8eb59cffa2d9d3b85b07..3769f6eaf6c8cb472f78b2faa4ea6e5b94d8cd43 100644 --- a/core/modules/field/tests/src/FunctionalJavascript/Boolean/BooleanFormatterSettingsTest.php +++ b/core/modules/field/tests/src/FunctionalJavascript/Boolean/BooleanFormatterSettingsTest.php @@ -115,7 +115,7 @@ public function testBooleanFormatterSettings() { $this->drupalPostForm(NULL, [ 'settings[on_label]' => $values[0], 'settings[off_label]' => $values[1], - ], t('Save settings')); + ], 'Save settings'); // Open the Manage Display page and trigger the field settings form. $this->drupalGet('admin/structure/types/manage/' . $this->bundle . '/display'); diff --git a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php index 98d470c90ca77b858e2cfeb6ffc33b2b3c8610fe..51301362ebc5bd4120ee3fe657908b69ce898489 100644 --- a/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/tests/src/FunctionalJavascript/EntityReference/EntityReferenceAdminTest.php @@ -99,7 +99,7 @@ public function testFieldAdminHandler() { $this->assertFieldSelectOptions('settings[target_type]', array_keys(\Drupal::entityTypeManager()->getDefinitions())); // Second step: 'Field settings' form. - $this->drupalPostForm(NULL, [], t('Save field settings')); + $this->drupalPostForm(NULL, [], 'Save field settings'); // The base handler should be selected by default. $this->assertSession()->fieldValueEquals('settings[handler]', 'default:node'); @@ -176,9 +176,7 @@ public function testFieldAdminHandler() { } // Third step: confirm. - $this->drupalPostForm(NULL, [ - 'required' => '1', - ], t('Save settings')); + $this->drupalPostForm(NULL, ['required' => '1'], 'Save settings'); // Check that the field appears in the overview form. $this->assertSession()->elementTextContains('xpath', '//table[@id="field-overview"]//tr[@id="field-test"]/td[1]', "Test"); @@ -187,7 +185,7 @@ public function testFieldAdminHandler() { // field is required. // The first 'Edit' link is for the Body field. $this->clickLink(t('Edit'), 1); - $this->drupalPostForm(NULL, [], t('Save settings')); + $this->drupalPostForm(NULL, [], 'Save settings'); // Switch the target type to 'taxonomy_term' and check that the settings // specific to its selection handler are displayed. @@ -195,7 +193,7 @@ public function testFieldAdminHandler() { $edit = [ 'settings[target_type]' => 'taxonomy_term', ]; - $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, t('Save field settings')); + $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, 'Save field settings'); $this->drupalGet($bundle_path . '/fields/' . $field_name); $this->assertSession()->fieldExists('settings[handler_settings][auto_create]'); @@ -205,7 +203,7 @@ public function testFieldAdminHandler() { $edit = [ 'settings[target_type]' => 'user', ]; - $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, t('Save field settings')); + $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, 'Save field settings'); $this->drupalGet($bundle_path . '/fields/' . $field_name); $this->assertSession()->fieldValueEquals('settings[handler_settings][filter][type]', '_none'); $this->assertSession()->fieldValueEquals('settings[handler_settings][sort][field]', '_none'); @@ -222,7 +220,7 @@ public function testFieldAdminHandler() { $edit = [ 'settings[target_type]' => 'node', ]; - $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, t('Save field settings')); + $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, 'Save field settings'); // Try to select the views handler. $this->drupalGet($bundle_path . '/fields/' . $field_name); @@ -234,7 +232,7 @@ public function testFieldAdminHandler() { $assert_session->waitForElement('xpath', '//a[contains(text(), "Create a view")]'); $assert_session->responseContains($views_text); - $this->drupalPostForm(NULL, [], t('Save settings')); + $this->drupalPostForm(NULL, [], 'Save settings'); // If no eligible view is available we should see a message. $assert_session->pageTextContains('The views entity selection mode requires a view.'); @@ -247,14 +245,14 @@ public function testFieldAdminHandler() { $assert_session ->waitForField('settings[handler_settings][view][view_and_display]') ->setValue('test_entity_reference:entity_reference_1'); - $this->drupalPostForm(NULL, [], t('Save settings')); + $this->drupalPostForm(NULL, [], 'Save settings'); $assert_session->pageTextContains('Saved Test configuration.'); // Switch the target type to 'entity_test'. $edit = [ 'settings[target_type]' => 'entity_test', ]; - $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, t('Save field settings')); + $this->drupalPostForm($bundle_path . '/fields/' . $field_name . '/storage', $edit, 'Save field settings'); $this->drupalGet($bundle_path . '/fields/' . $field_name); $page->findField('settings[handler]')->setValue('views'); $assert_session @@ -263,7 +261,7 @@ public function testFieldAdminHandler() { $edit = [ 'required' => FALSE, ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); $assert_session->pageTextContains('Saved Test configuration.'); } diff --git a/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php b/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php index 39f5a6542b0a387800f99f937ee4d2980b98b488..d0aa02edf41582182b1d17d9079099336ffa7d4a 100644 --- a/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php +++ b/core/modules/field/tests/src/FunctionalJavascript/Number/NumberFieldTest.php @@ -146,7 +146,7 @@ public function testNumberFormatter() { } $page->pressButton("${float_field}_plugin_settings_update"); $assert_session->waitForElement('css', '.field-plugin-summary-cell > .ajax-new-content'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); // Check number_decimal and number_unformatted formatters behavior. $this->drupalGet('node/' . $node->id()); @@ -176,7 +176,7 @@ public function testNumberFormatter() { } $page->pressButton("${integer_field}_plugin_settings_update"); $assert_session->waitForElement('css', '.field-plugin-summary-cell > .ajax-new-content'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); // Check number_integer formatter behavior. $this->drupalGet('node/' . $node->id()); diff --git a/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php b/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php index bdf411905f5febb361e173e1502d821a6621617f..8e274e1d5569df46222e5a8f822df7fb72e3e75f 100644 --- a/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php +++ b/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php @@ -68,7 +68,7 @@ public function testEntityViewModeUI() { 'id' => strtolower($this->randomMachineName()) . '.' . strtolower($this->randomMachineName()), 'label' => $this->randomString(), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw('The machine-readable name must contain only lowercase letters, numbers, and underscores.'); // Test adding a view mode. @@ -76,7 +76,7 @@ public function testEntityViewModeUI() { 'id' => strtolower($this->randomMachineName()), 'label' => $this->randomString(), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('Saved the %label view mode.', ['%label' => $edit['label']])); // Test editing the view mode. @@ -93,7 +93,7 @@ public function testEntityViewModeUI() { // Test deleting the view mode. $this->clickLink(t('Delete')); $this->assertRaw(t('Are you sure you want to delete the view mode %label?', ['%label' => $edit['label']])); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertRaw(t('The view mode %label has been deleted.', ['%label' => $edit['label']])); } @@ -122,7 +122,7 @@ public function testEntityFormModeUI() { 'id' => strtolower($this->randomMachineName()) . '.' . strtolower($this->randomMachineName()), 'label' => $this->randomString(), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw('The machine-readable name must contain only lowercase letters, numbers, and underscores.'); // Test adding a form mode. @@ -130,7 +130,7 @@ public function testEntityFormModeUI() { 'id' => strtolower($this->randomMachineName()), 'label' => $this->randomString(), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertRaw(t('Saved the %label form mode.', ['%label' => $edit['label']])); // Test editing the form mode. @@ -147,7 +147,7 @@ public function testEntityFormModeUI() { // Test deleting the form mode. $this->clickLink(t('Delete')); $this->assertRaw(t('Are you sure you want to delete the form mode %label?', ['%label' => $edit['label']])); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertRaw(t('The form mode %label has been deleted.', ['%label' => $edit['label']])); } diff --git a/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php b/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php index 572475a62cacbec9c8c76b9d747cfc9e07c1bfb4..894c9e3dfce2f065a7dd8ac35fae0883ca267580 100644 --- a/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php +++ b/core/modules/field_ui/tests/src/Functional/FieldUIRouteTest.php @@ -55,7 +55,7 @@ public function testFieldUIRoutes() { $this->assertLocalTasks(); $edit = ['display_modes_custom[compact]' => TRUE]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->drupalGet('admin/config/people/accounts/display/compact'); $this->assertSession()->titleEquals('Manage display | Drupal'); $this->assertLocalTasks(); @@ -69,7 +69,7 @@ public function testFieldUIRoutes() { $this->assertLocalTasks(); $edit = ['display_modes_custom[register]' => TRUE]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertSession()->statusCodeEquals(200); $this->drupalGet('admin/config/people/accounts/form-display/register'); $this->assertSession()->titleEquals('Manage form display | Drupal'); @@ -86,7 +86,7 @@ public function testFieldUIRoutes() { $this->container->get('router.builder')->rebuildIfNeeded(); $edit = ['display_modes_custom[test]' => TRUE]; - $this->drupalPostForm('admin/config/people/accounts/display', $edit, t('Save')); + $this->drupalPostForm('admin/config/people/accounts/display', $edit, 'Save'); $this->assertSession()->linkExists('Test'); // Create new form mode and verify it's available on the Manage Form @@ -99,7 +99,7 @@ public function testFieldUIRoutes() { $this->container->get('router.builder')->rebuildIfNeeded(); $edit = ['display_modes_custom[test]' => TRUE]; - $this->drupalPostForm('admin/config/people/accounts/form-display', $edit, t('Save')); + $this->drupalPostForm('admin/config/people/accounts/form-display', $edit, 'Save'); $this->assertSession()->linkExists('Test'); } diff --git a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php index 444c4a91105db6dd1a9f9978bb9b9d7c850352c1..40976a0121d5c10b05d3b22e7b5082cd56fb5d8f 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageDisplayTest.php @@ -121,14 +121,14 @@ public function testViewModeCustom() { 'fields[field_test][type]' => 'field_test_with_prepare_view', 'fields[field_test][region]' => 'content', ]; - $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, t('Save')); + $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, 'Save'); $this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], "The field is displayed as expected in view modes that use 'default' settings."); // Specialize the 'rss' mode, check that the field is displayed the same. $edit = [ "display_modes_custom[rss]" => TRUE, ]; - $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, t('Save')); + $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, 'Save'); $this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], "The field is displayed as expected in newly specialized 'rss' mode."); // Set the field to 'hidden' in the view mode, check that the field is @@ -136,7 +136,7 @@ public function testViewModeCustom() { $edit = [ 'fields[field_test][region]' => 'hidden', ]; - $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display/rss', $edit, t('Save')); + $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display/rss', $edit, 'Save'); $this->assertNodeViewNoText($node, 'rss', $value, "The field is hidden in 'rss' mode."); // Set the view mode back to 'default', check that the field is displayed @@ -144,14 +144,14 @@ public function testViewModeCustom() { $edit = [ "display_modes_custom[rss]" => FALSE, ]; - $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, t('Save')); + $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, 'Save'); $this->assertNodeViewText($node, 'rss', $output['field_test_with_prepare_view'], "The field is displayed as expected when 'rss' mode is set back to 'default' settings."); // Specialize the view mode again. $edit = [ "display_modes_custom[rss]" => TRUE, ]; - $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, t('Save')); + $this->drupalPostForm('admin/structure/types/manage/' . $this->type . '/display', $edit, 'Save'); // Check that the previous settings for the view mode have been kept. $this->assertNodeViewNoText($node, 'rss', $value, "The previous settings are kept when 'rss' mode is specialized again."); } @@ -191,7 +191,7 @@ public function testSingleViewMode() { $this->assertNoText('Use custom display settings for the following view modes', 'Custom display settings fieldset found.'); // This may not trigger a notice when 'view_modes_custom' isn't available. - $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/display', [], t('Save')); + $this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary . '/overview/display', [], 'Save'); } /** diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php index 30c793dab3468fb97134e35bade0b2a84f2f40a3..42d47fb4316127d9e07a64be2c8f4ecd26b9c006 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php @@ -226,7 +226,7 @@ public function updateField() { $edit = [ 'settings[test_field_storage_setting]' => $string, ]; - $this->drupalPostForm(NULL, $edit, t('Save field settings')); + $this->drupalPostForm(NULL, $edit, 'Save field settings'); // Go to the field edit page. $this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/' . $field_id); @@ -234,7 +234,7 @@ public function updateField() { 'settings[test_field_setting]' => $string, ]; $this->assertText('Default value', 'Default value heading is shown'); - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); // Assert the field settings are correct. $this->assertFieldSettings($this->contentType, $this->fieldName, $string); @@ -276,7 +276,7 @@ public function cardinalitySettings() { 'cardinality' => 'number', 'cardinality_number' => '', ]; - $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); + $this->drupalPostForm($field_edit_path, $edit, 'Save field settings'); $this->assertText('Number of values is required.'); // Submit a custom number. @@ -284,7 +284,7 @@ public function cardinalitySettings() { 'cardinality' => 'number', 'cardinality_number' => 6, ]; - $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); + $this->drupalPostForm($field_edit_path, $edit, 'Save field settings'); $this->assertText('Updated field Body field settings.'); $this->drupalGet($field_edit_path); $this->assertSession()->fieldValueEquals('cardinality', 'number'); @@ -306,7 +306,7 @@ public function cardinalitySettings() { 'cardinality' => 'number', 'cardinality_number' => 1, ]; - $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); + $this->drupalPostForm($field_edit_path, $edit, 'Save field settings'); $this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 2])); // Create a second entity with three values. @@ -317,7 +317,7 @@ public function cardinalitySettings() { $edit = [ 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, ]; - $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); + $this->drupalPostForm($field_edit_path, $edit, 'Save field settings'); $this->assertText('Updated field Body field settings.'); $this->drupalGet($field_edit_path); $this->assertSession()->fieldValueEquals('cardinality', FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); @@ -329,21 +329,21 @@ public function cardinalitySettings() { 'cardinality' => 'number', 'cardinality_number' => 1, ]; - $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); + $this->drupalPostForm($field_edit_path, $edit, 'Save field settings'); $this->assertRaw(t('There are @count entities with @delta or more values in this field.', ['@count' => 2, '@delta' => 2])); $edit = [ 'cardinality' => 'number', 'cardinality_number' => 2, ]; - $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); + $this->drupalPostForm($field_edit_path, $edit, 'Save field settings'); $this->assertRaw(t('There is @count entity with @delta or more values in this field.', ['@count' => 1, '@delta' => 3])); $edit = [ 'cardinality' => 'number', 'cardinality_number' => 3, ]; - $this->drupalPostForm($field_edit_path, $edit, t('Save field settings')); + $this->drupalPostForm($field_edit_path, $edit, 'Save field settings'); } /** @@ -369,7 +369,7 @@ protected function addPersistentFieldStorage() { // Delete all the body field instances. $this->drupalGet('admin/structure/types/manage/' . $node_type . '/fields/node.' . $node_type . '.' . $this->fieldName); $this->clickLink(t('Delete')); - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); } // Check "Re-use existing field" appears. $this->drupalGet('admin/structure/types/manage/page/fields/add-field'); @@ -420,7 +420,7 @@ public function testFieldPrefix() { 'label' => $field_exceed_max_length_label, 'field_name' => $field_exceed_max_length_input, ]; - $this->drupalPostForm('admin/structure/types/manage/' . $this->contentType . '/fields/add-field', $edit, t('Save and continue')); + $this->drupalPostForm('admin/structure/types/manage/' . $this->contentType . '/fields/add-field', $edit, 'Save and continue'); $this->assertText('Machine-readable name cannot be longer than 22 characters but is currently 23 characters long.'); // Create a valid field. @@ -462,12 +462,12 @@ public function testDefaultValue() { // Check that invalid default values are rejected. $edit = [$element_name => '-1']; - $this->drupalPostForm($admin_path, $edit, t('Save settings')); + $this->drupalPostForm($admin_path, $edit, 'Save settings'); $this->assertText("$field_name does not accept the value -1", 'Form validation failed.'); // Check that the default value is saved. $edit = [$element_name => '1']; - $this->drupalPostForm($admin_path, $edit, t('Save settings')); + $this->drupalPostForm($admin_path, $edit, 'Save settings'); $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); $field = FieldConfig::loadByName('node', $this->contentType, $field_name); $this->assertEqual($field->getDefaultValueLiteral(), [['value' => 1]], 'The default value was correctly saved.'); @@ -478,7 +478,7 @@ public function testDefaultValue() { // Check that the default value can be emptied. $edit = [$element_name => '']; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); $field = FieldConfig::loadByName('node', $this->contentType, $field_name); $this->assertEqual($field->getDefaultValueLiteral(), [], 'The default value was correctly saved.'); @@ -493,10 +493,10 @@ public function testDefaultValue() { $edit = [ 'required' => 1, ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); $this->drupalGet($admin_path); - $this->drupalPostForm(NULL, [], t('Save settings')); + $this->drupalPostForm(NULL, [], 'Save settings'); $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); $field = FieldConfig::loadByName('node', $this->contentType, $field_name); $this->assertEqual($field->getDefaultValueLiteral(), [], 'The default value was correctly saved.'); @@ -559,13 +559,13 @@ public function testDisallowedFieldNames() { // Try with an entity key. $edit['field_name'] = 'title'; $bundle_path = 'admin/structure/types/manage/' . $this->contentType; - $this->drupalPostForm("$bundle_path/fields/add-field", $edit, t('Save and continue')); + $this->drupalPostForm("$bundle_path/fields/add-field", $edit, 'Save and continue'); $this->assertText('The machine-readable name is already in use. It must be unique.'); // Try with a base field. $edit['field_name'] = 'sticky'; $bundle_path = 'admin/structure/types/manage/' . $this->contentType; - $this->drupalPostForm("$bundle_path/fields/add-field", $edit, t('Save and continue')); + $this->drupalPostForm("$bundle_path/fields/add-field", $edit, 'Save and continue'); $this->assertText('The machine-readable name is already in use. It must be unique.'); } @@ -667,7 +667,7 @@ public function testDuplicateFieldName() { 'new_storage_type' => 'entity_reference', ]; $url = 'admin/structure/types/manage/' . $this->contentType . '/fields/add-field'; - $this->drupalPostForm($url, $edit, t('Save and continue')); + $this->drupalPostForm($url, $edit, 'Save and continue'); $this->assertText('The machine-readable name is already in use. It must be unique.'); $this->assertSession()->addressEquals($url); @@ -731,7 +731,7 @@ public function testHelpDescriptions() { $edit = [ 'description' => 'Test with an upload field.', ]; - $this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.field_image', $edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.field_image', $edit, 'Save settings'); // Check that hook_field_widget_form_alter() does believe this is the // default value form. @@ -741,7 +741,7 @@ public function testHelpDescriptions() { $edit = [ 'description' => 'Test with a non upload field.', ]; - $this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.field_tags', $edit, t('Save settings')); + $this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.field_tags', $edit, 'Save settings'); $this->drupalGet('node/add/article'); $this->assertRaw('Test with an upload field.'); diff --git a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php index a8cb459adecdcbadd373cfc9e3da485f75a76362..b38a62e7e4396344e4d8e59e365f17009f640a5e 100644 --- a/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php +++ b/core/modules/field_ui/tests/src/Traits/FieldUiTestTrait.php @@ -44,17 +44,17 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi } // First step: 'Add field' page. - $this->drupalPostForm($bundle_path, $initial_edit, t('Save and continue')); + $this->drupalPostForm($bundle_path, $initial_edit, 'Save and continue'); $this->assertRaw(t('These settings apply to the %label field everywhere it is used.', ['%label' => $label])); // Test Breadcrumbs. $this->assertSession()->linkExists($label, 0, 'Field label is correct in the breadcrumb of the storage settings page.'); // Second step: 'Storage settings' form. - $this->drupalPostForm(NULL, $storage_edit, t('Save field settings')); + $this->drupalPostForm(NULL, $storage_edit, 'Save field settings'); $this->assertRaw(t('Updated field %label field settings.', ['%label' => $label])); // Third step: 'Field settings' form. - $this->drupalPostForm(NULL, $field_edit, t('Save settings')); + $this->drupalPostForm(NULL, $field_edit, 'Save settings'); $this->assertRaw(t('Saved %label configuration.', ['%label' => $label])); // Check that the field appears in the overview form. @@ -86,7 +86,7 @@ public function fieldUIAddExistingField($bundle_path, $existing_storage_name, $l ]; // First step: 'Re-use existing field' on the 'Add field' page. - $this->drupalPostForm("$bundle_path/fields/add-field", $initial_edit, t('Save and continue')); + $this->drupalPostForm("$bundle_path/fields/add-field", $initial_edit, 'Save and continue'); // Set the main content to only the content region because the label can // contain HTML which will be auto-escaped by Twig. $this->assertRaw('field-config-edit-form'); @@ -94,7 +94,7 @@ public function fieldUIAddExistingField($bundle_path, $existing_storage_name, $l $this->assertNoRaw('&lt;'); // Second step: 'Field settings' form. - $this->drupalPostForm(NULL, $field_edit, t('Save settings')); + $this->drupalPostForm(NULL, $field_edit, 'Save settings'); $this->assertRaw(t('Saved %label configuration.', ['%label' => $label])); // Check that the field appears in the overview form. @@ -125,7 +125,7 @@ public function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_la $this->assertSession()->linkExists($label, 0, 'Field label is correct in the breadcrumb of the field delete page.'); // Submit confirmation form. - $this->drupalPostForm(NULL, [], t('Delete')); + $this->drupalPostForm(NULL, [], 'Delete'); $this->assertRaw(t('The field %label has been deleted from the %type content type.', ['%label' => $label, '%type' => $bundle_label])); // Check that the field does not appear in the overview form. diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php index c6e080cb0ac73164265e355506b9e48c16084b4f..e610e7d8ba44b8645ee74ed3f9a29d2b5926c924 100644 --- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -54,7 +54,7 @@ public function testNodeDisplay() { "fields[$field_name][region]" => 'content', ]; } - $this->drupalPostForm("admin/structure/types/manage/$type_name/display", $edit, t('Save')); + $this->drupalPostForm("admin/structure/types/manage/$type_name/display", $edit, 'Save'); $this->drupalGet('node/' . $node->id()); $this->assertNoText($field_name, new FormattableMarkup('Field label is hidden when no file attached for formatter %formatter', ['%formatter' => $formatter])); } @@ -83,7 +83,7 @@ public function testNodeDisplay() { // Turn the "display" option off and check that the file is no longer displayed. $edit = [$field_name . '[0][display]' => FALSE]; - $this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $nid . '/edit', $edit, 'Save'); $this->assertNoRaw($default_output); @@ -93,7 +93,7 @@ public function testNodeDisplay() { $field_name . '[0][description]' => $description, $field_name . '[0][display]' => TRUE, ]; - $this->drupalPostForm('node/' . $nid . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $nid . '/edit', $edit, 'Save'); $this->assertText($description); // Ensure the filename in the link's title attribute is escaped. @@ -103,12 +103,12 @@ public function testNodeDisplay() { // Add a second file. $name = 'files[' . $field_name . '_1][]'; $edit_upload[$name] = \Drupal::service('file_system')->realpath($test_file->getFileUri()); - $this->drupalPostForm("node/$nid/edit", $edit_upload, t('Upload')); + $this->drupalPostForm("node/$nid/edit", $edit_upload, 'Upload'); // Uncheck the display checkboxes and go to the preview. $edit[$field_name . '[0][display]'] = FALSE; $edit[$field_name . '[1][display]'] = FALSE; - $this->drupalPostForm(NULL, $edit, t('Preview')); + $this->drupalPostForm(NULL, $edit, 'Preview'); $this->clickLink(t('Back to content editing')); // First file. $this->assertRaw($field_name . '[0][display]'); @@ -159,20 +159,20 @@ public function testDescToggle() { 'name' => $type_name, 'type' => $type_name, ]; - $this->drupalPostForm('admin/structure/types/add', $edit, t('Save and manage fields')); + $this->drupalPostForm('admin/structure/types/add', $edit, 'Save and manage fields'); $edit = [ 'new_storage_type' => $field_type, 'field_name' => $field_name, 'label' => $this->randomString(), ]; - $this->drupalPostForm('/admin/structure/types/manage/' . $type_name . '/fields/add-field', $edit, t('Save and continue')); - $this->drupalPostForm(NULL, [], t('Save field settings')); + $this->drupalPostForm('/admin/structure/types/manage/' . $type_name . '/fields/add-field', $edit, 'Save and continue'); + $this->drupalPostForm(NULL, [], 'Save field settings'); // Ensure the description field is selected on the field instance settings // form. That's what this test is all about. $edit = [ 'settings[description_field]' => TRUE, ]; - $this->drupalPostForm(NULL, $edit, t('Save settings')); + $this->drupalPostForm(NULL, $edit, 'Save settings'); // Add a node of our new type and upload a file to it. $file = current($this->drupalGetTestFiles('text')); $title = $this->randomString(); @@ -180,7 +180,7 @@ public function testDescToggle() { 'title[0][value]' => $title, 'files[field_' . $field_name . '_0]' => \Drupal::service('file_system')->realpath($file->uri), ]; - $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $type_name, $edit, 'Save'); $node = $this->drupalGetNodeByTitle($title); $this->drupalGet('node/' . $node->id() . '/edit'); $this->assertText('The description may be used as the label of the link to the file.'); @@ -210,7 +210,7 @@ public function testDescriptionDefaultFileFieldDisplay() { // Add file description. $description = 'This is the test file description'; - $this->drupalPostForm("node/$nid/edit", [$field_name . '[0][description]' => $description], t('Save')); + $this->drupalPostForm("node/$nid/edit", [$field_name . '[0][description]' => $description], 'Save'); // Load uncached node. \Drupal::entityTypeManager()->getStorage('node')->resetCache([$nid]); diff --git a/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php index bb46881e4c75f1aee31e3c084b976837b4434c4b..72fb4bb44438b70f17fc0059375eb2e78514ba80 100644 --- a/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldRSSContentTest.php @@ -38,7 +38,7 @@ public function testFileFieldRSSContent() { $edit = [ "display_modes_custom[rss]" => '1', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Change the format to 'RSS enclosure'. $this->drupalGet("admin/structure/types/manage/$type_name/display/rss"); @@ -46,7 +46,7 @@ public function testFileFieldRSSContent() { "fields[$field_name][type]" => 'file_rss_enclosure', "fields[$field_name][region]" => 'content', ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); // Create a new node with a file field set. Promote to frontpage // needs to be set so this node will appear in the RSS feed. diff --git a/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php index e812cd8ee4c740b33ef3f1865fdf36895087957b..49c60380ac5e8d0a0198e59deaa94e8d0e7eb590 100644 --- a/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldRevisionTest.php @@ -75,7 +75,7 @@ public function testRevisions() { // Save a new version of the node without any changes. // Check that the file is still the same as the previous revision. - $this->drupalPostForm('node/' . $nid . '/edit', ['revision' => '1'], t('Save')); + $this->drupalPostForm('node/' . $nid . '/edit', ['revision' => '1'], 'Save'); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $node_file_r3 = File::load($node->{$field_name}->target_id); @@ -84,7 +84,7 @@ public function testRevisions() { $this->assertFileIsPermanent($node_file_r3, 'New revision file is permanent.'); // Revert to the first revision and check that the original file is active. - $this->drupalPostForm('node/' . $nid . '/revisions/' . $node_vid_r1 . '/revert', [], t('Revert')); + $this->drupalPostForm('node/' . $nid . '/revisions/' . $node_vid_r1 . '/revert', [], 'Revert'); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $node_file_r4 = File::load($node->{$field_name}->target_id); @@ -93,7 +93,7 @@ public function testRevisions() { // Delete the second revision and check that the file is kept (since it is // still being used by the third revision). - $this->drupalPostForm('node/' . $nid . '/revisions/' . $node_vid_r2 . '/delete', [], t('Delete')); + $this->drupalPostForm('node/' . $nid . '/revisions/' . $node_vid_r2 . '/delete', [], 'Delete'); $this->assertFileExists($node_file_r3->getFileUri()); $this->assertFileEntryExists($node_file_r3, 'Second file entry is still available after deleting second revision, since it is being used by the third revision.'); $this->assertFileIsPermanent($node_file_r3, 'Second file entry is still permanent after deleting second revision, since it is being used by the third revision.'); @@ -106,7 +106,7 @@ public function testRevisions() { $this->drupalGet('user/' . $user->id() . '/edit'); // Delete the third revision and check that the file is not deleted yet. - $this->drupalPostForm('node/' . $nid . '/revisions/' . $node_vid_r3 . '/delete', [], t('Delete')); + $this->drupalPostForm('node/' . $nid . '/revisions/' . $node_vid_r3 . '/delete', [], 'Delete'); $this->assertFileExists($node_file_r3->getFileUri()); $this->assertFileEntryExists($node_file_r3, 'Second file entry is still available after deleting third revision, since it is being used by the user.'); $this->assertFileIsPermanent($node_file_r3, 'Second file entry is still permanent after deleting third revision, since it is being used by the user.'); @@ -138,7 +138,7 @@ public function testRevisions() { $this->assertFileEntryNotExists($node_file_r3, 'Second file entry is now deleted after deleting third revision, since it is no longer being used by any other nodes.'); // Delete the entire node and check that the original file is deleted. - $this->drupalPostForm('node/' . $nid . '/delete', [], t('Delete')); + $this->drupalPostForm('node/' . $nid . '/delete', [], 'Delete'); // Call file_cron() to clean up the file. Make sure the changed timestamp // of the file is older than the system.file.temporary_maximum_age // configuration value. We use an UPDATE statement because using the API diff --git a/core/modules/file/tests/src/Functional/FileFieldTestBase.php b/core/modules/file/tests/src/Functional/FileFieldTestBase.php index dbb7a4e4b0c80551cc53c3a0ac98340c1fcdcbf9..2292c8bdf3166a7fdf11a38e0ecff9282658b7fb 100644 --- a/core/modules/file/tests/src/Functional/FileFieldTestBase.php +++ b/core/modules/file/tests/src/Functional/FileFieldTestBase.php @@ -175,11 +175,11 @@ public function uploadNodeFiles(array $files, $field_name, $nid_or_type, $new_re } else { $page->attachFileToField($name, $file_path); - $this->drupalPostForm(NULL, [], t('Upload')); + $this->drupalPostForm(NULL, [], 'Upload'); } } - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); return $nid; } @@ -194,8 +194,8 @@ public function removeNodeFile($nid, $new_revision = TRUE) { 'revision' => (string) (int) $new_revision, ]; - $this->drupalPostForm('node/' . $nid . '/edit', [], t('Remove')); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm('node/' . $nid . '/edit', [], 'Remove'); + $this->drupalPostForm(NULL, $edit, 'Save'); } /** @@ -207,8 +207,8 @@ public function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) 'revision' => (string) (int) $new_revision, ]; - $this->drupalPostForm('node/' . $nid . '/edit', [], t('Remove')); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm('node/' . $nid . '/edit', [], 'Remove'); + $this->drupalPostForm(NULL, $edit, 'Save'); } /** diff --git a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php index 9b4d14bd50d75cd0d84c1629a673a32c25be19bf..5aa8489052f38c1f34d131b421a91f53259b888c 100644 --- a/core/modules/file/tests/src/Functional/FileFieldValidateTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldValidateTest.php @@ -35,7 +35,7 @@ public function testRequired() { // Try to post a new node without uploading a file. $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); - $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $type_name, $edit, 'Save'); $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()])); // Create a new node with the uploaded file. @@ -56,7 +56,7 @@ public function testRequired() { // Try to post a new node without uploading a file in the multivalue field. $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); - $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $type_name, $edit, 'Save'); $this->assertRaw(t('@title field is required.', ['@title' => $field->getLabel()])); // Create a new node with the uploaded file into the multivalue field. diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php index 3486c626ada096596d1678021050dcbf1c7ec730..5a8cd503ddff008c07995be9bedfc8e141efffab 100644 --- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php @@ -99,7 +99,7 @@ public function testSingleValuedWidget() { $this->drupalGet("node/$nid/edit"); $this->assertSession()->buttonNotExists('Upload'); $this->assertSession()->buttonExists('Remove'); - $this->drupalPostForm(NULL, [], t('Remove')); + $this->drupalPostForm(NULL, [], 'Remove'); // Ensure the page now has an upload button instead of a remove button. $this->assertSession()->buttonNotExists('Remove'); @@ -110,7 +110,7 @@ public function testSingleValuedWidget() { $this->assertTrue(isset($label[0]), 'Label for upload found.'); // Save the node and ensure it does not have the file. - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $node = $node_storage->loadUnchanged($nid); $this->assertTrue(empty($node->{$field_name}->target_id), 'File was successfully removed from the node.'); } @@ -146,7 +146,7 @@ public function testMultiValuedWidget() { $edit = ['files[' . $each_field_name . '_' . $delta . '][]' => \Drupal::service('file_system')->realpath($test_file->getFileUri())]; // If the Upload button doesn't exist, drupalPostForm() will // automatically fail with an assertion message. - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); } } $this->assertSession()->buttonNotExists('Upload'); @@ -200,7 +200,7 @@ public function testMultiValuedWidget() { $this->assertSession()->buttonNotExists('Remove'); // Save the node and ensure it does not have any files. - $this->drupalPostForm(NULL, ['title[0][value]' => $this->randomMachineName()], t('Save')); + $this->drupalPostForm(NULL, ['title[0][value]' => $this->randomMachineName()], 'Save'); preg_match('/node\/([0-9])/', $this->getUrl(), $matches); $nid = $matches[1]; $node = $node_storage->loadUnchanged($nid); @@ -259,7 +259,7 @@ public function testPrivateFileSetting() { // Change the field setting to make its files private, and upload a file. $edit = ['settings[uri_scheme]' => 'private']; - $this->drupalPostForm("admin/structure/types/manage/$type_name/fields/$field_id/storage", $edit, t('Save field settings')); + $this->drupalPostForm("admin/structure/types/manage/$type_name/fields/$field_id/storage", $edit, 'Save field settings'); $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); $node = $node_storage->loadUnchanged($nid); $node_file = File::load($node->{$field_name}->target_id); @@ -310,7 +310,7 @@ public function testPrivateFileComment() { $edit = [ 'title[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm('node/add/article', $edit, t('Save')); + $this->drupalPostForm('node/add/article', $edit, 'Save'); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); // Add a comment with a file. @@ -319,7 +319,7 @@ public function testPrivateFileComment() { 'files[field_' . $name . '_' . 0 . ']' => \Drupal::service('file_system')->realpath($text_file->getFileUri()), 'comment_body[0][value]' => $comment_body = $this->randomMachineName(), ]; - $this->drupalPostForm('node/' . $node->id(), $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id(), $edit, 'Save'); // Get the comment ID. preg_match('/comment-([0-9]+)/', $this->getUrl(), $matches); @@ -345,7 +345,7 @@ public function testPrivateFileComment() { // Unpublishes node. $this->drupalLogin($this->adminUser); $edit = ['status[value]' => FALSE]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); // Ensures normal user can no longer download the file. $this->drupalLogin($user); @@ -373,14 +373,14 @@ public function testWidgetValidation() { // Upload file with incorrect extension, check for validation error. $edit[$name] = \Drupal::service('file_system')->realpath($test_file_image->getFileUri()); - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); $error_message = t('Only files with the following extensions are allowed: %files-allowed.', ['%files-allowed' => 'txt']); $this->assertRaw($error_message); // Upload file with correct extension, check that error message is removed. $edit[$name] = \Drupal::service('file_system')->realpath($test_file_text->getFileUri()); - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); $this->assertNoRaw($error_message); } @@ -502,7 +502,7 @@ protected function doTestTemporaryFileRemovalExploit(UserInterface $victim_user, // Attach a file to a node. $edit['files[' . $field_name . '_0]'] = $this->container->get('file_system')->realpath($test_file->getFileUri()); - $this->drupalPostForm(Url::fromRoute('node.add', ['node_type' => $type_name]), $edit, t('Save')); + $this->drupalPostForm(Url::fromRoute('node.add', ['node_type' => $type_name]), $edit, 'Save'); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); /** @var \Drupal\file\FileInterface $node_file */ diff --git a/core/modules/file/tests/src/Functional/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php index 4a9a4f33a0c66feb89ae5240fde86674bd0ffc4a..69dfb0c30399bb3235d481dec73910649b8fa91c 100644 --- a/core/modules/file/tests/src/Functional/FileListingTest.php +++ b/core/modules/file/tests/src/Functional/FileListingTest.php @@ -107,7 +107,7 @@ public function testFileListingPages() { $edit = [ 'files[file_0]' => \Drupal::service('file_system')->realpath($file->getFileUri()), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $node = Node::load($node->id()); } diff --git a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php index 872aa9e09b1f8e666e0c441484fb3c1c4b303080..d04dc0fcb12c08b4dd5141fcd4a1e2895325292b 100644 --- a/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php +++ b/core/modules/file/tests/src/Functional/FileManagedFileElementTest.php @@ -38,7 +38,7 @@ public function testManagedFile() { $file_field_name = $multiple ? 'files[' . $input_base_name . '][]' : 'files[' . $input_base_name . ']'; // Submit without a file. - $this->drupalPostForm($path, [], t('Save')); + $this->drupalPostForm($path, [], 'Save'); $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [])])); // Submit with a file, but with an invalid form token. Ensure the file @@ -50,7 +50,7 @@ public function testManagedFile() { $edit = [ $file_field_name => \Drupal::service('file_system')->realpath($test_file->getFileUri()), ]; - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $this->assertText('The form has become outdated.'); $last_fid = $this->getLastFileId(); $this->assertEqual($last_fid_prior, $last_fid, 'File was not saved when uploaded with an invalid form token.'); @@ -58,27 +58,27 @@ public function testManagedFile() { // Submit a new file, without using the Upload button. $last_fid_prior = $this->getLastFileId(); $edit = [$file_field_name => \Drupal::service('file_system')->realpath($test_file->getFileUri())]; - $this->drupalPostForm($path, $edit, t('Save')); + $this->drupalPostForm($path, $edit, 'Save'); $last_fid = $this->getLastFileId(); $this->assertTrue($last_fid > $last_fid_prior, 'New file got saved.'); $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])])); // Submit no new input, but with a default file. - $this->drupalPostForm($path . '/' . $last_fid, [], t('Save')); + $this->drupalPostForm($path . '/' . $last_fid, [], 'Save'); $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])])); // Upload, then Submit. $last_fid_prior = $this->getLastFileId(); $this->drupalGet($path); $edit = [$file_field_name => \Drupal::service('file_system')->realpath($test_file->getFileUri())]; - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); $last_fid = $this->getLastFileId(); $this->assertTrue($last_fid > $last_fid_prior, 'New file got uploaded.'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', [$last_fid])])); // Remove, then Submit. - $remove_button_title = $multiple ? t('Remove selected') : t('Remove'); + $remove_button_title = $multiple ? 'Remove selected' : 'Remove'; $remove_edit = []; if ($multiple) { $selected_checkbox = ($tree ? 'nested[file]' : 'file') . '[file_' . $last_fid . '][selected]'; @@ -86,13 +86,13 @@ public function testManagedFile() { } $this->drupalGet($path . '/' . $last_fid); $this->drupalPostForm(NULL, $remove_edit, $remove_button_title); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertRaw(t('The file ids are %fids.', ['%fids' => ''])); // Upload, then Remove, then Submit. $this->drupalGet($path); $edit = [$file_field_name => \Drupal::service('file_system')->realpath($test_file->getFileUri())]; - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); $remove_edit = []; if ($multiple) { $selected_checkbox = ($tree ? 'nested[file]' : 'file') . '[file_' . $this->getLastFileId() . '][selected]'; @@ -100,7 +100,7 @@ public function testManagedFile() { } $this->drupalPostForm(NULL, $remove_edit, $remove_button_title); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertRaw(t('The file ids are %fids.', ['%fids' => ''])); } } @@ -114,17 +114,17 @@ public function testManagedFile() { $this->drupalGet($path); // Add a single file to the upload field. - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); $fid_list[] = $this->getLastFileId(); $this->assertSession()->fieldExists("nested[file][file_{$fid_list[0]}][selected]"); // Add another file to the same upload field. - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); $fid_list[] = $this->getLastFileId(); $this->assertSession()->fieldExists("nested[file][file_{$fid_list[1]}][selected]"); // Save the entire form. - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); // Check that two files are saved into a single multiple file element. $this->assertRaw(t('The file ids are %fids.', ['%fids' => implode(',', $fid_list)])); @@ -132,7 +132,7 @@ public function testManagedFile() { $edit = [ 'nested[file][file_' . $fid_list[0] . '][selected]' => '1', ]; - $this->drupalPostForm($path . '/' . implode(',', $fid_list), $edit, t('Remove selected')); + $this->drupalPostForm($path . '/' . implode(',', $fid_list), $edit, 'Remove selected'); // Check that the first file has been deleted but not the second. $this->assertSession()->fieldNotExists("nested[file][file_{$fid_list[0]}][selected]"); @@ -148,13 +148,13 @@ public function testManagedFileRemoved() { $file_field_name = 'files[nested_file][]'; $edit = [$file_field_name => \Drupal::service('file_system')->realpath($test_file->getFileUri())]; - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); $fid = $this->getLastFileId(); $file = \Drupal::entityTypeManager()->getStorage('file')->load($fid); $file->delete(); - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); // We expect the title 'Managed file & butter' which got escaped // via a t() call before. $this->assertRaw('The file referenced by the Managed file & butter field does not exist.'); @@ -168,7 +168,7 @@ public function testFileNameTrim() { $last_fid_prior = $this->getLastFileId(); $this->drupalPostForm('file/test/0/0/0', [ 'files[file]' => \Drupal::service('file_system')->realpath('public://.leading-period.txt'), - ], t('Save')); + ], 'Save'); $next_fid = $this->getLastFileId(); $this->assertGreaterThan($last_fid_prior, $next_fid); $file = File::load($next_fid); @@ -184,8 +184,8 @@ public function testFileRemovedFromDisk() { $file_field_name = 'files[nested_file][]'; $edit = [$file_field_name => \Drupal::service('file_system')->realpath($test_file->getFileUri())]; - $this->drupalPostForm(NULL, $edit, t('Upload')); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, $edit, 'Upload'); + $this->drupalPostForm(NULL, [], 'Save'); $fid = $this->getLastFileId(); /** @var $file \Drupal\file\FileInterface */ diff --git a/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php b/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php index b36fe78683b304cb47dfbcbdcafd6ceca3a9c470..df2a308c52f650a4eb73b6886b19c38feea697d3 100644 --- a/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php +++ b/core/modules/file/tests/src/Functional/FileOnTranslatedEntityTest.php @@ -66,11 +66,11 @@ protected function setUp(): void { // Add a second and third language. $edit = []; $edit['predefined_langcode'] = 'fr'; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); $edit = []; $edit['predefined_langcode'] = 'nl'; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); // Enable translation for "Basic page" nodes. $edit = [ @@ -78,7 +78,7 @@ protected function setUp(): void { 'settings[node][page][translatable]' => 1, "settings[node][page][fields][$this->fieldName]" => 1, ]; - $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration'); } /** @@ -96,18 +96,18 @@ public function testSyncedFiles() { $edit = []; $name = 'files[' . $this->fieldName . '_0]'; $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('text')[0]->uri); - $this->drupalPostForm('node/' . $default_language_node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $default_language_node->id() . '/edit', $edit, 'Save'); $first_fid = $this->getLastFileId(); // Translate the node into French: remove the existing file. - $this->drupalPostForm('node/' . $default_language_node->id() . '/translations/add/en/fr', [], t('Remove')); + $this->drupalPostForm('node/' . $default_language_node->id() . '/translations/add/en/fr', [], 'Remove'); // Upload a different file. $edit = []; $edit['title[0][value]'] = 'Bill Murray'; $name = 'files[' . $this->fieldName . '_0]'; $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('text')[1]->uri); - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); // This inspects the HTML after the post of the translation, the file // should be displayed on the original node. $this->assertRaw('file--mime-text-plain'); @@ -126,14 +126,14 @@ public function testSyncedFiles() { $this->assertTrue($file->isPermanent()); // Translate the node into dutch: remove the existing file. - $this->drupalPostForm('node/' . $default_language_node->id() . '/translations/add/en/nl', [], t('Remove')); + $this->drupalPostForm('node/' . $default_language_node->id() . '/translations/add/en/nl', [], 'Remove'); // Upload a different file. $edit = []; $edit['title[0][value]'] = 'Scarlett Johansson'; $name = 'files[' . $this->fieldName . '_0]'; $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('text')[2]->uri); - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $third_fid = $this->getLastFileId(); \Drupal::entityTypeManager()->getStorage('file')->resetCache(); @@ -154,14 +154,14 @@ public function testSyncedFiles() { $this->assertTrue($file->isPermanent()); // Edit the second translation: remove the existing file. - $this->drupalPostForm('fr/node/' . $default_language_node->id() . '/edit', [], t('Remove')); + $this->drupalPostForm('fr/node/' . $default_language_node->id() . '/edit', [], 'Remove'); // Upload a different file. $edit = []; $edit['title[0][value]'] = 'David Bowie'; $name = 'files[' . $this->fieldName . '_0]'; $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('text')[3]->uri); - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $replaced_second_fid = $this->getLastFileId(); \Drupal::entityTypeManager()->getStorage('file')->resetCache(); @@ -178,7 +178,7 @@ public function testSyncedFiles() { $this->assertTrue($file->isPermanent()); // Delete the third translation. - $this->drupalPostForm('nl/node/' . $default_language_node->id() . '/delete', [], t('Delete Dutch translation')); + $this->drupalPostForm('nl/node/' . $default_language_node->id() . '/delete', [], 'Delete Dutch translation'); \Drupal::entityTypeManager()->getStorage('file')->resetCache(); @@ -194,7 +194,7 @@ public function testSyncedFiles() { $this->assertTrue($file->isTemporary()); // Delete the all translations. - $this->drupalPostForm('node/' . $default_language_node->id() . '/delete', [], t('Delete all translations')); + $this->drupalPostForm('node/' . $default_language_node->id() . '/delete', [], 'Delete all translations'); \Drupal::entityTypeManager()->getStorage('file')->resetCache(); diff --git a/core/modules/file/tests/src/Functional/FilePrivateTest.php b/core/modules/file/tests/src/Functional/FilePrivateTest.php index 500b53ed3fc9ccb0801d4760dda993c3746b22f4..317205869c04f536171043780cbb9c118ea2ee8b 100644 --- a/core/modules/file/tests/src/Functional/FilePrivateTest.php +++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php @@ -83,7 +83,7 @@ public function testPrivateFile() { // Attempt to reuse the file when editing a node. $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); - $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save')); + $this->drupalPostForm('node/add/' . $type_name, $edit, 'Save'); $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']); // Can't use drupalPostForm() to set hidden fields. @@ -141,7 +141,7 @@ public function testPrivateFile() { $test_file = $this->getTestFile('text'); $this->drupalGet('node/add/' . $type_name); $edit = ['files[' . $field_name . '_0]' => $file_system->realpath($test_file->getFileUri())]; - $this->drupalPostForm(NULL, $edit, t('Upload')); + $this->drupalPostForm(NULL, $edit, 'Upload'); /** @var \Drupal\file\FileStorageInterface $file_storage */ $file_storage = $this->container->get('entity_type.manager')->getStorage('file'); $files = $file_storage->loadByProperties(['uid' => 0]); @@ -168,7 +168,7 @@ public function testPrivateFile() { $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); $edit['files[' . $field_name . '_0]'] = $file_system->realpath($test_file->getFileUri()); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $file_id = $new_node->{$field_name}->target_id; $file = File::load($file_id); @@ -197,7 +197,7 @@ public function testPrivateFile() { $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); $edit['files[' . $field_name . '_0]'] = $file_system->realpath($test_file->getFileUri()); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $file = File::load($new_node->{$field_name}->target_id); $this->assertTrue($file->isPermanent(), 'File is permanent.'); @@ -222,7 +222,7 @@ public function testPrivateFile() { $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); $edit['files[' . $field_name . '_0]'] = $file_system->realpath($test_file->getFileUri()); - $this->drupalPostForm(NULL, $edit, t('Save')); + $this->drupalPostForm(NULL, $edit, 'Save'); $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $new_node->setUnpublished(); $new_node->save(); diff --git a/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php b/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php index 72e777b66b99226b5bb255d26c76dcc84733b1c9..6ee7b82592a882572d2b988042152f6273dfeaa0 100644 --- a/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php +++ b/core/modules/file/tests/src/Functional/PrivateFileOnTranslatedEntityTest.php @@ -59,7 +59,7 @@ protected function setUp(): void { // Add a second language. $edit = []; $edit['predefined_langcode'] = 'fr'; - $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language')); + $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); // Enable translation for "Basic page" nodes. $edit = [ @@ -67,7 +67,7 @@ protected function setUp(): void { 'settings[node][page][translatable]' => 1, "settings[node][page][fields][$this->fieldName]" => 1, ]; - $this->drupalPostForm('admin/config/regional/content-language', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/regional/content-language', $edit, 'Save configuration'); } /** @@ -85,7 +85,7 @@ public function testPrivateLanguageFile() { $edit = []; $name = 'files[' . $this->fieldName . '_0]'; $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('text')[0]->uri); - $this->drupalPostForm('node/' . $default_language_node->id() . '/edit', $edit, t('Save')); + $this->drupalPostForm('node/' . $default_language_node->id() . '/edit', $edit, 'Save'); $last_fid_prior = $this->getLastFileId(); // Languages are cached on many levels, and we need to clear those caches. @@ -103,14 +103,14 @@ public function testPrivateLanguageFile() { $this->clickLink(t('Add')); // Remove the existing file. - $this->drupalPostForm(NULL, [], t('Remove')); + $this->drupalPostForm(NULL, [], 'Remove'); // Upload a different file. $edit = []; $edit['title[0][value]'] = $this->randomMachineName(); $name = 'files[' . $this->fieldName . '_0]'; $edit[$name] = \Drupal::service('file_system')->realpath($this->drupalGetTestFiles('text')[1]->uri); - $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); + $this->drupalPostForm(NULL, $edit, 'Save (this translation)'); $last_fid = $this->getLastFileId(); // Verify the translation was created. diff --git a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php index 07524ad439e3d8e158a37fffa349581175e6df3f..643dbcf37c62833c7a7562597238d504d2c3e012 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php @@ -85,7 +85,7 @@ protected function setUp(): void { 'file_test_replace' => FileSystemInterface::EXISTS_REPLACE, 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); @@ -114,7 +114,7 @@ public function testNormal() { /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = \Drupal::service('file_system'); $edit = ['files[file_test_upload][]' => $file_system->realpath($image2->uri)]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); $max_fid_after = (int) \Drupal::entityQueryAggregate('file')->aggregate('fid', 'max')->execute()[0]['fid_max']; @@ -140,7 +140,7 @@ public function testNormal() { 'files[file_test_upload][]' => $image3_realpath, 'file_subdir' => $dir, ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); $this->assertFileExists('temporary://' . $dir . '/' . trim(\Drupal::service('file_system')->basename($image3_realpath))); @@ -163,7 +163,7 @@ public function testHandleExtension() { 'extensions' => $extensions, ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $message = t('Only files with the following extensions are allowed:') . ' ' . $extensions . ''; $this->assertRaw($message); @@ -183,7 +183,7 @@ public function testHandleExtension() { 'extensions' => $extensions, ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('Only files with the following extensions are allowed:')); $this->assertRaw(t('You WIN!')); @@ -200,7 +200,7 @@ public function testHandleExtension() { 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), 'allow_all_extensions' => TRUE, ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('Only files with the following extensions are allowed:')); $this->assertRaw(t('You WIN!')); @@ -225,7 +225,7 @@ public function testHandleDangerousFile() { 'extensions' => 'php', ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $message = t('For security reasons, your upload has been renamed to') . ' ' . $this->phpfile->filename . '.txt' . ''; $this->assertRaw($message); @@ -241,7 +241,7 @@ public function testHandleDangerousFile() { // Reset the hook counters. file_test_reset(); - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('For security reasons, your upload has been renamed')); $this->assertRaw(t('File name is @filename', ['@filename' => $this->phpfile->filename])); @@ -277,7 +277,7 @@ public function testHandleFileMunge() { $munged_filename = substr($munged_filename, 0, strrpos($munged_filename, '.')); $munged_filename .= '_.' . $this->imageExtension; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('For security reasons, your upload has been renamed')); $this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename])); @@ -295,7 +295,7 @@ public function testHandleFileMunge() { 'allow_all_extensions' => TRUE, ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('For security reasons, your upload has been renamed')); $this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()])); @@ -315,7 +315,7 @@ public function testExistingRename() { 'file_test_replace' => FileSystemInterface::EXISTS_RENAME, 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); @@ -333,7 +333,7 @@ public function testExistingReplace() { 'file_test_replace' => FileSystemInterface::EXISTS_REPLACE, 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); @@ -351,7 +351,7 @@ public function testExistingError() { 'file_test_replace' => FileSystemInterface::EXISTS_ERROR, 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('Epic upload FAIL!')); @@ -363,7 +363,7 @@ public function testExistingError() { * Tests for no failures when not uploading a file. */ public function testNoUpload() { - $this->drupalPostForm('file-test/save_upload_from_form_test', [], t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', [], 'Submit'); $this->assertNoRaw(t('Epic upload FAIL!')); } @@ -384,7 +384,7 @@ public function testDrupalMovingUploadedFileError() { ]; \Drupal::state()->set('file_test.disable_error_collection', TRUE); - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('File upload error. Could not move uploaded file.')); $this->assertRaw(t('Epic upload FAIL!')); @@ -410,7 +410,7 @@ public function testErrorMessagesAreNotChanged() { 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), 'error_message' => $error, ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); @@ -426,7 +426,7 @@ public function testErrorMessagesAreNotChanged() { 'error_message' => $error, 'extensions' => 'foo', ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('Epic upload FAIL!')); @@ -440,7 +440,7 @@ public function testErrorMessagesAreNotChanged() { $edit = [ 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); @@ -494,7 +494,7 @@ public function testUploadFieldIsHighlighted() { 'files[file_test_upload][]' => $file_system->realpath($this->image->getFileUri()), 'extensions' => 'foo', ]; - $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit')); + $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('Epic upload FAIL!')); $this->assertCount(1, $this->cssSelect('input[name="files[file_test_upload][]"].error'), 'File upload field has error.'); diff --git a/core/modules/file/tests/src/Functional/SaveUploadTest.php b/core/modules/file/tests/src/Functional/SaveUploadTest.php index 04802f329613c2b10f88d1556c39052b4e6bcc6b..2e765cbc72a01d81a3035ba072293f7d08e9cfa8 100644 --- a/core/modules/file/tests/src/Functional/SaveUploadTest.php +++ b/core/modules/file/tests/src/Functional/SaveUploadTest.php @@ -80,7 +80,7 @@ protected function setUp(): void { 'file_test_replace' => FileSystemInterface::EXISTS_REPLACE, 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); // Check that the success message is present. $this->assertRaw(t('You WIN!')); @@ -108,7 +108,7 @@ public function testNormal() { // Upload a second file. $image2 = current($this->drupalGetTestFiles('image')); $edit = ['files[file_test_upload]' => \Drupal::service('file_system')->realpath($image2->uri)]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); $max_fid_after = (int) \Drupal::entityQueryAggregate('file')->aggregate('fid', 'max')->execute()[0]['fid_max']; @@ -134,7 +134,7 @@ public function testNormal() { 'files[file_test_upload]' => $image3_realpath, 'file_subdir' => $dir, ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); $this->assertFileExists('temporary://' . $dir . '/' . trim(\Drupal::service('file_system')->basename($image3_realpath))); @@ -147,7 +147,7 @@ public function testDuplicate() { // It should not be possible to create two managed files with the same URI. $image1 = current($this->drupalGetTestFiles('image')); $edit = ['files[file_test_upload]' => \Drupal::service('file_system')->realpath($image1->uri)]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $max_fid_after = (int) \Drupal::entityQueryAggregate('file')->aggregate('fid', 'max')->execute()[0]['fid_max']; $file1 = File::load($max_fid_after); @@ -159,7 +159,7 @@ public function testDuplicate() { $image2 = $image1; $edit = ['files[file_test_upload]' => \Drupal::service('file_system')->realpath($image2->uri)]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); // Received a 200 response for posted test file. $this->assertSession()->statusCodeEquals(200); $message = t('The file %file already exists. Enter a unique file URI.', ['%file' => $file1->getFileUri()]); @@ -184,7 +184,7 @@ public function testHandleExtension() { 'extensions' => $extensions, ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $message = t('Only files with the following extensions are allowed:') . ' ' . $extensions . ''; $this->assertRaw($message); @@ -204,7 +204,7 @@ public function testHandleExtension() { 'extensions' => $extensions, ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('Only files with the following extensions are allowed:')); $this->assertRaw(t('You WIN!')); @@ -221,7 +221,7 @@ public function testHandleExtension() { 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()), 'allow_all_extensions' => TRUE, ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('Only files with the following extensions are allowed:')); $this->assertRaw(t('You WIN!')); @@ -244,7 +244,7 @@ public function testHandleDangerousFile() { 'extensions' => 'php', ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $message = t('For security reasons, your upload has been renamed to') . ' ' . $this->phpfile->filename . '.txt' . ''; $this->assertRaw($message); @@ -261,7 +261,7 @@ public function testHandleDangerousFile() { // Reset the hook counters. file_test_reset(); - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('For security reasons, your upload has been renamed')); $this->assertSession()->pageTextContains('File name is php-2.php.'); @@ -295,7 +295,7 @@ public function testHandleFileMunge() { $munged_filename = substr($munged_filename, 0, strrpos($munged_filename, '.')); $munged_filename .= '_.' . $this->imageExtension; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('For security reasons, your upload has been renamed')); $this->assertRaw(t('File name is @filename', ['@filename' => $munged_filename])); @@ -313,7 +313,7 @@ public function testHandleFileMunge() { 'allow_all_extensions' => TRUE, ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertNoRaw(t('For security reasons, your upload has been renamed')); $this->assertRaw(t('File name is @filename', ['@filename' => $this->image->getFilename()])); @@ -331,7 +331,7 @@ public function testExistingRename() { 'file_test_replace' => FileSystemInterface::EXISTS_RENAME, 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); $this->assertSession()->pageTextContains('File name is image-test_0.png.'); @@ -348,7 +348,7 @@ public function testExistingReplace() { 'file_test_replace' => FileSystemInterface::EXISTS_REPLACE, 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('You WIN!')); $this->assertSession()->pageTextContains('File name is image-test.png.'); @@ -365,7 +365,7 @@ public function testExistingError() { 'file_test_replace' => FileSystemInterface::EXISTS_ERROR, 'files[file_test_upload]' => \Drupal::service('file_system')->realpath($this->image->getFileUri()), ]; - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('Epic upload FAIL!')); @@ -377,7 +377,7 @@ public function testExistingError() { * Test for no failures when not uploading a file. */ public function testNoUpload() { - $this->drupalPostForm('file-test/upload', [], t('Submit')); + $this->drupalPostForm('file-test/upload', [], 'Submit'); $this->assertNoRaw(t('Epic upload FAIL!')); } @@ -398,7 +398,7 @@ public function testDrupalMovingUploadedFileError() { ]; \Drupal::state()->set('file_test.disable_error_collection', TRUE); - $this->drupalPostForm('file-test/upload', $edit, t('Submit')); + $this->drupalPostForm('file-test/upload', $edit, 'Submit'); $this->assertSession()->statusCodeEquals(200); $this->assertRaw(t('File upload error. Could not move uploaded file.')); $this->assertRaw(t('Epic upload FAIL!')); diff --git a/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php b/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php index 6a3b4d6f61d7cd67d94b8b99c46423deb9d28a23..94416131ac2ab1dde97d61a082e5766df5ec6935 100644 --- a/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php +++ b/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php @@ -73,7 +73,7 @@ public function testManagedFile() { $this->assertNotEmpty($uploaded_file); $last_fid = $this->getLastFileId(); $this->assertGreaterThan($last_fid_prior, $last_fid, 'New file got uploaded.'); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); // Remove, then Submit. $remove_button_title = $multiple ? t('Remove selected') : t('Remove'); @@ -84,7 +84,7 @@ public function testManagedFile() { } $this->getSession()->getPage()->pressButton($remove_button_title); $this->assertSession()->assertWaitOnAjaxRequest(); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertSession()->responseContains(t('The file ids are %fids.', ['%fids' => ''])); // Upload, then Remove, then Submit. @@ -99,7 +99,7 @@ public function testManagedFile() { $this->getSession()->getPage()->pressButton($remove_button_title); $this->assertSession()->assertWaitOnAjaxRequest(); - $this->drupalPostForm(NULL, [], t('Save')); + $this->drupalPostForm(NULL, [], 'Save'); $this->assertSession()->responseContains(t('The file ids are %fids.', ['%fids' => ''])); } } diff --git a/core/modules/filter/tests/src/Functional/FilterAdminTest.php b/core/modules/filter/tests/src/Functional/FilterAdminTest.php index 249506935057e5210f193833e14ccea366212ae8..ba2f539bf8000f3cf22bdd8b1f048689dfd7bd6c 100644 --- a/core/modules/filter/tests/src/Functional/FilterAdminTest.php +++ b/core/modules/filter/tests/src/Functional/FilterAdminTest.php @@ -134,7 +134,7 @@ public function testFormatAdmin() { 'format' => $format_id, 'name' => $name, ]; - $this->drupalPostForm(NULL, $edit, t('Save configuration')); + $this->drupalPostForm(NULL, $edit, 'Save configuration'); // Verify default weight of the text format. $this->drupalGet('admin/config/content/formats'); @@ -144,7 +144,7 @@ public function testFormatAdmin() { $edit = [ "formats[$format_id][weight]" => 5, ]; - $this->drupalPostForm('admin/config/content/formats', $edit, t('Save')); + $this->drupalPostForm('admin/config/content/formats', $edit, 'Save'); $this->assertSession()->fieldValueEquals("formats[$format_id][weight]", 5); // Edit text format. @@ -153,7 +153,7 @@ public function testFormatAdmin() { $edit_href = Url::fromRoute('entity.filter_format.edit_form', ['filter_format' => $format_id], ['query' => ['destination' => $destination]])->toString(); $this->assertSession()->linkByHrefExists($edit_href); $this->drupalGet('admin/config/content/formats/manage/' . $format_id); - $this->drupalPostForm(NULL, [], t('Save configuration')); + $this->drupalPostForm(NULL, [], 'Save configuration'); // Verify that the custom weight of the text format has been retained. $this->drupalGet('admin/config/content/formats'); @@ -162,7 +162,7 @@ public function testFormatAdmin() { // Disable text format. $this->assertSession()->linkByHrefExists('admin/config/content/formats/manage/' . $format_id . '/disable'); $this->drupalGet('admin/config/content/formats/manage/' . $format_id . '/disable'); - $this->drupalPostForm(NULL, [], t('Disable')); + $this->drupalPostForm(NULL, [], 'Disable'); // Verify that disabled text format no longer exists. $this->drupalGet('admin/config/content/formats/manage/' . $format_id); @@ -174,7 +174,7 @@ public function testFormatAdmin() { 'format' => $format_id, 'name' => 'New format', ]; - $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/content/formats/add', $edit, 'Save configuration'); $this->assertText('The machine-readable name is already in use. It must be unique.'); // Attempt to create a format of the same human readable name as the @@ -183,7 +183,7 @@ public function testFormatAdmin() { 'format' => 'new_format', 'name' => $name, ]; - $this->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration')); + $this->drupalPostForm('admin/config/content/formats/add', $edit, 'Save configuration'); $this->assertRaw(t('Text format names must be unique. A format named %name already exists.', [ '%name' => $name, ])); @@ -216,7 +216,7 @@ public function testFilterAdmin() { // Add an additional tag and extra spaces and returns. $edit = []; $edit['filters[filter_html][settings][allowed_html]'] = "