diff --git a/core/modules/action/tests/src/Functional/ConfigurationTest.php b/core/modules/action/tests/src/Functional/ConfigurationTest.php index c2f9872582..f429d519c0 100644 --- a/core/modules/action/tests/src/Functional/ConfigurationTest.php +++ b/core/modules/action/tests/src/Functional/ConfigurationTest.php @@ -52,7 +52,7 @@ public function testActionConfiguration() { $action_id = $edit['id']; // Make sure that the new complex action was saved properly. - $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully saved the complex action."); + $this->assertText('The action has been successfully saved.', "Make sure we get a confirmation that we've successfully saved the complex action."); $this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action."); // Make another POST request to the action edit page. @@ -66,7 +66,7 @@ public function testActionConfiguration() { $this->assertSession()->statusCodeEquals(200); // Make sure that the action updated properly. - $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully updated the complex action."); + $this->assertText('The action has been successfully saved.', "Make sure we get a confirmation that we've successfully updated the complex action."); $this->assertNoText($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action."); $this->assertText($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action."); diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php index 7b8754f8fd..56a43c5801 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php @@ -37,7 +37,7 @@ public function testSettingsPage() { 'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor', ]; $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); // Check that settings have the correct default value. foreach ($edit as $name => $value) { @@ -45,13 +45,13 @@ public function testSettingsPage() { } // Check for our test processor settings form. - $this->assertText(t('Dummy length setting')); + $this->assertText('Dummy length setting'); // Change its value to ensure that settingsSubmit is called. $edit = [ 'dummy_length' => 100, ]; $this->drupalPostForm('admin/config/services/aggregator/settings', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); $this->assertSession()->fieldValueEquals('dummy_length', 100); // Make sure settings form is still accessible even after uninstalling a module diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php index a21f166654..cd128cae05 100644 --- a/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php +++ b/core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php @@ -75,7 +75,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->assertText(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']])); + $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. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]'); diff --git a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php index 37aafaa851..e925431c05 100644 --- a/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php +++ b/core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php @@ -74,7 +74,7 @@ public function validateImportFormFields() { $edit = ['remote' => 'invalidUrl://empty']; $this->drupalPostForm('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertText(t('The URL invalidUrl://empty is not valid.'), 'Error if the URL is invalid.'); + $this->assertText('The URL invalidUrl://empty is not valid.', 'Error if the URL is invalid.'); $after = $count_query->execute(); $this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.'); @@ -89,11 +89,11 @@ protected function submitImportForm() { $form['files[upload]'] = $this->getInvalidOpml(); $this->drupalPostForm('admin/config/services/aggregator/add/opml', $form, t('Import')); - $this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.'); + $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->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.'); + $this->assertText('No new feed has been added.', 'Attempting to load empty OPML from remote URL.'); $after = $count_query->execute(); $this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.'); diff --git a/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php index 6181d8d414..7a8bf69d71 100644 --- a/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php +++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedItemTest.php @@ -44,7 +44,7 @@ public function testUpdateFeedItem() { $this->assertSession()->statusCodeEquals(200); $this->drupalPostForm('aggregator/sources/add', $edit, t('Save')); - $this->assertText(t('The feed @name has been added.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed @name has been added.', ['@name' => $edit['title[0][value]']])); + $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. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]'); diff --git a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php index bbc57b4be5..77e936e75d 100644 --- a/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php +++ b/core/modules/aggregator/tests/src/Functional/UpdateFeedTest.php @@ -32,7 +32,7 @@ public function testUpdateFeed() { $edit[$same_field] = $feed->{$same_field}->value; } $this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save')); - $this->assertText(t('The feed @name has been updated.', ['@name' => $edit['title[0][value]']]), new FormattableMarkup('The feed %name has been updated.', ['%name' => $edit['title[0][value]']])); + $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. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "aggregator/sources/")]'); diff --git a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php index 04a9b75602..9a177f1c10 100644 --- a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php +++ b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php @@ -47,25 +47,25 @@ public function testIPAddressValidation() { $edit = []; $edit['ip'] = '1.2.3.3'; $this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); - $this->assertText(t('This IP address is already banned.')); + $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->assertText(t('Enter a valid IP address.')); + $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->assertText(t('Enter a valid IP address.')); + $this->assertText('Enter a valid IP address.'); // Submit an empty form. $edit = []; $edit['ip'] = ''; $this->drupalPostForm('admin/config/people/ban', $edit, t('Add')); - $this->assertText(t('Enter a valid IP address.')); + $this->assertText('Enter a valid IP address.'); // Pass an IP address as a URL parameter and submit it. $submit_ip = '1.2.3.4'; @@ -80,7 +80,7 @@ public function testIPAddressValidation() { // $edit = array(); // $edit['ip'] = \Drupal::request()->getClientIP(); // $this->drupalPostForm('admin/config/people/ban', $edit, t('Save')); - // $this->assertText(t('You may not ban your own IP address.')); + // $this->assertText('You may not ban your own IP address.'); // Test duplicate ip address are not present in the 'blocked_ips' table. // when they are entered programmatically. diff --git a/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php b/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php index 5a6aeef95b..4eef431b16 100644 --- a/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php +++ b/core/modules/block/tests/src/Functional/BlockLanguageCacheTest.php @@ -68,7 +68,7 @@ public function testBlockLinks() { $edit['label'] = $this->randomMachineName(); $edit['id'] = mb_strtolower($edit['label']); $this->drupalPostForm('admin/structure/menu/add', $edit, t('Save')); - $this->assertText(t('Menu @label has been added.', ['@label' => $edit['label']])); + $this->assertText('Menu ' . $edit['label'] . ' has been added.'); // Check that the block is listed for all languages. foreach ($this->langcodes as $langcode) { diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php index a7ab47a4c8..4112fde5d5 100644 --- a/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -200,7 +200,7 @@ public function testBlock() { // 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->assertText(t('The block configuration has been saved.'), 'Block title set.'); + $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']); @@ -216,7 +216,7 @@ public function testBlock() { $this->clickLink('Disable'); // Confirm that the block is now listed as disabled. - $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to disabled region.'); + $this->assertText('The block settings have been updated.', 'Block successfully moved to disabled region.'); // Confirm that the block instance title and markup are not displayed. $this->drupalGet('node'); @@ -341,11 +341,11 @@ public function moveBlockToRegion(array $block, $region) { $this->drupalPostForm('admin/structure/block', $edit, t('Save blocks')); // Confirm that the block was moved to the proper region. - $this->assertText(t('The block settings have been updated.'), new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region])); + $this->assertText('The block settings have been updated.', new FormattableMarkup('Block successfully moved to %region_name region.', ['%region_name' => $region])); // Confirm that the block is being displayed. $this->drupalGet(''); - $this->assertText(t($block['settings[label]']), 'Block successfully being displayed on the page.'); + $this->assertText($block['settings[label]'], 'Block successfully being displayed on the page.'); // Confirm that the custom block was found at the proper region. $xpath = $this->assertSession()->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', [ diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php index 695987ade4..7332aa8b62 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php @@ -113,7 +113,7 @@ public function testListing() { $this->assertNoFieldByXpath('//td', $new_label, 'No label found for deleted custom block.'); // Confirm that the empty text is displayed. - $this->assertText(t('There are no custom blocks yet.')); + $this->assertText('There are no custom blocks yet.'); $block_content = BlockContent::create([ 'info' => 'Non-reusable block', diff --git a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php index e064f7a85d..b8cba2cf8a 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php @@ -174,7 +174,7 @@ public function testBlockContentTypeDeletion() { $this->assertRaw( t('Are you sure you want to delete the custom block type %type?', ['%type' => $type->id()]) ); - $this->assertText(t('This action cannot be undone.'), 'The custom block type deletion confirmation form is available.'); + $this->assertText('This action cannot be undone.', 'The custom block type deletion confirmation form is available.'); } /** diff --git a/core/modules/block_content/tests/src/Functional/PageEditTest.php b/core/modules/block_content/tests/src/Functional/PageEditTest.php index 9ef21f9510..d83fcd2823 100644 --- a/core/modules/block_content/tests/src/Functional/PageEditTest.php +++ b/core/modules/block_content/tests/src/Functional/PageEditTest.php @@ -70,7 +70,7 @@ public function testPageEdit() { // Test deleting the block. $this->drupalGet("block/" . $revised_block->id()); $this->clickLink(t('Delete')); - $this->assertText(new FormattableMarkup('Are you sure you want to delete the custom block @label?', ['@label' => $revised_block->label()])); + $this->assertText('Are you sure you want to delete the custom block' . $revised_block->label() . '?'); } } diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php index bbce9eee26..7804731c93 100644 --- a/core/modules/book/tests/src/Functional/BookTest.php +++ b/core/modules/book/tests/src/Functional/BookTest.php @@ -146,7 +146,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->assertText(t('Updated book @book.', ['@book' => $book->label()])); + $this->assertText('Updated book ' . $book->label() . '.'); } /** @@ -274,7 +274,7 @@ public function testBookNavigationBlock() { $edit = []; $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE; $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions')); - $this->assertText(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users."); + $this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users."); // Test correct display of the block. $nodes = $this->createBook(); @@ -347,7 +347,7 @@ public function testNavigationBlockOnAccessModuleInstalled() { $edit = []; $edit[RoleInterface::ANONYMOUS_ID . '[node test view]'] = TRUE; $this->drupalPostForm('admin/people/permissions/' . RoleInterface::ANONYMOUS_ID, $edit, t('Save permissions')); - $this->assertText(t('The changes have been saved.'), "Permission 'node test view' successfully assigned to anonymous users."); + $this->assertText('The changes have been saved.', "Permission 'node test view' successfully assigned to anonymous users."); // Create a book. $this->createBook(); diff --git a/core/modules/comment/tests/src/Functional/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/CommentAdminTest.php index 290696fe73..6807c551a2 100644 --- a/core/modules/comment/tests/src/Functional/CommentAdminTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAdminTest.php @@ -42,7 +42,7 @@ public function testApprovalAdminInterface() { // Test that the comments page loads correctly when there are no comments $this->drupalGet('admin/content/comment'); - $this->assertText(t('No comments available.')); + $this->assertText('No comments available.'); $this->drupalLogout(); @@ -51,7 +51,7 @@ public function testApprovalAdminInterface() { $body = $this->randomMachineName(); // Set $contact to true so that it won't check for id and message. $this->postComment($this->node, $body, $subject, TRUE); - $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.'); + $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. $this->drupalLogin($this->adminUser); @@ -83,13 +83,13 @@ public function testApprovalAdminInterface() { // Publish multiple comments in one operation. $this->drupalLogin($this->adminUser); $this->drupalGet('admin/content/comment/approval'); - $this->assertText(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.'); + $this->assertText('Unapproved comments (2)', 'Two unapproved comments waiting for approval.'); $edit = [ "comments[{$comments[0]->id()}]" => 1, "comments[{$comments[1]->id()}]" => 1, ]; $this->drupalPostForm(NULL, $edit, t('Update')); - $this->assertText(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.'); + $this->assertText('Unapproved comments (0)', 'All comments were approved.'); // Delete multiple comments in one operation. $edit = [ @@ -99,15 +99,15 @@ public function testApprovalAdminInterface() { "comments[{$anonymous_comment4->id()}]" => 1, ]; $this->drupalPostForm(NULL, $edit, t('Update')); - $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.'); + $this->assertText('Are you sure you want to delete these comments and all their children?', 'Confirmation required.'); $this->drupalPostForm(NULL, [], t('Delete')); - $this->assertText(t('No comments available.'), 'All comments were deleted.'); + $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->assertText(t('Select one or more comments to perform the update on.')); + $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. $this->drupalGet('admin/content/comment'); @@ -139,7 +139,7 @@ public function testApprovalNodeInterface() { $body = $this->randomMachineName(); // Set $contact to true so that it won't check for id and message. $this->postComment($this->node, $body, $subject, TRUE); - $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.'); + $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. $this->drupalLogin($this->adminUser); diff --git a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php index 8b1ef54b21..c0641377d3 100644 --- a/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAnonymousTest.php @@ -125,7 +125,7 @@ public function testAnonymous() { $anonymous_comment3 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE); // Name should have 'Anonymous' for value by default. - $this->assertText(t('Email field is required.'), 'Email required.'); + $this->assertText('Email field is required.', 'Email required.'); $this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.'); // Post comment with contact info (required). diff --git a/core/modules/comment/tests/src/Functional/CommentBlockTest.php b/core/modules/comment/tests/src/Functional/CommentBlockTest.php index ee6c3fc239..c8f6355676 100644 --- a/core/modules/comment/tests/src/Functional/CommentBlockTest.php +++ b/core/modules/comment/tests/src/Functional/CommentBlockTest.php @@ -68,7 +68,7 @@ public function testRecentCommentBlock() { // block. $this->drupalLogin($this->webUser); $this->drupalGet(''); - $this->assertText(t('Recent comments')); + $this->assertText('Recent comments'); // Test the only the 10 latest comments are shown and in the proper order. $this->assertNoText($comments[10]->getSubject(), 'Comment 11 not found in block.'); diff --git a/core/modules/comment/tests/src/Functional/CommentBookTest.php b/core/modules/comment/tests/src/Functional/CommentBookTest.php index 83bd9b9ce2..0f6fab865e 100644 --- a/core/modules/comment/tests/src/Functional/CommentBookTest.php +++ b/core/modules/comment/tests/src/Functional/CommentBookTest.php @@ -71,13 +71,13 @@ public function testBookCommentPrint() { $this->assertText($comment_subject, 'Comment subject found'); $this->assertText($comment_body, 'Comment body found'); - $this->assertText(t('Add new comment'), 'Comment form found'); + $this->assertText('Add new comment', 'Comment form found'); // Ensure that the comment form subject field exists. $this->assertSession()->fieldExists('subject[0][value]'); $this->drupalGet('book/export/html/' . $book_node->id()); - $this->assertText(t('Comments'), 'Comment thread found'); + $this->assertText('Comments', 'Comment thread found'); $this->assertText($comment_subject, 'Comment subject found'); $this->assertText($comment_body, 'Comment body found'); diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php index 4624081631..97d9792821 100644 --- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php +++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php @@ -163,7 +163,7 @@ public function testCommentFieldCreate() { $edit = []; $this->drupalPostForm('admin/config/people/accounts/fields/user.user.field_user_comment/storage', $edit, t('Save field settings')); // We should get an error message. - $this->assertText(t('An illegal choice has been detected. Please contact the site administrator.')); + $this->assertText('An illegal choice has been detected. Please contact the site administrator.'); // Create a comment type for users. $bundle = CommentType::create([ diff --git a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php index b7816e64b0..ed0689be12 100644 --- a/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentNonNodeTest.php @@ -241,7 +241,7 @@ public function performCommentOperation($comment, $operation, $approval = FALSE) $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.')); } else { - $this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation])); + $this->assertText('The update has been performed.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation])); } } @@ -271,7 +271,7 @@ public function testCommentFunctionality() { $this->drupalLogin($limited_user); // Test that default field exists. $this->drupalGet('entity_test/structure/entity_test/fields'); - $this->assertText(t('Comments')); + $this->assertText('Comments'); $this->assertSession()->linkByHrefExists('entity_test/structure/entity_test/fields/entity_test.entity_test.comment'); // Test widget hidden option is not visible when there's no comments. $this->drupalGet('entity_test/structure/entity_test/fields/entity_test.entity_test.comment'); diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 7a8406fd21..3934e70355 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -348,7 +348,7 @@ public function testTwoPagers() { $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->assertText(t('Pager ID: @id', ['@id' => 2])); + $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')); diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php index ffdcd3d53f..d944551b16 100644 --- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php @@ -170,7 +170,7 @@ public function testCommentEditPreviewSave() { // Check that saving a comment produces a success message. $this->drupalPostForm('comment/' . $comment->id() . '/edit', $edit, t('Save')); - $this->assertText(t('Your comment has been posted.'), 'Comment posted.'); + $this->assertText('Your comment has been posted.', 'Comment posted.'); // Check that the comment fields are correct after loading the saved comment. $this->drupalGet('comment/' . $comment->id() . '/edit'); diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php index 65f2dafa74..71412e2059 100644 --- a/core/modules/comment/tests/src/Functional/CommentTestBase.php +++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php @@ -227,7 +227,7 @@ public function commentExists(CommentInterface $comment = NULL, $reply = FALSE) */ public function deleteComment(CommentInterface $comment) { $this->drupalPostForm('comment/' . $comment->id() . '/delete', [], t('Delete')); - $this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.'); + $this->assertText('The comment and all its replies have been deleted.', 'Comment deleted.'); } /** @@ -367,7 +367,7 @@ public function performCommentOperation(CommentInterface $comment, $operation, $ $this->assertRaw(\Drupal::translation()->formatPlural(1, 'Deleted 1 comment.', 'Deleted @count comments.')); } else { - $this->assertText(t('The update has been performed.'), new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation])); + $this->assertText('The update has been performed.', new FormattableMarkup('Operation "@operation" was performed on comment.', ['@operation' => $operation])); } } diff --git a/core/modules/comment/tests/src/Functional/CommentTypeTest.php b/core/modules/comment/tests/src/Functional/CommentTypeTest.php index 25926d18dc..9246b2d491 100644 --- a/core/modules/comment/tests/src/Functional/CommentTypeTest.php +++ b/core/modules/comment/tests/src/Functional/CommentTypeTest.php @@ -86,7 +86,7 @@ public function testCommentTypeCreation() { // Edit the comment-type and ensure that we cannot change the entity-type. $this->drupalGet('admin/structure/comment/manage/foo'); $this->assertSession()->fieldNotExists('target_entity_type_id'); - $this->assertText(t('Target entity type')); + $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')); @@ -176,7 +176,7 @@ public function testCommentTypeDeletion() { $this->assertRaw( t('Are you sure you want to delete the comment type %type?', ['%type' => $type->id()]) ); - $this->assertText(t('This action cannot be undone.'), 'The comment type deletion confirmation form is available.'); + $this->assertText('This action cannot be undone.', 'The comment type deletion confirmation form is available.'); // Test exception thrown when re-using an existing comment type. try { diff --git a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php index 8fa3f7bb54..2e8488dff4 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentAdminTest.php @@ -53,7 +53,7 @@ public function testApprovalAdminInterface() { // Test that the comments page loads correctly when there are no comments. $this->drupalGet('admin/content/comment'); - $this->assertText(t('No comments available.')); + $this->assertText('No comments available.'); // Assert the expose filters on the admin page. $this->assertSession()->fieldExists('subject'); @@ -70,7 +70,7 @@ public function testApprovalAdminInterface() { 'name' => $author_name, 'comment_body[0][value]' => $body, ], t('Save')); - $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.'); + $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. $this->drupalLogin($this->adminUser); @@ -107,7 +107,7 @@ public function testApprovalAdminInterface() { // Publish multiple comments in one operation. $this->drupalLogin($this->adminUser); $this->drupalGet('admin/content/comment/approval'); - $this->assertText(t('Unapproved comments (@count)', ['@count' => 2]), 'Two unapproved comments waiting for approval.'); + $this->assertText('Unapproved comments (2)', 'Two unapproved comments waiting for approval.'); // Assert the expose filters on the admin page. $this->assertSession()->fieldExists('subject'); @@ -120,11 +120,11 @@ public function testApprovalAdminInterface() { "comment_bulk_form[0]" => $comments[1]->id(), ]; $this->drupalPostForm(NULL, $edit, t('Apply to selected items')); - $this->assertText(t('Unapproved comments (@count)', ['@count' => 0]), 'All comments were approved.'); + $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->assertText(t('Select one or more comments to perform the update on.')); + $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]', [ ':href' => $comments[0]->permalink()->toString(), @@ -150,9 +150,9 @@ public function testApprovalAdminInterface() { "comment_bulk_form[2]" => $anonymous_comment4->id(), ]; $this->drupalPostForm(NULL, $edit, t('Apply to selected items')); - $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.'); + $this->assertText('Are you sure you want to delete these comments and all their children?', 'Confirmation required.'); $this->drupalPostForm(NULL, [], t('Delete')); - $this->assertText(t('No comments available.'), 'All comments were deleted.'); + $this->assertText('No comments available.', 'All comments were deleted.'); // Make sure the label of unpublished node is not visible on listing page. $this->drupalGet('admin/content/comment'); diff --git a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php index 3b0a3d2ef9..745310323e 100644 --- a/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php +++ b/core/modules/config/tests/src/Functional/ConfigDependencyWebTest.php @@ -70,7 +70,7 @@ public function testConfigDependencyDeleteFormTrait() { $this->assertNoText('Configuration deletions', 'No configuration deletes found.'); $this->drupalGet($entity1->toUrl('delete-form')); $this->assertNoText('Configuration updates', 'No configuration updates found.'); - $this->assertText(t('Configuration deletions'), 'Configuration deletions found.'); + $this->assertText('Configuration deletions', 'Configuration deletions found.'); $this->assertText($entity2->id(), 'Entity2 id found'); $this->drupalPostForm($entity1->toUrl('delete-form'), [], 'Delete'); $storage->resetCache(); @@ -117,7 +117,7 @@ public function testConfigDependencyDeleteFormTrait() { $entity3->save(); $this->drupalGet($entity1->toUrl('delete-form')); - $this->assertText(t('Configuration updates'), 'Configuration updates found.'); + $this->assertText('Configuration updates', 'Configuration updates found.'); $this->assertNoText('Configuration deletions', 'No configuration deletions found.'); $this->assertNoText($entity2->id(), 'Entity2 id not found'); $this->assertText($entity2->label(), 'Entity2 label not found'); diff --git a/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php b/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php index f9345faf96..114468b419 100644 --- a/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigExportImportUITest.php @@ -92,7 +92,7 @@ public function testExportImport() { // After installation there is no snapshot and nothing to import. $this->drupalGet('admin/config/development/configuration'); $this->assertNoText('Warning message'); - $this->assertText(t('There are no configuration changes to import.')); + $this->assertText('There are no configuration changes to import.'); $this->originalSlogan = $this->config('system.site')->get('slogan'); $this->newSlogan = $this->randomString(16); @@ -175,7 +175,7 @@ public function testExportImport() { $this->drupalPostForm(NULL, [], 'Import all'); // After importing the snapshot has been updated an there are no warnings. $this->assertNoText('Warning message'); - $this->assertText(t('There are no configuration changes to import.')); + $this->assertText('There are no configuration changes to import.'); $this->assertEquals($this->newSlogan, $this->config('system.site')->get('slogan')); @@ -186,7 +186,7 @@ public function testExportImport() { ->set('slogan', $this->originalSlogan) ->save(); $this->drupalGet('admin/config/development/configuration'); - $this->assertText(t('Warning message')); + $this->assertText('Warning message'); $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.'); // Ensure the item is displayed as part of a list (to avoid false matches // on the rest of the page) and that the list markup is not escaped. @@ -197,7 +197,7 @@ public function testExportImport() { $this->drupalGet('admin/config/development/configuration'); $this->assertNoText('Warning message'); $this->assertNoText('The following items in your active configuration have changes since the last import that may be lost on the next import.'); - $this->assertText(t('There are no configuration changes to import.')); + $this->assertText('There are no configuration changes to import.'); // Write a file to sync. The warning about differences between the active // and snapshot should now exist. /** @var \Drupal\Core\Config\StorageInterface $sync */ @@ -207,7 +207,7 @@ public function testExportImport() { $this->copyConfig($this->container->get('config.storage'), $sync); $sync->write('system.site', $data); $this->drupalGet('admin/config/development/configuration'); - $this->assertText(t('Warning message')); + $this->assertText('Warning message'); $this->assertText('The following items in your active configuration have changes since the last import that may be lost on the next import.'); // Ensure the item is displayed as part of a list (to avoid false matches // on the rest of the page) and that the list markup is not escaped. @@ -279,8 +279,8 @@ public function testExportImportCollections() { // Verify that there are configuration differences to import. $this->drupalGet('admin/config/development/configuration'); $this->assertNoText('There are no configuration changes to import.'); - $this->assertText(t('@collection configuration collection', ['@collection' => 'collection.test1'])); - $this->assertText(t('@collection configuration collection', ['@collection' => 'collection.test2'])); + $this->assertText('collection.test1 configuration collection'); + $this->assertText('collection.test2 configuration collection'); $this->assertText('config_test.create'); $this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test1/config_test.create'); $this->assertText('config_test.update'); @@ -295,7 +295,7 @@ public function testExportImportCollections() { $this->assertSession()->linkByHrefExists('admin/config/development/configuration/sync/diff_collection/collection.test2/config_test.another_delete'); $this->drupalPostForm(NULL, [], 'Import all'); - $this->assertText(t('There are no configuration changes to import.')); + $this->assertText('There are no configuration changes to import.'); // Test data in collections. $data = $test1_storage->read('config_test.create'); diff --git a/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php index dfd12fab25..1fde099f94 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportUITest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php @@ -139,7 +139,7 @@ public function testImport() { $this->assertSession()->buttonNotExists('Import all'); // Verify that there are no further changes to import. - $this->assertText(t('There are no configuration changes to import.')); + $this->assertText('There are no configuration changes to import.'); $this->rebuildContainer(); // Verify site name has changed. @@ -246,7 +246,7 @@ public function testImportLock() { // Attempt to import configuration and verify that an error message appears. $this->drupalPostForm(NULL, [], t('Import all')); - $this->assertText(t('Another request may be synchronizing configuration already.')); + $this->assertText('Another request may be synchronizing configuration already.'); // Release the lock, just to keep testing sane. $this->container->get('lock.persistent')->release($config_importer::LOCK_NAME); @@ -268,7 +268,7 @@ public function testImportSiteUuidValidation() { // Verify that there are configuration differences to import. $this->drupalGet('admin/config/development/configuration'); - $this->assertText(t('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.')); + $this->assertText('The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.'); $this->assertSession()->buttonNotExists('Import all'); } @@ -443,10 +443,10 @@ public function testImportErrorLog() { // Attempt to import configuration and verify that an error message appears. $this->drupalPostForm(NULL, [], t('Import all')); - $this->assertText(new FormattableMarkup('Deleted and replaced configuration entity "@name"', ['@name' => $name_secondary])); - $this->assertText(t('The configuration was imported with errors.')); + $this->assertText('Deleted and replaced configuration entity "' . $name_secondary . '"'); + $this->assertText('The configuration was imported with errors.'); $this->assertNoText('The configuration was imported successfully.'); - $this->assertText(t('There are no configuration changes to import.')); + $this->assertText('There are no configuration changes to import.'); } /** @@ -485,7 +485,7 @@ public function testEntityBundleDelete() { $node->delete(); $this->drupalPostForm(NULL, [], t('Import all')); $this->assertNoRaw($validation_message); - $this->assertText(t('There are no configuration changes to import.')); + $this->assertText('There are no configuration changes to import.'); $this->assertNoText(new FormattableMarkup('node.type.@type', ['@type' => $node_type->id()])); $this->assertNoText(new FormattableMarkup('field.field.node.@type.body', ['@type' => $node_type->id()])); $this->assertNoText(new FormattableMarkup('core.entity_view_display.node.@type.teaser', ['@type' => $node_type->id()])); diff --git a/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php index 368fd053c1..e3e6d6aae7 100644 --- a/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php +++ b/core/modules/config/tests/src/Functional/ConfigImportUploadTest.php @@ -53,7 +53,7 @@ public function testImport() { $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->assertText(t('Could not extract the contents of the tar file')); + $this->assertText('Could not extract the contents of the tar file'); // Make the sync directory read-only. $directory = Settings::get('config_sync_directory'); diff --git a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php index 1f3ae8fe25..a1e7abf983 100644 --- a/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php +++ b/core/modules/config/tests/src/Functional/ConfigSingleImportExportTest.php @@ -68,7 +68,7 @@ public function testImport() { ]; // Attempt an import with a missing ID. $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); - $this->assertText(t('Missing ID key "@id_key" for this @entity_type import.', ['@id_key' => 'id', '@entity_type' => 'Test configuration'])); + $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')); @@ -84,12 +84,12 @@ public function testImport() { // Attempt an import with an existing ID but missing UUID. $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); - $this->assertText(t('An entity with this machine name already exists but the import did not specify a UUID.')); + $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->assertText(t('An entity with this machine name already exists but the UUID does not match.')); + $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'; @@ -229,7 +229,7 @@ public function testImportSimpleConfiguration() { 'import' => Yaml::encode($config_data), ]; $this->drupalPostForm('admin/config/development/configuration/single/import', $edit, t('Import')); - $this->assertText(t('Can not uninstall the Configuration module as part of a configuration synchronization through the user interface.')); + $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')); diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php index 65f9be8fab..23fed4d73e 100644 --- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php @@ -539,8 +539,8 @@ public function testAccountSettingsConfigurationTranslation() { $this->assertFieldByXPath($xpath, $value); } // Check that labels for email settings appear. - $this->assertText(t('Account cancellation confirmation')); - $this->assertText(t('Password recovery')); + $this->assertText('Account cancellation confirmation'); + $this->assertText('Password recovery'); } /** @@ -891,12 +891,12 @@ public function testAlterInfo() { // Check out if the translation page has the altered in settings. $this->drupalGet('admin/config/system/site-information/translate/fr/add'); - $this->assertText(t('Feed channel')); - $this->assertText(t('Feed description')); + $this->assertText('Feed channel'); + $this->assertText('Feed description'); // Check if the translation page does not have the altered out settings. $this->drupalGet('admin/config/people/accounts/translate/fr/add'); - $this->assertText(t('Name')); + $this->assertText('Name'); $this->assertNoText('Account cancellation confirmation'); $this->assertNoText('Password recovery'); } diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index f62b2286ee..dad1452b1f 100644 --- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -188,7 +188,7 @@ public function testPersonalContactAccess() { $this->drupalLogin($this->adminUser); $edit = ['contact_default_status' => FALSE]; $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.'); + $this->assertText('The configuration options have been saved.', 'Setting successfully saved.'); $this->drupalLogout(); // Re-create our contacted user with personal contact forms disabled by @@ -250,7 +250,7 @@ public function testPersonalContactFlood() { // Submit contact form with correct values and check flood interval. for ($i = 0; $i < $flood_limit; $i++) { $this->submitPersonalContact($this->contactUser); - $this->assertText(t('Your message has been sent.'), 'Message sent.'); + $this->assertText('Your message has been sent.', 'Message sent.'); } // Submit contact form one over limit. diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php index 27e44fc439..394ca7ed07 100644 --- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php +++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php @@ -107,7 +107,7 @@ public function testSiteWideContact() { $edit = []; $edit['contact_default_status'] = TRUE; $this->drupalPostForm('admin/config/people/accounts', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); $this->drupalGet('admin/structure/contact'); // Default form exists. @@ -142,7 +142,7 @@ public function testSiteWideContact() { $this->drupalLogin($admin_user); $this->drupalGet('contact'); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('The contact form has not been configured.')); + $this->assertText('The contact form has not been configured.'); // Test access personal form via site-wide contact page. $this->drupalGet('contact/personal'); $this->assertSession()->statusCodeEquals(403); @@ -157,25 +157,25 @@ public function testSiteWideContact() { // Test validation of empty form and recipients fields. $this->addContactForm('', '', '', '', TRUE); - $this->assertText(t('Label field is required.')); - $this->assertText(t('Machine-readable name field is required.')); - $this->assertText(t('Recipients field is required.')); + $this->assertText('Label field is required.'); + $this->assertText('Machine-readable name field is required.'); + $this->assertText('Recipients field is required.'); // Test validation of max_length machine name. $recipients = ['simpletest&@example.com', 'simpletest2@example.com', 'simpletest3@example.com']; $max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH; $max_length_exceeded = $max_length + 1; $this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', [$recipients[0]]), '', TRUE); - $this->assertText(new FormattableMarkup('Machine-readable name cannot be longer than @max characters but is currently @exceeded characters long.', ['@max' => $max_length, '@exceeded' => $max_length_exceeded])); + $this->assertText('Machine-readable name cannot be longer than ' . $max_length . ' characters but is currently ' . $max_length_exceeded . ' characters long.'); $this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', [$recipients[0]]), '', TRUE); - $this->assertText(t('Contact form @label has been added.', ['@label' => $label])); + $this->assertText('Contact form ' . $label . ' has been added.'); // Verify that the creation message contains a link to a contact form. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]'); // Create first valid form. $this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0]]), '', TRUE); - $this->assertText(t('Contact form @label has been added.', ['@label' => $label])); + $this->assertText('Contact form ' . $label . ' has been added.'); // Verify that the creation message contains a link to a contact form. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "contact/")]'); @@ -199,7 +199,7 @@ public function testSiteWideContact() { $this->assertEqual($config['recipients'], [$recipients[0], $recipients[1]]); $this->assertEqual($config['reply'], $reply); $this->assertNotEqual($id, $this->config('contact.settings')->get('default_form')); - $this->assertText(t('Contact form @label has been updated.', ['@label' => $label])); + $this->assertText('Contact form ' . $label . ' has been updated.'); // Ensure the label is displayed on the contact page for this form. $this->drupalGet('contact/' . $id); $this->assertText($label); @@ -211,16 +211,16 @@ public function testSiteWideContact() { user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']); $this->drupalLogout(); $this->drupalGet('contact'); - $this->assertText(t('Your email address')); + $this->assertText('Your email address'); $this->assertNoText('Form'); $this->drupalLogin($admin_user); // Add more forms. $this->addContactForm(mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1]]), '', FALSE); - $this->assertText(t('Contact form @label has been added.', ['@label' => $label])); + $this->assertText('Contact form ' . $label . ' has been added.'); $this->addContactForm($name = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1], $recipients[2]]), '', FALSE); - $this->assertText(t('Contact form @label has been added.', ['@label' => $label])); + $this->assertText('Contact form ' . $label . ' has been added.'); // Try adding a form that already exists. $this->addContactForm($name, $label, '', '', FALSE); @@ -241,19 +241,19 @@ public function testSiteWideContact() { // Submit contact form with invalid values. $this->submitContact('', $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64)); - $this->assertText(t('Your name field is required.')); + $this->assertText('Your name field is required.'); $this->submitContact($this->randomMachineName(16), '', $this->randomMachineName(16), $id, $this->randomMachineName(64)); - $this->assertText(t('Your email address field is required.')); + $this->assertText('Your email address field is required.'); $this->submitContact($this->randomMachineName(16), $invalid_recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64)); $this->assertRaw(t('The email address %mail is not valid.', ['%mail' => 'invalid'])); $this->submitContact($this->randomMachineName(16), $recipients[0], '', $id, $this->randomMachineName(64)); - $this->assertText(t('Subject field is required.')); + $this->assertText('Subject field is required.'); $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, ''); - $this->assertText(t('Message field is required.')); + $this->assertText('Message field is required.'); // Test contact form with no default form selected. $this->config('contact.settings') @@ -271,7 +271,7 @@ public function testSiteWideContact() { // Submit contact form with correct values and check flood interval. for ($i = 0; $i < $flood_limit; $i++) { $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64)); - $this->assertText(t('Your message has been sent.')); + $this->assertText('Your message has been sent.'); } // Submit contact form one over limit. $this->submitContact($this->randomMachineName(16), $recipients[0], $this->randomMachineName(16), $id, $this->randomMachineName(64)); @@ -321,7 +321,7 @@ public function testSiteWideContact() { // Check preview field can be ordered. $this->drupalGet('admin/structure/contact/manage/' . $contact_form . '/form-display'); - $this->assertText(t('Preview')); + $this->assertText('Preview'); // Check that the field is displayed. $this->drupalGet('contact/' . $contact_form); diff --git a/core/modules/contact/tests/src/Functional/ContactStorageTest.php b/core/modules/contact/tests/src/Functional/ContactStorageTest.php index f237f62d04..03a188a1e7 100644 --- a/core/modules/contact/tests/src/Functional/ContactStorageTest.php +++ b/core/modules/contact/tests/src/Functional/ContactStorageTest.php @@ -54,16 +54,16 @@ public function testContactStorage() { $this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$mail]), '', TRUE, 'Your message has been sent.', [ 'send_a_pony' => 1, ]); - $this->assertText(t('Contact form @label has been added.', ['@label' => $label])); + $this->assertText('Contact form ' . $label . ' has been added.'); // Ensure that anonymous can submit site-wide contact form. user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access site-wide contact form']); $this->drupalLogout(); $this->drupalGet('contact'); - $this->assertText(t('Your email address')); + $this->assertText('Your email address'); $this->assertNoText('Form'); $this->submitContact($name = $this->randomMachineName(16), $mail, $subject = $this->randomMachineName(16), $id, $message = $this->randomMachineName(64)); - $this->assertText(t('Your message has been sent.')); + $this->assertText('Your message has been sent.'); $messages = Message::loadMultiple(); /** @var \Drupal\contact\Entity\Message $message */ diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php index f92dcc3d88..00566a8039 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php @@ -72,7 +72,7 @@ public function testTranslateModeratedContent() { 'moderation_state[0][state]' => 'published', ]; $this->drupalPostForm('node/add/article', $edit, t('Save')); - $this->assertText(t('Article Published English node has been created.')); + $this->assertText('Article Published English node has been created.'); $english_node = $this->drupalGetNodeByTitle('Published English node'); // Add a French translation. @@ -86,7 +86,7 @@ public function testTranslateModeratedContent() { // Here the error has occurred "The website encountered an unexpected error. // Please try again later." // If the translation has got lost. - $this->assertText(t('Article French node Draft has been updated.')); + $this->assertText('Article French node Draft has been updated.'); // Create an article in English. $edit = [ @@ -95,7 +95,7 @@ public function testTranslateModeratedContent() { 'moderation_state[0][state]' => 'draft', ]; $this->drupalPostForm('node/add/article', $edit, t('Save')); - $this->assertText(t('Article English node has been created.')); + $this->assertText('Article English node has been created.'); $english_node = $this->drupalGetNodeByTitle('English node'); // Add a French translation. @@ -106,7 +106,7 @@ public function testTranslateModeratedContent() { 'moderation_state[0][state]' => 'draft', ]; $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); - $this->assertText(t('Article French node has been updated.')); + $this->assertText('Article French node has been updated.'); $english_node = $this->drupalGetNodeByTitle('English node', TRUE); // Publish the English article and check that the translation stays @@ -114,7 +114,7 @@ public function testTranslateModeratedContent() { $this->drupalPostForm('node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', ], t('Save (this translation)')); - $this->assertText(t('Article English node has been updated.')); + $this->assertText('Article English node has been updated.'); $english_node = $this->drupalGetNodeByTitle('English node', TRUE); $french_node = $english_node->getTranslation('fr'); $this->assertEqual('French node', $french_node->label()); @@ -131,7 +131,7 @@ public function testTranslateModeratedContent() { 'moderation_state[0][state]' => 'draft', ]; $this->drupalPostForm('node/add/article', $edit, t('Save')); - $this->assertText(t('Article Another node has been created.')); + $this->assertText('Article Another node has been created.'); $english_node = $this->drupalGetNodeByTitle('Another node'); // Add a French translation. @@ -142,7 +142,7 @@ public function testTranslateModeratedContent() { 'moderation_state[0][state]' => 'draft', ]; $this->drupalPostForm(NULL, $edit, t('Save (this translation)')); - $this->assertText(t('Article Translated node has been updated.')); + $this->assertText('Article Translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); // Publish the translation and check that the source language version stays @@ -150,7 +150,7 @@ public function testTranslateModeratedContent() { $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', ], t('Save (this translation)')); - $this->assertText(t('Article Translated node has been updated.')); + $this->assertText('Article Translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); $this->assertEqual($french_node->moderation_state->value, 'published'); @@ -164,7 +164,7 @@ public function testTranslateModeratedContent() { 'moderation_state[0][state]' => 'draft', ]; $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', $edit, t('Save (this translation)')); - $this->assertText(t('Article New draft of translated node has been updated.')); + $this->assertText('Article New draft of translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); $this->assertEqual($french_node->moderation_state->value, 'published'); @@ -175,7 +175,7 @@ public function testTranslateModeratedContent() { $this->drupalPostForm('fr/node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', ], t('Save (this translation)')); - $this->assertText(t('Article New draft of translated node has been updated.')); + $this->assertText('Article New draft of translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); $this->assertEqual($french_node->moderation_state->value, 'published'); @@ -186,7 +186,7 @@ public function testTranslateModeratedContent() { $this->drupalPostForm('node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'published', ], t('Save (this translation)')); - $this->assertText(t('Article Another node has been updated.')); + $this->assertText('Article Another node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $this->assertEqual($english_node->moderation_state->value, 'published'); @@ -194,11 +194,11 @@ public function testTranslateModeratedContent() { $this->drupalPostForm('node/' . $english_node->id() . '/edit', [ 'moderation_state[0][state]' => 'archived', ], t('Save (this translation)')); - $this->assertText(t('Article Another node has been updated.')); + $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)')); - $this->assertText(t('Article New draft of translated node has been updated.')); + $this->assertText('Article New draft of translated node has been updated.'); $english_node = $this->drupalGetNodeByTitle('Another node', TRUE); $french_node = $english_node->getTranslation('fr'); $this->assertEqual($english_node->moderation_state->value, 'archived'); diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php index 5e97162576..2296f73be6 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php @@ -68,7 +68,7 @@ public function testCustomBlockModeration() { 'body[0][value]' => $body, ]; $this->drupalPostForm('block/add', $edit, t('Save')); - $this->assertText(t('basic Moderated block has been created.')); + $this->assertText('basic Moderated block has been created.'); // Place the block in the Sidebar First region. $instance = [ @@ -92,7 +92,7 @@ public function testCustomBlockModeration() { 'moderation_state[0][state]' => 'draft', ]; $this->drupalPostForm('block/' . $block->id(), $edit, t('Save')); - $this->assertText(t('basic Moderated block has been updated.')); + $this->assertText('basic Moderated block has been updated.'); // Navigate to the home page and check that the block shows the updated // content. It should show the updated content because the block's default @@ -112,7 +112,7 @@ public function testCustomBlockModeration() { 'moderation_state[0][state]' => 'draft', ]; $this->drupalPostForm('block/' . $block->id(), $edit, t('Save')); - $this->assertText(t('basic Moderated block has been updated.')); + $this->assertText('basic Moderated block has been updated.'); // Navigate to home page and check that the pending revision doesn't show, // since it should not be set as the default revision. @@ -124,7 +124,7 @@ public function testCustomBlockModeration() { 'new_state' => 'published', ]; $this->drupalPostForm('block/' . $block->id() . '/latest', $edit, t('Apply')); - $this->assertText(t('The moderation state has been updated.')); + $this->assertText('The moderation state has been updated.'); // Navigate to home page and check that the pending revision is now the // default revision and therefore visible. diff --git a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php index 0a6be5e685..8044b01a65 100644 --- a/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php +++ b/core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php @@ -57,7 +57,7 @@ public function testCreatingContent() { // Delete the node. $this->drupalPostForm('node/' . $node->id() . '/delete', [], t('Delete')); - $this->assertText(t('The Moderated content moderated content has been deleted.')); + $this->assertText('The Moderated content moderated content has been deleted.'); // Disable content moderation. $edit['bundles[moderated_content]'] = FALSE; diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php index bf9c41b939..ffd8a675aa 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php @@ -35,8 +35,8 @@ public function testEnable() { $this->drupalPostForm('admin/modules', $edit, t('Install')); // Status messages are shown. - $this->assertText(t('This site has only a single language enabled. Add at least one more language in order to translate content.')); - $this->assertText(t('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.')); + $this->assertText('This site has only a single language enabled. Add at least one more language in order to translate content.'); + $this->assertText('Enable translation for content types, taxonomy vocabularies, accounts, or any other element you wish to translate.'); // No pending updates should be available. $this->drupalGet('admin/reports/status'); diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php index 4ca06b5457..7d52170fde 100644 --- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php +++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php @@ -76,7 +76,7 @@ public function testDateField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertRaw($date->format($date_format)); $this->assertNoRaw($date->format($time_format)); @@ -271,7 +271,7 @@ public function testDatetimeField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertRaw($date->format($date_format)); $this->assertRaw($date->format($time_format)); @@ -491,7 +491,7 @@ public function testDatelistWidget() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected()); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected()); @@ -531,7 +531,7 @@ public function testDatelistWidget() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected()); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected()); @@ -568,7 +568,7 @@ public function testDatelistWidget() { $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertSession()->statusCodeEquals(200); foreach ($expected as $expected_text) { - $this->assertText(t($expected_text)); + $this->assertText($expected_text); } } @@ -585,7 +585,7 @@ public function testDatelistWidget() { $this->assertSession()->statusCodeEquals(200); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); // Test the widget to ensure zeros are not deselected on validation. $this->drupalGet('entity_test/add'); diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php index c4fc4af12b..b5cecdcb35 100644 --- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php +++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php @@ -92,7 +92,7 @@ public function testDateRangeField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertRaw($start_date->format($date_format)); $this->assertNoRaw($start_date->format($time_format)); $this->assertRaw($end_date->format($date_format)); @@ -218,7 +218,7 @@ public function testDateRangeField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->massageTestDate($start_date); @@ -325,7 +325,7 @@ public function testDatetimeRangeField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertRaw($start_date->format($date_format)); $this->assertRaw($start_date->format($time_format)); $this->assertRaw($end_date->format($date_format)); @@ -410,7 +410,7 @@ public function testDatetimeRangeField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->displayOptions = [ 'type' => 'daterange_default', @@ -498,7 +498,7 @@ public function testAlldayRangeField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertRaw($start_date->format($date_format)); $this->assertNoRaw($start_date->format($time_format)); $this->assertRaw($end_date->format($date_format)); @@ -582,7 +582,7 @@ public function testAlldayRangeField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->displayOptions = [ 'type' => 'daterange_default', @@ -770,7 +770,7 @@ public function testDatelistWidget() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected()); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected()); @@ -825,7 +825,7 @@ public function testDatelistWidget() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-year", '2012')->isSelected()); $this->assertTrue($this->assertSession()->optionExists("edit-$field_name-0-value-month", '12')->isSelected()); @@ -871,7 +871,7 @@ public function testDatelistWidget() { $this->drupalPostForm(NULL, $edit, t('Save')); $this->assertSession()->statusCodeEquals(200); foreach ($expected as $expected_text) { - $this->assertText(t($expected_text)); + $this->assertText($expected_text); } } @@ -892,7 +892,7 @@ public function testDatelistWidget() { $this->assertSession()->statusCodeEquals(200); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); // Test the widget to ensure zeros are not deselected on validation. $this->drupalGet('entity_test/add'); @@ -1201,7 +1201,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid start year value %date has been caught.', ['%date' => $date_value])); + $this->assertText('date is invalid', 'Invalid start year value ' . $date_value . ' has been caught.'); $date_value = '2012-75-01'; $edit = [ @@ -1211,7 +1211,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid start month value %date has been caught.', ['%date' => $date_value])); + $this->assertText('date is invalid', 'Invalid start month value ' . $date_value . ' has been caught.'); $date_value = '2012-12-99'; $edit = [ @@ -1221,7 +1221,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid start day value %date has been caught.', ['%date' => $date_value])); + $this->assertText('date is invalid', 'Invalid start day value ' . $date_value . ' has been caught.'); // Submit invalid start times and ensure they is not accepted. $time_value = ''; @@ -1242,7 +1242,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid start hour value %time has been caught.', ['%time' => $time_value])); + $this->assertText('date is invalid', 'Invalid start hour value ' . $time_value . ' has been caught.'); $time_value = '12:99:00'; $edit = [ @@ -1252,7 +1252,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid start minute value %time has been caught.', ['%time' => $time_value])); + $this->assertText('date is invalid', 'Invalid start minute value ' . $time_value . ' has been caught.'); $time_value = '12:15:99'; $edit = [ @@ -1262,7 +1262,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid start second value %time has been caught.', ['%time' => $time_value])); + $this->assertText('date is invalid', 'Invalid start second value ' . $time_value . ' has been caught.'); // Submit invalid end dates and ensure they is not accepted. $date_value = ''; @@ -1283,7 +1283,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '00:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid end year value %date has been caught.', ['%date' => $date_value])); + $this->assertText('date is invalid','Invalid end year value ' . $date_value . ' has been caught.'); $date_value = '2012-75-01'; $edit = [ @@ -1293,7 +1293,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '00:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid end month value %date has been caught.', ['%date' => $date_value])); + $this->assertText('date is invalid', 'Invalid end month value ' . $date_value . ' has been caught.'); $date_value = '2012-12-99'; $edit = [ @@ -1303,7 +1303,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '00:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid end day value %date has been caught.', ['%date' => $date_value])); + $this->assertText('date is invalid','Invalid end day value ' . $date_value . ' has been caught.'); // Submit invalid start times and ensure they is not accepted. $time_value = ''; @@ -1324,7 +1324,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => $time_value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid end hour value %time has been caught.', ['%time' => $time_value])); + $this->assertText('date is invalid', 'Invalid end hour value ' . $time_value . ' has been caught.'); $time_value = '12:99:00'; $edit = [ @@ -1334,7 +1334,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => $time_value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid end minute value %time has been caught.', ['%time' => $time_value])); + $this->assertText('date is invalid', 'Invalid end minute value ' . $time_value . ' has been caught.'); $time_value = '12:15:99'; $edit = [ @@ -1344,7 +1344,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => $time_value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText('date is invalid', new FormattableMarkup('Invalid end second value %time has been caught.', ['%time' => $time_value])); + $this->assertText('date is invalid','Invalid end second value ' . $time_value . ' has been caught.'); $edit = [ "{$field_name}[0][value][date]" => '2012-12-01', @@ -1353,7 +1353,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End date before start date has been caught.'); + $this->assertText('The ' . $field_label . ' end date cannot be before the start date', 'End date before start date has been caught.'); $edit = [ "{$field_name}[0][value][date]" => '2012-12-01', @@ -1362,7 +1362,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '11:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End time before start time has been caught.'); + $this->assertText('The ' . $field_label . ' end date cannot be before the start date', 'End time before start time has been caught.'); } /** diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index 7e3a511f71..defc24fcb8 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -300,20 +300,20 @@ private function verifyReports($response = 200) { $this->drupalGet('admin/help/dblog'); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Database Logging'), 'DBLog help was displayed'); + $this->assertText('Database Logging', 'DBLog help was displayed'); } // View the database log report page. $this->drupalGet('admin/reports/dblog'); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Recent log messages'), 'DBLog report was displayed'); + $this->assertText('Recent log messages', 'DBLog report was displayed'); } $this->drupalGet('admin/reports/dblog/confirm'); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Are you sure you want to delete the recent logs?'), 'DBLog clear logs form was displayed'); + $this->assertText('Are you sure you want to delete the recent logs?', 'DBLog clear logs form was displayed'); } // View the database log page-not-found report page. @@ -337,7 +337,7 @@ private function verifyReports($response = 200) { $this->drupalGet('admin/reports/dblog/event/' . $wid); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Details'), 'DBLog event node was displayed'); + $this->assertText('Details', 'DBLog event node was displayed'); } } @@ -382,7 +382,7 @@ private function verifyEvents() { public function verifySort($sort = 'asc', $order = 'Date') { $this->drupalGet('admin/reports/dblog', ['query' => ['sort' => $sort, 'order' => $order]]); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Recent log messages'), 'DBLog report was displayed correctly and sorting went fine.'); + $this->assertText('Recent log messages', 'DBLog report was displayed correctly and sorting went fine.'); } /** @@ -696,13 +696,13 @@ public function testFilter() { $this->drupalGet('admin/reports/dblog', ['query' => ['order' => 'Type']]); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Operations'), 'Operations text found'); + $this->assertText('Operations', 'Operations text found'); // Clear all logs and make sure the confirmation message is found. $this->clearLogsEntries(); // Confirm that the logs should be cleared. $this->drupalPostForm(NULL, [], 'Confirm'); - $this->assertText(t('Database log cleared.'), 'Confirmation message found'); + $this->assertText('Database log cleared.', 'Confirmation message found'); } /** diff --git a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php index d2c4f123d0..c3b00e830f 100644 --- a/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php +++ b/core/modules/field/tests/src/Functional/Boolean/BooleanFieldTest.php @@ -117,7 +117,7 @@ public function testBooleanField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); // Verify that boolean value is displayed. $entity = EntityTest::load($id); @@ -236,7 +236,7 @@ public function testFormAccess() { $this->drupalPostForm(NULL, [], t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); // Tell the test module to disable access to the field. \Drupal::state()->set('field.test_boolean_field_access_field', $field_name); @@ -247,7 +247,7 @@ public function testFormAccess() { $this->drupalPostForm(NULL, [], t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $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 bf915a91be..1a92eb0883 100644 --- a/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php +++ b/core/modules/field/tests/src/Functional/Email/EmailFieldTest.php @@ -100,7 +100,7 @@ public function testEmailField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertRaw($value); // Verify that a mailto link is displayed. diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php index 1ab2db16b7..059ab4fb27 100644 --- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php +++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php @@ -172,7 +172,7 @@ public function testFieldAdminHandler() { $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save')); // Assert that entity reference autocomplete field is validated. - $this->assertText(t('There are no entities matching "@entity"', ['@entity' => 'Test'])); + $this->assertText('There are no entities matching "Test"'); $edit = [ 'title[0][value]' => 'Test', @@ -182,10 +182,10 @@ public function testFieldAdminHandler() { // Assert the results multiple times to avoid sorting problem of nodes with // the same title. - $this->assertText(t('Multiple entities match this reference;')); - $this->assertText(t("@node1", ['@node1' => $node1->getTitle() . ' (' . $node1->id() . ')'])); - $this->assertText(t("@node2", ['@node2' => $node2->getTitle() . ' (' . $node2->id() . ')'])); - $this->assertText(t('Specify the one you want by appending the id in parentheses, like "@example".', ['@example' => $node2->getTitle() . ' (' . $node2->id() . ')'])); + $this->assertText('Multiple entities match this reference;'); + $this->assertText($node1->getTitle() . ' (' . $node1->id() . ')'); + $this->assertText($node2->getTitle() . ' (' . $node2->id() . ')'); + $this->assertText('Specify the one you want by appending the id in parentheses, like "' . $node2->getTitle() . ' (' . $node2->id() . ')' . '".'); $edit = [ 'title[0][value]' => 'Test', diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index 133eff05fb..394a85610c 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -149,7 +149,7 @@ public function testFieldFormSingle() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); $entity = EntityTest::load($id); $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved'); @@ -166,7 +166,7 @@ public function testFieldFormSingle() { "{$field_name}[0][value]" => $value, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated'); + $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); $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated'); @@ -177,7 +177,7 @@ public function testFieldFormSingle() { "{$field_name}[0][value]" => $value, ]; $this->drupalPostForm('entity_test/manage/' . $id . '/edit', $edit, t('Save')); - $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated'); + $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); $this->assertTrue($entity->{$field_name}->isEmpty(), 'Field was emptied'); @@ -211,7 +211,7 @@ public function testFieldFormDefaultValue() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created.'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created.'); $entity = EntityTest::load($id); $this->assertTrue($entity->{$field_name}->isEmpty(), 'Field is now empty.'); } @@ -241,7 +241,7 @@ public function testFieldFormSingleRequired() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); $entity = EntityTest::load($id); $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was saved'); @@ -327,7 +327,7 @@ public function testFieldFormUnlimited() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); $entity = EntityTest::load($id); ksort($field_values); $field_values = array_values($field_values); @@ -601,7 +601,7 @@ public function testHiddenField() { $this->drupalPostForm(NULL, [], t('Save')); preg_match('|' . $entity_type . '/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test_rev @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test_rev ' . $id . ' has been created.', 'Entity was created'); $storage = $this->container->get('entity_type.manager') ->getStorage($entity_type); @@ -627,7 +627,7 @@ public function testHiddenField() { $value = mt_rand(1, 127); $edit = ["{$field_name}[0][value]" => $value]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('entity_test_rev @id has been updated.', ['@id' => $id]), 'Entity was updated'); + $this->assertText('entity_test_rev ' . $id . ' has been updated.', 'Entity was updated'); $storage->resetCache([$id]); $entity = $storage->load($id); $this->assertEqual($entity->{$field_name}->value, $value, 'Field value was updated'); diff --git a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php index 9cbe7c00f6..8ec8509acf 100644 --- a/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php +++ b/core/modules/field/tests/src/Functional/Number/NumberFieldTest.php @@ -86,7 +86,7 @@ public function testNumberDecimalField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test' . $id . 'has been created.', 'Entity was created'); $this->assertRaw($value); // Try to create entries with more than one decimal separator; assert fail. @@ -201,7 +201,7 @@ public function testNumberIntegerField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); // Try to set a value below the minimum value $this->drupalGet('entity_test/add'); @@ -250,7 +250,7 @@ public function testNumberIntegerField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); $this->assertRaw($valid_entry); $this->assertNoFieldByXpath('//div[@content="' . $valid_entry . '"]', NULL, 'The "content" attribute is not present since the Prefix is not being displayed'); } @@ -272,7 +272,7 @@ public function testNumberIntegerField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); $this->drupalGet('entity_test/' . $id); $this->assertFieldByXPath('//div[@content="' . $integer_value . '"]', 'ThePrefix' . $integer_value, 'The "content" attribute has been set to the value of the field, and the prefix is being displayed.'); } @@ -326,7 +326,7 @@ public function testNumberFloatField() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); // Ensure that the 'number_decimal' formatter displays the number with the // expected rounding. diff --git a/core/modules/field/tests/src/Functional/String/StringFieldTest.php b/core/modules/field/tests/src/Functional/String/StringFieldTest.php index 8bc4a972a8..c8e66c0d1f 100644 --- a/core/modules/field/tests/src/Functional/String/StringFieldTest.php +++ b/core/modules/field/tests/src/Functional/String/StringFieldTest.php @@ -102,7 +102,7 @@ public function _testTextfieldWidgets($field_type, $widget_type) { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); // Display the entity. $entity = EntityTest::load($id); diff --git a/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php b/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php index f949ec3442..bdf411905f 100644 --- a/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php +++ b/core/modules/field_ui/tests/src/Functional/EntityDisplayModeTest.php @@ -52,7 +52,7 @@ public function testEntityViewModeUI() { $this->drupalLogin($this->drupalCreateUser(['administer display modes'])); $this->drupalGet('admin/structure/display-modes/view'); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Add view mode')); + $this->assertText('Add view mode'); $this->assertSession()->linkByHrefExists('admin/structure/display-modes/view/add'); $this->assertSession()->linkByHrefExists('admin/structure/display-modes/view/add/entity_test'); @@ -107,7 +107,7 @@ public function testEntityFormModeUI() { $this->drupalLogin($this->drupalCreateUser(['administer display modes'])); $this->drupalGet('admin/structure/display-modes/form'); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Add form mode')); + $this->assertText('Add form mode'); $this->assertSession()->linkByHrefExists('admin/structure/display-modes/form/add'); $this->drupalGet('admin/structure/display-modes/form/add/entity_test_no_label'); diff --git a/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php b/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php index 5ed414d281..66e17df762 100644 --- a/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php +++ b/core/modules/field_ui/tests/src/Functional/FieldUIDeleteTest.php @@ -121,8 +121,8 @@ public function testDeleteField() { // Check the config dependencies of the first field. $this->drupalGet("$bundle_path2/fields/node.$type_name2.$field_name/delete"); - $this->assertText(t('The listed configuration will be updated.')); - $this->assertText(t('View')); + $this->assertText('The listed configuration will be updated.'); + $this->assertText('View'); $this->assertText('test_view_field_delete'); $xml = $this->cssSelect('#edit-entity-deletes'); diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php index 4f8eeafef2..b7dea55e1d 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php @@ -233,7 +233,7 @@ public function updateField() { $edit = [ 'settings[test_field_setting]' => $string, ]; - $this->assertText(t('Default value'), 'Default value heading is shown'); + $this->assertText('Default value', 'Default value heading is shown'); $this->drupalPostForm(NULL, $edit, t('Save settings')); // Assert the field settings are correct. @@ -426,7 +426,7 @@ public function testFieldPrefix() { // Create a valid field. $this->fieldUIAddNewField('admin/structure/types/manage/' . $this->contentType, $this->fieldNameInput, $this->fieldLabel); $this->drupalGet('admin/structure/types/manage/' . $this->contentType . '/fields/node.' . $this->contentType . '.' . $field_prefix . $this->fieldNameInput); - $this->assertText(new FormattableMarkup('@label settings for @type', ['@label' => $this->fieldLabel, '@type' => $this->contentType])); + $this->assertText($this->fieldLabel . ' settings for ' . $this->contentType); } /** @@ -560,13 +560,13 @@ public function testDisallowedFieldNames() { $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->assertText(t('The machine-readable name is already in use. It must be unique.')); + $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->assertText(t('The machine-readable name is already in use. It must be unique.')); + $this->assertText('The machine-readable name is already in use. It must be unique.'); } /** @@ -669,7 +669,7 @@ public function testDuplicateFieldName() { $url = 'admin/structure/types/manage/' . $this->contentType . '/fields/add-field'; $this->drupalPostForm($url, $edit, t('Save and continue')); - $this->assertText(t('The machine-readable name is already in use. It must be unique.')); + $this->assertText('The machine-readable name is already in use. It must be unique.'); $this->assertSession()->addressEquals($url); } diff --git a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php index 79684571c4..c9a91b3e36 100644 --- a/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php +++ b/core/modules/file/tests/src/Functional/FileFieldDisplayTest.php @@ -183,7 +183,7 @@ public function testDescToggle() { $this->drupalPostForm('node/add/' . $type_name, $edit, t('Save')); $node = $this->drupalGetNodeByTitle($title); $this->drupalGet('node/' . $node->id() . '/edit'); - $this->assertText(t('The description may be used as the label of the link to the file.')); + $this->assertText('The description may be used as the label of the link to the file.'); } /** diff --git a/core/modules/filter/tests/src/Functional/FilterAdminTest.php b/core/modules/filter/tests/src/Functional/FilterAdminTest.php index 2ad64a18c6..361fb051b8 100644 --- a/core/modules/filter/tests/src/Functional/FilterAdminTest.php +++ b/core/modules/filter/tests/src/Functional/FilterAdminTest.php @@ -302,7 +302,7 @@ public function testFilterAdmin() { $edit['body[0][value]'] = $text; $edit['body[0][format]'] = $basic; $this->drupalPostForm('node/add/page', $edit, t('Save')); - $this->assertText(t('Basic page @title has been created.', ['@title' => $edit['title[0][value]']]), 'Filtered node created.'); + $this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.', 'Filtered node created.'); // Verify that the creation message contains a link to a node. $view_link = $this->xpath('//div[contains(@class, "messages")]//a[contains(@href, :href)]', [':href' => 'node/']); diff --git a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php index 1d23e945e0..492ed5c58f 100644 --- a/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php +++ b/core/modules/filter/tests/src/Functional/FilterFormatAccessTest.php @@ -283,7 +283,7 @@ public function testFormatWidgetPermissions() { $edit = []; $edit['title[0][value]'] = $new_title; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); - $this->assertText(t('@name field is required.', ['@name' => t('Text format')]), 'Error message is displayed.'); + $this->assertText('Text format field is required.', 'Error message is displayed.'); $this->drupalGet('node/' . $node->id()); $this->assertText($old_title, 'Old title found.'); $this->assertNoText($new_title, 'New title not found.'); @@ -318,7 +318,7 @@ public function testFormatWidgetPermissions() { $edit = []; $edit['title[0][value]'] = $new_title; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); - $this->assertText(t('@name field is required.', ['@name' => t('Text format')]), 'Error message is displayed.'); + $this->assertText('Text format field is required.', 'Error message is displayed.'); $this->drupalGet('node/' . $node->id()); $this->assertText($old_title, 'Old title found.'); $this->assertNoText($new_title, 'New title not found.'); diff --git a/core/modules/filter/tests/src/Functional/FilterHooksTest.php b/core/modules/filter/tests/src/Functional/FilterHooksTest.php index 665a0da197..091186c3cb 100644 --- a/core/modules/filter/tests/src/Functional/FilterHooksTest.php +++ b/core/modules/filter/tests/src/Functional/FilterHooksTest.php @@ -69,7 +69,7 @@ public function testFilterHooks() { $edit['body[0][value]'] = $this->randomMachineName(32); $edit['body[0][format]'] = $format_id; $this->drupalPostForm("node/add/{$type->id()}", $edit, t('Save')); - $this->assertText(t('@type @title has been created.', ['@type' => $type_name, '@title' => $title])); + $this->assertText($type_name . ' ' . $title . ' has been created.'); // Disable the text format. $this->drupalPostForm('admin/config/content/formats/manage/' . $format_id . '/disable', [], t('Disable')); diff --git a/core/modules/forum/tests/src/Functional/ForumIndexTest.php b/core/modules/forum/tests/src/Functional/ForumIndexTest.php index 98a0d69bc6..651b2b881f 100644 --- a/core/modules/forum/tests/src/Functional/ForumIndexTest.php +++ b/core/modules/forum/tests/src/Functional/ForumIndexTest.php @@ -86,7 +86,7 @@ public function testForumIndexStatus() { $edit = ['status[value]' => FALSE]; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); $this->drupalGet('node/' . $node->id()); - $this->assertText(t('Access denied'), 'Unpublished node is no longer accessible.'); + $this->assertText('Access denied', 'Unpublished node is no longer accessible.'); // Verify that the node no longer appears on the index. $this->drupalGet('forum/' . $tid); diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php index 81794aa6e3..e766f5c6e3 100644 --- a/core/modules/forum/tests/src/Functional/ForumTest.php +++ b/core/modules/forum/tests/src/Functional/ForumTest.php @@ -171,7 +171,7 @@ public function testForum() { $this->drupalLogin($this->webUser); // Verify that this user is shown a message that they may not post content. $this->drupalGet('forum/' . $this->forum['tid']); - $this->assertText(t('You are not allowed to post new content in the forum'), "Authenticated user without permission to post forum content is shown message in local tasks to that effect."); + $this->assertText('You are not allowed to post new content in the forum', "Authenticated user without permission to post forum content is shown message in local tasks to that effect."); // Log in, and do basic tests for a user with permission to edit any forum // content. @@ -321,7 +321,7 @@ private function doAdminTests($user) { // Verify "edit container" link exists and functions correctly. $this->drupalGet('admin/structure/forum'); // Verify help text is shown. - $this->assertText(t('Forums contain forum topics. Use containers to group related forums')); + $this->assertText('Forums contain forum topics. Use containers to group related forums'); // Verify action links are there. $this->assertSession()->linkExists('Add forum'); $this->assertSession()->linkExists('Add container'); @@ -585,7 +585,7 @@ public function createForumTopic($forum, $container = FALSE) { return; } else { - $this->assertText(t('@type @title has been created.', ['@type' => $type, '@title' => $title]), 'Forum topic was created'); + $this->assertText($type . ' ' . $title . ' has been created.', 'Forum topic was created'); $this->assertNoRaw(t('The item %title is a forum container, not a forum.', ['%title' => $forum['name']])); // Verify that the creation message contains a link to a node. @@ -623,7 +623,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { $this->assertSession()->statusCodeEquals($response2); if ($response2 == 200) { $this->assertSession()->titleEquals('Forum | Drupal'); - $this->assertText(t('Forum'), 'Forum help node was displayed'); + $this->assertText('Forum', 'Forum help node was displayed'); } // View forum container page. @@ -665,7 +665,7 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { $edit['taxonomy_forums'] = $this->rootForum['tid']; $edit['shadow'] = TRUE; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); - $this->assertText(t('Forum topic @title has been updated.', ['@title' => $edit['title[0][value]']]), 'Forum node was edited'); + $this->assertText('Forum topic ' . $edit['title[0][value]'] . ' has been updated.', 'Forum node was edited'); // Verify topic was moved to a different forum. $forum_tid = $this->container diff --git a/core/modules/help/tests/src/Functional/HelpBlockTest.php b/core/modules/help/tests/src/Functional/HelpBlockTest.php index cc4b750a7f..fa2d9c33c9 100644 --- a/core/modules/help/tests/src/Functional/HelpBlockTest.php +++ b/core/modules/help/tests/src/Functional/HelpBlockTest.php @@ -43,7 +43,7 @@ protected function setUp(): void { */ public function testHelp() { $this->drupalGet('help_page_test/has_help'); - $this->assertText(t('I have help!')); + $this->assertText('I have help!'); $this->assertText($this->helpBlock->label()); $this->drupalGet('help_page_test/no_help'); diff --git a/core/modules/help/tests/src/Functional/HelpTest.php b/core/modules/help/tests/src/Functional/HelpTest.php index 541211c876..3cc9beeaf4 100644 --- a/core/modules/help/tests/src/Functional/HelpTest.php +++ b/core/modules/help/tests/src/Functional/HelpTest.php @@ -82,7 +82,7 @@ public function testHelp() { // Verify that an empty section is handled correctly. $this->assertRaw('

' . t('Empty section') . '

'); $this->assertRaw('

' . t('This description should appear.') . '

'); - $this->assertText(t('There is currently nothing in this section.')); + $this->assertText('There is currently nothing in this section.'); // Make sure links are properly added for modules implementing hook_help(). foreach ($this->getModuleList() as $module => $name) { @@ -136,7 +136,7 @@ protected function verifyHelp($response = 200) { $info = \Drupal::service('extension.list.module')->getExtensionInfo($module); $admin_tasks = system_get_module_admin_tasks($module, $info); if (!empty($admin_tasks)) { - $this->assertText(t('@module administration pages', ['@module' => $name])); + $this->assertText($name . ' administration pages'); } foreach ($admin_tasks as $task) { $this->assertSession()->linkExists($task['title']); diff --git a/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php b/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php index 958a9317cc..725c3fa928 100644 --- a/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php +++ b/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php @@ -249,7 +249,7 @@ public function testUninstall() { $edit['uninstall[help_topics]'] = TRUE; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + $this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.'); $this->drupalGet('admin/help'); $this->assertSession()->statusCodeEquals(200); } diff --git a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php index 8d1e4ef792..612351ec2f 100644 --- a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php +++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php @@ -348,7 +348,7 @@ public function testStyleReplacement() { 'label' => $new_style_label, ]; $this->drupalPostForm($style_path . $style_name, $edit, t('Save')); - $this->assertText(t('Changes to the style have been saved.'), new FormattableMarkup('Style %name was renamed to %new_name.', ['%name' => $style_name, '%new_name' => $new_style_name])); + $this->assertText('Changes to the style have been saved.', new FormattableMarkup('Style %name was renamed to %new_name.', ['%name' => $style_name, '%new_name' => $new_style_name])); $this->drupalGet('node/' . $nid); // Reload the image style using the new name. @@ -378,12 +378,12 @@ public function testEditEffect() { $this->drupalPostForm(NULL, ['label' => 'Test style effect edit', 'name' => $style_name], t('Create new style')); $this->drupalPostForm(NULL, ['new' => 'image_scale_and_crop'], t('Add')); $this->drupalPostForm(NULL, ['data[width]' => '300', 'data[height]' => '200'], t('Add effect')); - $this->assertText(t('Scale and crop 300×200')); + $this->assertText('Scale and crop 300×200'); // There should normally be only one edit link on this page initially. $this->clickLink(t('Edit')); $this->drupalPostForm(NULL, ['data[width]' => '360', 'data[height]' => '240'], t('Update effect')); - $this->assertText(t('Scale and crop 360×240')); + $this->assertText('Scale and crop 360×240'); // Check that the previous effect is replaced. $this->assertNoText('Scale and crop 300×200'); @@ -412,8 +412,8 @@ public function testEditEffect() { } $this->drupalPostForm(NULL, ['new' => 'image_scale'], t('Add')); $this->drupalPostForm(NULL, ['data[width]' => '12', 'data[height]' => '19'], t('Add effect')); - $this->assertText(t('Scale 24×19')); - $this->assertText(t('Scale 12×19')); + $this->assertText('Scale 24×19'); + $this->assertText('Scale 12×19'); // Try to edit a nonexistent effect. $uuid = $this->container->get('uuid'); diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php index b80d18e9bc..b2c47928ef 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -263,9 +263,9 @@ public function testImageFieldSettings() { $this->assertSession()->fieldValueEquals('settings[min_resolution][y]', '10'); $this->drupalGet('node/add/article'); - $this->assertText(t('50 KB limit.'), 'Image widget max file size is displayed on article form.'); - $this->assertText(t('Allowed types: @extensions.', ['@extensions' => $test_image_extension]), 'Image widget allowed file types displayed on article form.'); - $this->assertText(t('Images must be larger than 10x10 pixels. Images larger than 100x100 pixels will be resized.'), 'Image widget allowed resolution displayed on article form.'); + $this->assertText('50 KB limit.', 'Image widget max file size is displayed on article form.'); + $this->assertText('Allowed types: ' . $test_image_extension . '.', 'Image widget allowed file types displayed on article form.'); + $this->assertText('Images must be larger than 10x10 pixels. Images larger than 100x100 pixels will be resized.', 'Image widget allowed resolution displayed on article form.'); // We have to create the article first and then edit it because the alt // and title fields do not display until the image has been attached. diff --git a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php index 1a504ebe52..9a85e402c4 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldValidateTest.php @@ -148,15 +148,15 @@ public function testResolution() { '%height' => $image_that_is_too_small_file->getHeight(), ])); $this->uploadNodeImage($image_that_is_too_big, $field_names[0], 'article'); - $this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.')); + $this->assertText('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'); $this->uploadNodeImage($image_that_is_too_small, $field_names[1], 'article'); $this->assertRaw(t('The specified file %name could not be uploaded.', ['%name' => $image_that_is_too_small->filename])); $this->uploadNodeImage($image_that_is_too_big, $field_names[1], 'article'); - $this->assertText(t('The image was resized to fit within the maximum allowed width of 100 pixels.')); + $this->assertText('The image was resized to fit within the maximum allowed width of 100 pixels.'); $this->uploadNodeImage($image_that_is_too_small, $field_names[2], 'article'); $this->assertRaw(t('The specified file %name could not be uploaded.', ['%name' => $image_that_is_too_small->filename])); $this->uploadNodeImage($image_that_is_too_big, $field_names[2], 'article'); - $this->assertText(t('The image was resized to fit within the maximum allowed height of 100 pixels.')); + $this->assertText('The image was resized to fit within the maximum allowed height of 100 pixels.'); } /** @@ -186,8 +186,8 @@ public function testRequiredAttributes() { $this->assertTrue(isset($elements[0]), 'Required marker is shown for the required title text.'); - $this->assertText(t('Alternative text field is required.')); - $this->assertText(t('Title field is required.')); + $this->assertText('Alternative text field is required.'); + $this->assertText('Title field is required.'); $instance->setSetting('alt_field_required', 0); $instance->setSetting('title_field_required', 0); diff --git a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php index 87b51b60f9..15c563989c 100644 --- a/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php +++ b/core/modules/language/tests/src/Functional/LanguageBrowserDetectionTest.php @@ -83,7 +83,7 @@ public function testUIBrowserLanguageMappings() { 'mappings[xx][drupal_langcode]' => 'en', ]; $this->drupalPostForm('admin/config/regional/language/detection/browser', $edit, t('Save configuration')); - $this->assertText(t('Browser language codes must be unique.')); + $this->assertText('Browser language codes must be unique.'); // Change Drupal language code of our custom mapping to zh-hans. $edit = [ diff --git a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php index c0f417a350..5429d57849 100644 --- a/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageConfigurationTest.php @@ -111,14 +111,14 @@ public function testLanguageConfiguration() { 'prefix[en]' => '', ]; $this->drupalPostForm(NULL, $edit, t('Save configuration')); - $this->assertText(t('The prefix may only be left blank for the selected detection fallback language.')); + $this->assertText('The prefix may only be left blank for the selected detection fallback language.'); // Check that prefix cannot be changed to contain a slash. $edit = [ 'prefix[en]' => 'foo/bar', ]; $this->drupalPostForm(NULL, $edit, t('Save configuration')); - $this->assertText(t('The prefix may not contain a slash.'), 'English prefix cannot be changed to contain a slash.'); + $this->assertText('The prefix may not contain a slash.', 'English prefix cannot be changed to contain a slash.'); // Remove English language and add a new Language to check if langcode of // Language entity is 'en'. diff --git a/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php index 355f91f9c9..b11815ca43 100644 --- a/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageCustomLanguageConfigurationTest.php @@ -44,8 +44,8 @@ public function testLanguageConfiguration() { ]; $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); // Test validation on missing values. - $this->assertText(t('@name field is required.', ['@name' => t('Language code')])); - $this->assertText(t('@name field is required.', ['@name' => t('Language name')])); + $this->assertText('Language code field is required.'); + $this->assertText('Language name field is required.'); $empty_language = new Language(); $this->assertSession()->checkboxChecked('edit-direction-' . $empty_language->getDirection()); $this->assertSession()->addressEquals(Url::fromRoute('language.add')); diff --git a/core/modules/language/tests/src/Functional/LanguageListTest.php b/core/modules/language/tests/src/Functional/LanguageListTest.php index 4449d5fd32..87d31a16ea 100644 --- a/core/modules/language/tests/src/Functional/LanguageListTest.php +++ b/core/modules/language/tests/src/Functional/LanguageListTest.php @@ -71,7 +71,7 @@ public function testLanguageList() { $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); $this->assertSession()->addressEquals(Url::fromRoute('entity.configurable_language.collection')); $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); - $this->assertText(t($name), 'Test language added.'); + $this->assertText($name, 'Test language added.'); $language = \Drupal::service('language_manager')->getLanguage($langcode); $english = \Drupal::service('language_manager')->getLanguage('en'); @@ -115,7 +115,7 @@ public function testLanguageList() { // Ensure 'delete' link works. $this->drupalGet('admin/config/regional/language'); $this->clickLink(t('Delete')); - $this->assertText(t('Are you sure you want to delete the language'), '"Delete" link is correct.'); + $this->assertText('Are you sure you want to delete the language', '"Delete" link is correct.'); // Delete a language. $this->drupalGet('admin/config/regional/language/delete/' . $langcode); // First test the 'cancel' link. @@ -199,7 +199,7 @@ public function testLanguageList() { $language_storage->load('nl')->delete(); $this->drupalPostForm(NULL, ['site_default_language' => 'nl'], 'Save configuration'); - $this->assertText(t('Selected default language no longer exists.')); + $this->assertText('Selected default language no longer exists.'); $this->assertSession()->checkboxNotChecked('edit-site-default-language-xx'); } diff --git a/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php b/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php index e37b892c0a..405ef7ed9a 100644 --- a/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php +++ b/core/modules/language/tests/src/Functional/LanguagePathMonolingualTest.php @@ -76,7 +76,7 @@ public function testPageLinks() { // Verify that links in this page can be followed and work. $this->clickLink(t('Languages')); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Add language'), 'Page contains the add language text'); + $this->assertText('Add language', 'Page contains the add language text'); } } diff --git a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php index 0ce02a5dc9..9ae12f3d76 100644 --- a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php +++ b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php @@ -203,7 +203,7 @@ public function testLanguageBlockWithDomain() { 'domain[en]' => '', ]; $this->drupalPostForm('admin/config/regional/language/detection/url', $edit, t('Save configuration')); - $this->assertText(t('The domain may not be left blank for English'), 'The form does not allow blank domains.'); + $this->assertText('The domain may not be left blank for English', 'The form does not allow blank domains.'); // Change the domain for the Italian language. $edit = [ @@ -212,7 +212,7 @@ public function testLanguageBlockWithDomain() { 'domain[it]' => 'it.example.com', ]; $this->drupalPostForm('admin/config/regional/language/detection/url', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved'), 'Domain configuration is saved.'); + $this->assertText('The configuration options have been saved', 'Domain configuration is saved.'); // Enable the language switcher block. $this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, ['id' => 'test_language_block']); diff --git a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php index 742bf16750..f90abf91cd 100644 --- a/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php @@ -410,7 +410,7 @@ protected function doRunTest($test) { $this->container->get('language_manager')->reset(); $this->drupalGet($test['path'], $test['path_options'], $test['http_header']); $this->assertText($test['expect'], $test['message']); - $this->assertText(t('Language negotiation method: @name', ['@name' => $test['expected_method_id']])); + $this->assertText('Language negotiation method: ' . $test['expected_method_id']); // Get the private file and ensure it is a 200. It is important to // invalidate the router cache to ensure the routing system runs a full diff --git a/core/modules/link/tests/src/Functional/LinkFieldTest.php b/core/modules/link/tests/src/Functional/LinkFieldTest.php index 07a5acbe65..9817d2b998 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldTest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldTest.php @@ -220,7 +220,7 @@ protected function assertValidEntries($field_name, array $valid_entries) { $this->drupalPostForm('entity_test/add', $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $this->assertRaw('"' . $string . '"'); } } @@ -310,7 +310,7 @@ public function testLinkTitle() { "{$field_name}[0][title]" => 'Example', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('The URL field is required when the @title field is specified.', ['@title' => t('Link text')])); + $this->assertText('The URL field is required when the Link text field is specified.'); } if ($title_setting === DRUPAL_REQUIRED) { // Verify that the link text is required, if the URL is non-empty. @@ -318,7 +318,7 @@ public function testLinkTitle() { "{$field_name}[0][uri]" => 'http://www.example.com', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('@title field is required if there is @uri input.', ['@title' => t('Link text'), '@uri' => t('URL')])); + $this->assertText('Link text field is required if there is URL input.'); // Verify that the link text is not required, if the URL is empty. $edit = [ @@ -348,7 +348,7 @@ public function testLinkTitle() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); $output = $this->renderTestEntity($id); $expected_link = (string) Link::fromTextAndUrl($value, Url::fromUri($value))->toString(); @@ -360,7 +360,7 @@ public function testLinkTitle() { "{$field_name}[0][title]" => $title, ]; $this->drupalPostForm("entity_test/manage/$id/edit", $edit, t('Save')); - $this->assertText(t('entity_test @id has been updated.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been updated.'); $output = $this->renderTestEntity($id); $expected_link = (string) Link::fromTextAndUrl($title, Url::fromUri($value))->toString(); @@ -432,7 +432,7 @@ public function testLinkFormatter() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); // Verify that the link is output according to the formatter settings. // Not using generatePermutations(), since that leads to 32 cases, which @@ -583,7 +583,7 @@ public function testLinkSeparateFormatter() { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertText('entity_test ' . $id . ' has been created.'); // Verify that the link is output according to the formatter settings. $options = [ diff --git a/core/modules/link/tests/src/Functional/LinkFieldUITest.php b/core/modules/link/tests/src/Functional/LinkFieldUITest.php index a946a7321f..f458284830 100644 --- a/core/modules/link/tests/src/Functional/LinkFieldUITest.php +++ b/core/modules/link/tests/src/Functional/LinkFieldUITest.php @@ -173,7 +173,7 @@ public function runFieldUIItem($cardinality, $link_type, $title, $label, $field_ // generate warnings. // @todo Mess with the formatter settings a bit here. $this->drupalGet("$type_path/display"); - $this->assertText(t('Link text trimmed to @limit characters', ['@limit' => 80])); + $this->assertText('Link text trimmed to 80 characters'); $storage = FieldStorageConfig::create([ 'field_name' => $field_name, diff --git a/core/modules/locale/tests/src/Functional/LocaleContentTest.php b/core/modules/locale/tests/src/Functional/LocaleContentTest.php index 1aa2219439..ed69da0191 100644 --- a/core/modules/locale/tests/src/Functional/LocaleContentTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleContentTest.php @@ -96,7 +96,7 @@ public function testContentTypeLanguageConfiguration() { // Set the content type to use multilingual support. $this->drupalGet("admin/structure/types/manage/{$type2->id()}"); - $this->assertText(t('Language settings'), 'Multilingual support widget present on content type configuration form.'); + $this->assertText('Language settings', 'Multilingual support widget present on content type configuration form.'); $edit = [ 'language_configuration[language_alterable]' => TRUE, ]; @@ -137,7 +137,7 @@ public function testContentTypeLanguageConfiguration() { 'langcode[0][value]' => 'en', ]; $this->drupalPostForm($path, $edit, t('Save')); - $this->assertText(t('@title has been updated.', ['@title' => $node_title])); + $this->assertText($node_title . ' has been updated.'); // Verify that the creation message contains a link to a node. $xpath = $this->assertSession()->buildXPathQuery('//div[@data-drupal-messages]//a[contains(@href, :href)]', [ diff --git a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php index 544ce7dfdb..de6ea989ab 100644 --- a/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php @@ -147,7 +147,7 @@ public function testStandalonePoFile() { 'files[file]' => $name, ], t('Import')); $this->assertSession()->addressEquals(Url::fromRoute('locale.translate_import')); - $this->assertText(t('File to import not found.'), 'File to import not found message.'); + $this->assertText('File to import not found.', 'File to import not found message.'); // Try importing a .po file with overriding strings, and ensure existing // strings are kept. @@ -164,7 +164,7 @@ public function testStandalonePoFile() { 'translation' => 'translated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), 'String not overwritten by imported string.'); + $this->assertText('No strings available.', 'String not overwritten by imported string.'); // This import should not have changed number of plural forms. $locale_plurals = \Drupal::service('locale.plural.formula')->getNumberOfPlurals('fr'); @@ -226,7 +226,7 @@ public function testStandalonePoFile() { 'translation' => 'translated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), 'Customized string not overwritten by imported string.'); + $this->assertText('No strings available.', 'Customized string not overwritten by imported string.'); // Try importing a .po file with overriding strings, and ensure existing // customized strings are overwritten. diff --git a/core/modules/locale/tests/src/Functional/LocalePathTest.php b/core/modules/locale/tests/src/Functional/LocalePathTest.php index c5ffb3d660..2054ddd1f7 100644 --- a/core/modules/locale/tests/src/Functional/LocalePathTest.php +++ b/core/modules/locale/tests/src/Functional/LocalePathTest.php @@ -76,7 +76,7 @@ public function testPathLanguageConfiguration() { // Check that the "xx" front page is readily available because path prefix // negotiation is pre-configured. $this->drupalGet($prefix); - $this->assertText(t('Welcome to Drupal'), 'The "xx" front page is readily available.'); + $this->assertText('Welcome to Drupal', 'The "xx" front page is readily available.'); // Create a node. $node = $this->drupalCreateNode(['type' => 'page']); diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php index c0c0654c5d..d41062a886 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @@ -78,7 +78,7 @@ public function testStringTranslation() { // Reset locale cache. $this->container->get('string_translation')->reset(); $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); - $this->assertText(t($name), 'Test language added.'); + $this->assertText($name, 'Test language added.'); $this->drupalLogout(); // Search for the name and translate it. @@ -110,7 +110,7 @@ public function testStringTranslation() { $lid => $translation, ]; $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations')); - $this->assertText(t('The strings have been saved.'), 'The strings have been saved.'); + $this->assertText('The strings have been saved.', 'The strings have been saved.'); $url_bits = explode('?', $this->getUrl()); $this->assertEqual($url_bits[0], Url::fromRoute('locale.translate_page', [], ['absolute' => TRUE])->toString(), 'Correct page redirection.'); $search = [ @@ -156,7 +156,7 @@ public function testStringTranslation() { 'translation' => 'untranslated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), 'String is translated.'); + $this->assertText('No strings available.', 'String is translated.'); // Test invalidation of 'rendered' cache tag after string translation. $this->drupalLogout(); @@ -413,7 +413,7 @@ public function testStringSearch() { 'translation' => 'translated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the string."); + $this->assertText('No strings available.', "Search didn't find the string."); // Ensure untranslated string appears if searching on 'only untranslated // strings'. @@ -453,7 +453,7 @@ public function testStringSearch() { 'translation' => 'untranslated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the source string."); + $this->assertText('No strings available.', "Search didn't find the source string."); // Ensure translated string doesn't appear if searching on 'only // untranslated strings'. @@ -463,7 +463,7 @@ public function testStringSearch() { 'translation' => 'untranslated', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the translation."); + $this->assertText('No strings available.', "Search didn't find the translation."); // Ensure translated string does appear if searching on the custom language. $search = [ @@ -481,7 +481,7 @@ public function testStringSearch() { 'translation' => 'all', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the translation."); + $this->assertText('No strings available.', "Search didn't find the translation."); // Search for a string that isn't in the system. $unavailable_string = $this->randomMachineName(16); @@ -491,7 +491,7 @@ public function testStringSearch() { 'translation' => 'all', ]; $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); - $this->assertText(t('No strings available.'), "Search didn't find the invalid string."); + $this->assertText('No strings available.', "Search didn't find the invalid string."); } /** diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php index 54f1ceb642..add1267b8d 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php @@ -64,10 +64,10 @@ public function testInterface() { // One language added, all translations up to date. $this->drupalGet('admin/reports/status'); - $this->assertText(t('Translation update status'), 'Status message'); - $this->assertText(t('Up to date'), 'Translations up to date'); + $this->assertText('Translation update status', 'Status message'); + $this->assertText('Up to date', 'Translations up to date'); $this->drupalGet('admin/reports/translations'); - $this->assertText(t('All translations up to date.'), 'Translations up to date'); + $this->assertText('All translations up to date.', 'Translations up to date'); // Set locale_test_translate module to have a local translation available. $status = locale_translation_get_status(); @@ -76,10 +76,10 @@ public function testInterface() { // Check if updates are available for German. $this->drupalGet('admin/reports/status'); - $this->assertText(t('Translation update status'), 'Status message'); + $this->assertText('Translation update status', 'Status message'); $this->assertRaw(t('Updates available for: @languages. See the Available translation updates page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()])); $this->drupalGet('admin/reports/translations'); - $this->assertText(t('Updates for: @modules', ['@modules' => 'Locale test translate']), 'Translations available'); + $this->assertText('Updates for: Locale test translate', 'Translations available'); // Set locale_test_translate module to have a dev release and no // translation found. @@ -90,10 +90,10 @@ public function testInterface() { // Check if no updates were found. $this->drupalGet('admin/reports/status'); - $this->assertText(t('Translation update status'), 'Status message'); + $this->assertText('Translation update status', 'Status message'); $this->assertRaw(t('Missing translations for: @languages. See the Available translation updates page for more information.', ['@languages' => t('German'), ':updates' => Url::fromRoute('locale.translate_status')->toString()])); $this->drupalGet('admin/reports/translations'); - $this->assertText(t('Missing translations for one project'), 'No translations found'); + $this->assertText('Missing translations for one project', 'No translations found'); $release_details = new FormattableMarkup('@module (@version). @info', [ '@module' => 'Locale test translate', '@version' => '1.3-dev', @@ -110,8 +110,8 @@ public function testInterface() { // Check if Drupal core is not translated. $this->drupalGet('admin/reports/translations'); - $this->assertText(t('Missing translations for 2 projects'), 'No translations found'); - $this->assertText(t('@module (@version).', ['@module' => t('Drupal core'), '@version' => '8.1.1']), 'Release details'); + $this->assertText('Missing translations for 2 projects', 'No translations found'); + $this->assertText('Drupal core (8.1.1).', 'Release details'); // Override Drupal core translation status as 'translations available'. $status = locale_translation_get_status(); @@ -122,7 +122,7 @@ public function testInterface() { // Check if translations are available for Drupal core. $this->drupalGet('admin/reports/translations'); - $this->assertText(t('Updates for: @project', ['@project' => t('Drupal core')]), 'Translations found'); + $this->assertText('Updates for: Drupal core', 'Translations found'); $this->assertText(new FormattableMarkup('@module (@date)', [ '@module' => t('Drupal core'), '@date' => $this->container->get('date.formatter')->format(REQUEST_TIME, 'html_date'), diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php index fd28eaa327..8de98d95d1 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateTest.php @@ -55,7 +55,7 @@ protected function setUp(): void { public function testUpdateCheckStatus() { // Case when contributed modules are absent. $this->drupalGet('admin/reports/translations'); - $this->assertText(t('Missing translations for one project')); + $this->assertText('Missing translations for one project'); $config = $this->config('locale.settings'); // Set a flag to let the locale_test module replace the project data with a @@ -421,8 +421,8 @@ public function testEnableCustomLanguage() { // Ensure the translation file is automatically imported when the language // was added. - $this->assertText(t('One translation file imported.'), 'Language file automatically imported.'); - $this->assertText(t('One translation string was skipped because of disallowed or malformed HTML'), 'Language file automatically imported.'); + $this->assertText('One translation file imported.', 'Language file automatically imported.'); + $this->assertText('One translation string was skipped because of disallowed or malformed HTML', 'Language file automatically imported.'); // Ensure the strings were successfully imported. $search = [ diff --git a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php index d07345daa0..7eb6681c2d 100644 --- a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php +++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php @@ -47,7 +47,7 @@ public function testMenuLinkContentDeleteForm() { ], t('Save') ); - $this->assertText(t('The menu link has been saved.')); + $this->assertText('The menu link has been saved.'); $menu_link = MenuLinkContent::load(1); $this->drupalGet($menu_link->toUrl('delete-form')); diff --git a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php index 4558c03bd5..d62ba91b63 100644 --- a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php +++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php @@ -97,7 +97,7 @@ public function testMenuLinkContentForm() { ], t('Save') ); - $this->assertText(t('The menu link has been saved.')); + $this->assertText('The menu link has been saved.'); } /** @@ -113,7 +113,7 @@ public function testMenuLinkContentFormValidation() { ], t('Save') ); - $this->assertText(t('Manually entered paths should start with one of the following characters: / ? #')); + $this->assertText('Manually entered paths should start with one of the following characters: / ? #'); } } diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php index 0688eee419..5420336b2a 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiNodeTest.php @@ -93,7 +93,7 @@ public function testMenuNodeFormWidget() { // Verify that no menu settings are displayed and nodes can be created. $this->drupalGet('node/add/page'); - $this->assertText(t('Create Basic page')); + $this->assertText('Create Basic page'); $this->assertNoText('Menu settings'); $node_title = $this->randomMachineName(); $edit = [ @@ -111,7 +111,7 @@ public function testMenuNodeFormWidget() { 'menu_parent' => 'main:', ]; $this->drupalPostForm('admin/structure/types/manage/page', $edit, t('Save content type')); - $this->assertText(t('The selected menu link is not under one of the selected menus.')); + $this->assertText('The selected menu link is not under one of the selected menus.'); $this->assertNoRaw(t('The content type %name has been updated.', ['%name' => 'Basic page'])); // Enable Tools menu as available menu. diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php index 4bc5f08888..b817c82392 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiTest.php @@ -274,7 +274,7 @@ public function deleteCustomMenu() { // Try to delete the main menu. $this->drupalGet('admin/structure/menu/manage/main/delete'); - $this->assertText(t('You are not authorized to access this page.')); + $this->assertText('You are not authorized to access this page.'); } /** @@ -951,21 +951,21 @@ private function verifyAccess($response = 200) { $this->drupalGet('admin/help/menu'); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Menu'), 'Menu help was displayed'); + $this->assertText('Menu', 'Menu help was displayed'); } // View menu build overview page. $this->drupalGet('admin/structure/menu'); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Menus'), 'Menu build overview page was displayed'); + $this->assertText('Menus', 'Menu build overview page was displayed'); } // View tools menu customization page. $this->drupalGet('admin/structure/menu/manage/' . $this->menu->id()); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Tools'), 'Tools menu page was displayed'); + $this->assertText('Tools', 'Tools menu page was displayed'); } // View menu edit page for a static link. @@ -973,14 +973,14 @@ private function verifyAccess($response = 200) { $this->drupalGet('admin/structure/menu/link/' . $item->getPluginId() . '/edit'); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Edit menu item'), 'Menu edit page was displayed'); + $this->assertText('Edit menu item', 'Menu edit page was displayed'); } // View add menu page. $this->drupalGet('admin/structure/menu/add'); $this->assertSession()->statusCodeEquals($response); if ($response == 200) { - $this->assertText(t('Menus'), 'Add menu page was displayed'); + $this->assertText('Menus', 'Add menu page was displayed'); } } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php index d7298bd420..93d81b94bf 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateAccessTest.php @@ -30,7 +30,7 @@ public function testAccess() { $this->drupalLogin($this->rootUser); $this->drupalGet('upgrade'); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Upgrade')); + $this->assertText('Upgrade'); $user = $this->createUser(['administer software updates']); $this->drupalLogin($user); diff --git a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php index ca23965a6d..ced149d591 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php @@ -69,7 +69,7 @@ public function testCommentPager() { // be two pages (0, 1) but no third (2) page. $this->drupalGet('node/' . $node->id()); $this->assertText($node->label()); - $this->assertText(t('Comments')); + $this->assertText('Comments'); $this->assertRaw('page=1'); $this->assertNoRaw('page=2'); } diff --git a/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php b/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php index 323f300645..d906c57851 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php @@ -81,7 +81,7 @@ public function testNodeAccessRebuildNodeGrants() { $this->drupalGet('admin/reports/status'); $this->clickLink(t('Rebuild permissions')); $this->drupalPostForm(NULL, [], t('Rebuild permissions')); - $this->assertText(t('The content access permissions have been rebuilt.')); + $this->assertText('The content access permissions have been rebuilt.'); // Test if the rebuild by user that cannot bypass node access and does not // have access to the nodes has been successful. @@ -117,7 +117,7 @@ public function testNodeAccessRebuildNoAccessModules() { $this->drupalGet('admin/reports/status'); $this->clickLink(t('Rebuild permissions')); $this->drupalPostForm(NULL, [], t('Rebuild permissions')); - $this->assertText(t('Content permissions have been rebuilt.')); + $this->assertText('Content permissions have been rebuilt.'); $this->assertNull(\Drupal::state()->get('node.node_access_needs_rebuild'), 'Node access permissions have been rebuilt'); // Default realm access is still present. diff --git a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php index 3ca3ababfa..8184fefd2c 100644 --- a/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php +++ b/core/modules/node/tests/src/Functional/NodeActionsConfigurationTest.php @@ -52,7 +52,7 @@ public function testAssignOwnerNodeActionConfiguration() { $action_id = $edit['id']; // Make sure that the new action was saved properly. - $this->assertText(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully saved.'); + $this->assertText('The action has been successfully saved.', 'The node_assign_owner_action action has been successfully saved.'); $this->assertText($action_label, 'The label of the node_assign_owner_action action appears on the actions administration page after saving.'); // Make another POST request to the action edit page. @@ -65,7 +65,7 @@ public function testAssignOwnerNodeActionConfiguration() { $this->assertSession()->statusCodeEquals(200); // Make sure that the action updated properly. - $this->assertText(t('The action has been successfully saved.'), 'The node_assign_owner_action action has been successfully updated.'); + $this->assertText('The action has been successfully saved.', 'The node_assign_owner_action action has been successfully updated.'); $this->assertNoText($action_label, 'The old label for the node_assign_owner_action action does not appear on the actions administration page after updating.'); $this->assertText($new_action_label, 'The new label for the node_assign_owner_action action appears on the actions administration page after updating.'); diff --git a/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php b/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php index f28819b603..8e9a8730d6 100644 --- a/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php +++ b/core/modules/node/tests/src/Functional/NodeBlockFunctionalTest.php @@ -77,7 +77,7 @@ public function testRecentNodeBlock() { // Test that block is not visible without nodes. $this->drupalGet(''); - $this->assertText(t('No content available.'), 'Block with "No content available." found.'); + $this->assertText('No content available.', 'Block with "No content available." found.'); // Add some test nodes. $default_settings = ['uid' => $this->webUser->id(), 'type' => 'article']; diff --git a/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php index 020acef616..381338ada4 100644 --- a/core/modules/node/tests/src/Functional/NodeCreationTest.php +++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php @@ -60,7 +60,7 @@ public function testNodeCreation() { $this->drupalPostForm('node/add/page', $edit, t('Save')); // Check that the Basic page has been created. - $this->assertText(t('@post @title has been created.', ['@post' => 'Basic page', '@title' => $edit['title[0][value]']]), 'Basic page created.'); + $this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.', 'Basic page created.'); // Verify that the creation message contains a link to a node. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]'); @@ -147,10 +147,10 @@ public function testUnpublishedNodeCreation() { // Check that the user was redirected to the home page. $this->assertSession()->addressEquals(''); - $this->assertText(t('Test page text')); + $this->assertText('Test page text'); // Confirm that the node was created. - $this->assertText(t('@post @title has been created.', ['@post' => 'Basic page', '@title' => $edit['title[0][value]']])); + $this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.'); // Verify that the creation message contains a link to a node. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]'); diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php index 43bb0ee53d..099973cb88 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php @@ -170,7 +170,7 @@ public function testRevisions() { // Confirm that the node can still be updated. $this->drupalPostForm("node/" . $reverted_node->id() . "/edit", ['body[0][value]' => 'We are Drupal.'], t('Save')); - $this->assertText(t('Basic page @title has been updated.', ['@title' => $reverted_node->getTitle()]), 'Node was successfully saved after reverting a revision.'); + $this->assertText('Basic page ' . $reverted_node->getTitle() . ' has been updated.', 'Node was successfully saved after reverting a revision.'); $this->assertText('We are Drupal.', 'Node was correctly updated after reverting a revision.'); // Confirm revisions delete properly. diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php index 1a7a591d62..68623dfb0d 100644 --- a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php +++ b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php @@ -163,9 +163,9 @@ public function testRevisions() { } // Original author, and editor names should appear on revisions overview. $web_user = $nodes[0]->revision_uid->entity; - $this->assertText(t('by @name', ['@name' => $web_user->getAccountName()])); + $this->assertText('by ' . $web_user->getAccountName()); $editor = $nodes[2]->revision_uid->entity; - $this->assertText(t('by @name', ['@name' => $editor->getAccountName()])); + $this->assertText('by ' . $editor->getAccountName()); // Confirm that this is the default revision. $this->assertTrue($node->isDefaultRevision(), 'Third node revision is the default one.'); diff --git a/core/modules/node/tests/src/Functional/NodeTypeTest.php b/core/modules/node/tests/src/Functional/NodeTypeTest.php index f1eed3f998..7cdd2a4dc3 100644 --- a/core/modules/node/tests/src/Functional/NodeTypeTest.php +++ b/core/modules/node/tests/src/Functional/NodeTypeTest.php @@ -197,7 +197,7 @@ public function testNodeTypeDeletion() { $this->assertRaw( t('Are you sure you want to delete the content type %type?', ['%type' => $type->label()]) ); - $this->assertText(t('This action cannot be undone.'), 'The node type deletion confirmation form is available.'); + $this->assertText('This action cannot be undone.', 'The node type deletion confirmation form is available.'); // Test that a locked node type could not be deleted. $this->container->get('module_installer')->install(['node_test_config']); diff --git a/core/modules/path/tests/src/Functional/PathLanguageUiTest.php b/core/modules/path/tests/src/Functional/PathLanguageUiTest.php index 8dfb808feb..9efde77039 100644 --- a/core/modules/path/tests/src/Functional/PathLanguageUiTest.php +++ b/core/modules/path/tests/src/Functional/PathLanguageUiTest.php @@ -59,7 +59,7 @@ public function testLanguageNeutralUrl() { $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); $this->drupalGet($name); - $this->assertText(t('Filter aliases'), 'Language-neutral URL alias works'); + $this->assertText('Filter aliases', 'Language-neutral URL alias works'); } /** @@ -74,7 +74,7 @@ public function testDefaultLanguageUrl() { $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); $this->drupalGet($name); - $this->assertText(t('Filter aliases'), 'English URL alias works'); + $this->assertText('Filter aliases', 'English URL alias works'); } /** @@ -89,7 +89,7 @@ public function testNonDefaultUrl() { $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); $this->drupalGet('fr/' . $name); - $this->assertText(t('Filter aliases'), 'Foreign URL alias works'); + $this->assertText('Filter aliases', 'Foreign URL alias works'); } /** diff --git a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php index 9fa1502324..d529a0bb4f 100644 --- a/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php +++ b/core/modules/path_alias/tests/src/Functional/UrlAlterFunctionalTest.php @@ -59,7 +59,7 @@ public function testUrlAlter() { // Test adding an alias via the UI. $edit = ['path[0][value]' => "/user/$uid/edit", 'alias[0][value]' => '/alias/test2']; $this->drupalPostForm('admin/config/search/path/add', $edit, t('Save')); - $this->assertText(t('The alias has been saved.')); + $this->assertText('The alias has been saved.'); $this->drupalGet('alias/test2'); $this->assertSession()->statusCodeEquals(200); $this->assertUrlOutboundAlter("/user/$uid/edit", '/alias/test2'); diff --git a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php index 23881f2dce..e50fc590ae 100644 --- a/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php +++ b/core/modules/rest/tests/src/Functional/Views/StyleSerializerTest.php @@ -490,7 +490,7 @@ public function testUIFieldAlias() { $edit = ['row_options[field_options][name][alias]' => $alias_map['name'], 'row_options[field_options][nothing][alias]' => $alias_map['nothing']]; $this->drupalPostForm($row_options, $edit, t('Apply')); - $this->assertText(t('The machine-readable name must contain only letters, numbers, dashes and underscores.')); + $this->assertText('The machine-readable name must contain only letters, numbers, dashes and underscores.'); // Change the map alias value to a valid one. $alias_map['nothing'] = $this->randomMachineName(); diff --git a/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php b/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php index 3314ed24dd..07c72197af 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentCountToggleTest.php @@ -95,8 +95,8 @@ public function testSearchCommentCountToggle() { // Test comment count display for nodes with comment status set to Open $this->drupalPostForm(NULL, $edit, t('Search')); - $this->assertText(t('0 comments'), 'Empty comment count displays for nodes with comment status set to Open'); - $this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Open'); + $this->assertText('0 comments', 'Empty comment count displays for nodes with comment status set to Open'); + $this->assertText('1 comment', 'Non-empty comment count displays for nodes with comment status set to Open'); // Test comment count display for nodes with comment status set to Closed $this->searchableNodes['0 comments']->set('comment', CommentItemInterface::CLOSED); @@ -106,7 +106,7 @@ public function testSearchCommentCountToggle() { $this->drupalPostForm(NULL, $edit, t('Search')); $this->assertNoText('0 comments', 'Empty comment count does not display for nodes with comment status set to Closed'); - $this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Closed'); + $this->assertText('1 comment', 'Non-empty comment count displays for nodes with comment status set to Closed'); // Test comment count display for nodes with comment status set to Hidden $this->searchableNodes['0 comments']->set('comment', CommentItemInterface::HIDDEN); diff --git a/core/modules/search/tests/src/Functional/SearchCommentTest.php b/core/modules/search/tests/src/Functional/SearchCommentTest.php index d3164a91f3..33941e4887 100644 --- a/core/modules/search/tests/src/Functional/SearchCommentTest.php +++ b/core/modules/search/tests/src/Functional/SearchCommentTest.php @@ -220,7 +220,7 @@ public function testSearchResultsComment() { // Search for $title. $this->drupalPostForm('search/node', $edit, t('Search')); - $this->assertText(t('Your search yielded no results.')); + $this->assertText('Your search yielded no results.'); } /** @@ -347,7 +347,7 @@ public function testAddNewComment() { // Verify that if you view the node on its own page, 'add new comment' // is there. $this->drupalGet('node/' . $node->id()); - $this->assertText(t('Add new comment')); + $this->assertText('Add new comment'); // Run cron to index this page. $this->drupalLogout(); @@ -356,7 +356,7 @@ public function testAddNewComment() { // Search for 'comment'. Should be no results. $this->drupalLogin($user); $this->drupalPostForm('search/node', ['keys' => 'comment'], t('Search')); - $this->assertText(t('Your search yielded no results')); + $this->assertText('Your search yielded no results'); // Search for the node title. Should be found, and 'Add new comment' should // not be part of the search snippet. diff --git a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php index 3833e17304..06b617476b 100644 --- a/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php @@ -88,19 +88,19 @@ public function testSearchSettingsPage() { // Test that the settings form displays the correct count of items left to index. $this->drupalGet('admin/config/search/pages'); - $this->assertText(t('There are @count items left to index.', ['@count' => 0])); + $this->assertText('There are 0 items left to index.'); // Test the re-index button. $this->drupalPostForm('admin/config/search/pages', [], t('Re-index site')); - $this->assertText(t('Are you sure you want to re-index the site')); + $this->assertText('Are you sure you want to re-index the site'); $this->drupalPostForm('admin/config/search/pages/reindex', [], t('Re-index site')); - $this->assertText(t('All search indexes will be rebuilt')); + $this->assertText('All search indexes will be rebuilt'); $this->drupalGet('admin/config/search/pages'); - $this->assertText(t('There is 1 item left to index.')); + $this->assertText('There is 1 item left to index.'); // Test that the form saves with the default values. $this->drupalPostForm('admin/config/search/pages', [], t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), 'Form saves with the default values.'); + $this->assertText('The configuration options have been saved.', 'Form saves with the default values.'); // Test that the form does not save with an invalid word length. $edit = [ @@ -257,7 +257,7 @@ public function testMultipleSearchPages() { // Ensure that no search pages are configured. $this->drupalGet('admin/config/search/pages'); - $this->assertText(t('No search pages have been configured.')); + $this->assertText('No search pages have been configured.'); // Add a search page. $edit = []; @@ -282,7 +282,7 @@ public function testMultipleSearchPages() { $edit['id'] = strtolower($this->randomMachineName(8)); $edit['path'] = $first['path']; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('The search page path must be unique.')); + $this->assertText('The search page path must be unique.'); // Add a second search page. $second = []; diff --git a/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php b/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php index af37d7656d..b36d2a53bd 100644 --- a/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php +++ b/core/modules/search/tests/src/Functional/SearchEmbedFormTest.php @@ -65,18 +65,18 @@ public function testEmbeddedForm() { $this->drupalPostForm('search_embedded_form', ['name' => 'John'], t('Send away')); - $this->assertText(t('Test form was submitted'), 'Form message appears'); + $this->assertText('Test form was submitted', 'Form message appears'); $count = \Drupal::state()->get('search_embedded_form.submit_count'); $this->assertEqual($this->submitCount + 1, $count, 'Form submission count is correct'); $this->submitCount = $count; // Now verify that we can see and submit the form from the search results. $this->drupalGet('search/node', ['query' => ['keys' => $this->node->label()]]); - $this->assertText(t('Your name'), 'Form is visible'); + $this->assertText('Your name', 'Form is visible'); $this->drupalPostForm(NULL, ['name' => 'John'], t('Send away')); - $this->assertText(t('Test form was submitted'), 'Form message appears'); + $this->assertText('Test form was submitted', 'Form message appears'); $count = \Drupal::state()->get('search_embedded_form.submit_count'); $this->assertEqual($this->submitCount + 1, $count, 'Form submission count is correct'); $this->submitCount = $count; diff --git a/core/modules/search/tests/src/Functional/SearchLanguageTest.php b/core/modules/search/tests/src/Functional/SearchLanguageTest.php index 9a85692d95..37bf09ec78 100644 --- a/core/modules/search/tests/src/Functional/SearchLanguageTest.php +++ b/core/modules/search/tests/src/Functional/SearchLanguageTest.php @@ -108,9 +108,9 @@ public function testLanguages() { // Now we should have languages displayed. $this->drupalGet('search/node'); - $this->assertText(t('Languages'), 'Languages displayed to choose from.'); - $this->assertText(t('English'), 'English is a possible choice.'); - $this->assertText(t('French'), 'French is a possible choice.'); + $this->assertText('Languages', 'Languages displayed to choose from.'); + $this->assertText('English', 'English is a possible choice.'); + $this->assertText('French', 'French is a possible choice.'); // Ensure selecting no language does not make the query different. $this->drupalPostForm('search/node', [], 'edit-submit--2'); diff --git a/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php b/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php index a2f2171074..8b83017bb5 100644 --- a/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php +++ b/core/modules/search/tests/src/Functional/SearchNumberMatchingTest.php @@ -85,7 +85,7 @@ protected function setUp(): void { // Run cron to ensure the content is indexed. $this->cronRun(); $this->drupalGet('admin/reports/dblog'); - $this->assertText(t('Cron run completed'), 'Log shows cron run completed'); + $this->assertText('Cron run completed', 'Log shows cron run completed'); } /** diff --git a/core/modules/search/tests/src/Functional/SearchNumbersTest.php b/core/modules/search/tests/src/Functional/SearchNumbersTest.php index 574d0a3a47..289510c656 100644 --- a/core/modules/search/tests/src/Functional/SearchNumbersTest.php +++ b/core/modules/search/tests/src/Functional/SearchNumbersTest.php @@ -92,7 +92,7 @@ protected function setUp(): void { // Run cron to ensure the content is indexed. $this->cronRun(); $this->drupalGet('admin/reports/dblog'); - $this->assertText(t('Cron run completed'), 'Log shows cron run completed'); + $this->assertText('Cron run completed', 'Log shows cron run completed'); } /** diff --git a/core/modules/search/tests/src/Functional/SearchPageTextTest.php b/core/modules/search/tests/src/Functional/SearchPageTextTest.php index 46d3af4938..6ad5db6d2b 100644 --- a/core/modules/search/tests/src/Functional/SearchPageTextTest.php +++ b/core/modules/search/tests/src/Functional/SearchPageTextTest.php @@ -70,8 +70,8 @@ public function testSearchLabelXSS() { public function testSearchText() { $this->drupalLogin($this->searchingUser); $this->drupalGet('search/node'); - $this->assertText(t('Enter your keywords')); - $this->assertText(t('Search')); + $this->assertText('Enter your keywords'); + $this->assertText('Search'); $this->assertSession()->titleEquals('Search | Drupal'); $edit = []; @@ -79,12 +79,12 @@ public function testSearchText() { $edit['keys'] = $search_terms; $this->drupalPostForm('search/node', $edit, t('Search')); $this->assertText('search yielded no results'); - $this->assertText(t('Search')); + $this->assertText('Search'); $title_source = 'Search for @keywords | Drupal'; $this->assertSession()->titleEquals('Search for ' . Unicode::truncate($search_terms, 60, TRUE, TRUE) . ' | Drupal'); $this->assertNoText('Node', 'Erroneous tab and breadcrumb text is not present'); $this->assertNoText('Node', 'Erroneous translated tab and breadcrumb text is not present'); - $this->assertText(t('Content'), 'Tab and breadcrumb text is present'); + $this->assertText('Content', 'Tab and breadcrumb text is present'); $this->clickLink('About searching'); $this->assertText('About searching', 'Correct title is on search help page'); @@ -106,7 +106,7 @@ public function testSearchText() { $edit['keys'] = $this->searchingUser->getAccountName(); $this->drupalPostForm('search/user', $edit, t('Search')); - $this->assertText(t('Search')); + $this->assertText('Search'); $this->assertSession()->titleEquals('Search for ' . Unicode::truncate($this->searchingUser->getAccountName(), 60, TRUE, TRUE) . ' | Drupal'); $this->clickLink('About searching'); @@ -138,9 +138,9 @@ public function testSearchText() { // Test that a search on Node or User with no keywords entered generates // the "Please enter some keywords" message. $this->drupalPostForm('search/node', [], t('Search')); - $this->assertText(t('Please enter some keywords'), 'With no keywords entered, message is displayed on node page'); + $this->assertText('Please enter some keywords', 'With no keywords entered, message is displayed on node page'); $this->drupalPostForm('search/user', [], t('Search')); - $this->assertText(t('Please enter some keywords'), 'With no keywords entered, message is displayed on user page'); + $this->assertText('Please enter some keywords', 'With no keywords entered, message is displayed on user page'); // Make sure the "Please enter some keywords" message is NOT displayed if // you use "or" words or phrases in Advanced Search. diff --git a/core/modules/search/tests/src/Functional/SearchRankingTest.php b/core/modules/search/tests/src/Functional/SearchRankingTest.php index b064815393..e80668c1b1 100644 --- a/core/modules/search/tests/src/Functional/SearchRankingTest.php +++ b/core/modules/search/tests/src/Functional/SearchRankingTest.php @@ -129,7 +129,7 @@ public function testRankings() { // Test that the settings form displays the content ranking section. $this->drupalGet('admin/config/search/pages/manage/node_search'); - $this->assertText(t('Content ranking')); + $this->assertText('Content ranking'); // Check that all rankings are visible and set to 0. foreach ($node_ranks as $node_rank) { diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php index ec68e36e9d..82eaf1b05e 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php @@ -81,7 +81,7 @@ public function testShortcutLinkAdd() { ]; $this->drupalPostForm('admin/config/user-interface/shortcut/manage/' . $set->id() . '/add-link', $form_data, t('Save')); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Added a shortcut for @title.', ['@title' => $title])); + $this->assertText('Added a shortcut for ' . $title . '.'); $saved_set = ShortcutSet::load($set->id()); $paths = $this->getShortcutInformation($saved_set, 'link'); $this->assertContains('internal:' . $test_path, $paths, 'Shortcut created: ' . $test_path); @@ -241,7 +241,7 @@ public function testShortcutLinkRename() { $titles = $this->getShortcutInformation($saved_set, 'title'); $this->assertContains($new_link_name, $titles, 'Shortcut renamed: ' . $new_link_name); $this->assertSession()->linkExists($new_link_name, 0, 'Renamed shortcut link appears on the page.'); - $this->assertText(t('The shortcut @link has been updated.', ['@link' => $new_link_name])); + $this->assertText('The shortcut ' . $new_link_name . ' has been updated.'); } /** @@ -260,7 +260,7 @@ public function testShortcutLinkChangePath() { $paths = $this->getShortcutInformation($saved_set, 'link'); $this->assertContains('internal:' . $new_link_path, $paths, 'Shortcut path changed: ' . $new_link_path); $this->assertSession()->linkByHrefExists($new_link_path, 0, 'Shortcut with new path appears on the page.'); - $this->assertText(t('The shortcut @link has been updated.', ['@link' => $shortcut->getTitle()])); + $this->assertText('The shortcut ' . $shortcut->getTitle() . ' has been updated.'); } /** diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php index d493413dee..ab9e21ada4 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php @@ -148,7 +148,7 @@ public function testShortcutSetSwitchCreate() { public function testShortcutSetSwitchNoSetName() { $edit = ['set' => 'new']; $this->drupalPostForm('user/' . $this->adminUser->id() . '/shortcuts', $edit, t('Change set')); - $this->assertText(t('The new set label is required.')); + $this->assertText('The new set label is required.'); $current_set = shortcut_current_displayed_set($this->adminUser); $this->assertEqual($current_set->id(), $this->set->id(), 'Attempting to switch to a new shortcut set without providing a set name does not succeed.'); $this->assertFieldByXPath("//input[@name='label' and contains(concat(' ', normalize-space(@class), ' '), ' error ')]", NULL, 'The new set label field has the error class'); diff --git a/core/modules/syslog/tests/src/Functional/SyslogTest.php b/core/modules/syslog/tests/src/Functional/SyslogTest.php index 15aad39bfa..1b7964cac3 100644 --- a/core/modules/syslog/tests/src/Functional/SyslogTest.php +++ b/core/modules/syslog/tests/src/Functional/SyslogTest.php @@ -33,7 +33,7 @@ public function testSettings() { // If we're on Windows, there is no configuration form. if (defined('LOG_LOCAL6')) { $this->drupalPostForm('admin/config/development/logging', ['syslog_facility' => LOG_LOCAL6], t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); $this->drupalGet('admin/config/development/logging'); // Should be one field. diff --git a/core/modules/system/tests/src/Functional/Common/FormatDateTest.php b/core/modules/system/tests/src/Functional/Common/FormatDateTest.php index b0aae40e6a..6a5b669571 100644 --- a/core/modules/system/tests/src/Functional/Common/FormatDateTest.php +++ b/core/modules/system/tests/src/Functional/Common/FormatDateTest.php @@ -40,7 +40,7 @@ public function testAdminDefinedFormatDate() { 'date_format_pattern' => 'j M Y', ]; $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertText(t('Custom date format added.')); + $this->assertText('Custom date format added.'); /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ $date_formatter = $this->container->get('date.formatter'); diff --git a/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php b/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php index a57b941e23..dd508b905b 100644 --- a/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php +++ b/core/modules/system/tests/src/Functional/DrupalKernel/ContentNegotiationTest.php @@ -43,7 +43,7 @@ public function testBogusAcceptHeader() { foreach ($tests as $case => $header) { $this->drupalGet('', [], ['Accept: ' . $header]); $this->assertNoText('Unsupported Media Type', '"Unsupported Media Type" not found for ' . $case); - $this->assertText(t('Log in'), '"Log in" found for ' . $case); + $this->assertText('Log in', '"Log in" found for ' . $case); } } diff --git a/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php b/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php index 235377a20b..7b124210c6 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php @@ -96,7 +96,7 @@ public function testEntityFormLanguage() { $edit['body[0][value]'] = $this->randomMachineName(16); $edit['langcode[0][value]'] = $langcode; $this->drupalPostForm('node/add/page', $edit, t('Save')); - $this->assertText(t('Basic page @title has been created.', ['@title' => $edit['title[0][value]']]), 'Basic page created.'); + $this->assertText('Basic page ' . $edit['title[0][value]'] . ' has been created.', 'Basic page created.'); // Verify that the creation message contains a link to a node. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]'); diff --git a/core/modules/system/tests/src/Functional/File/ConfigTest.php b/core/modules/system/tests/src/Functional/File/ConfigTest.php index 56115dc4c8..65d705d18c 100644 --- a/core/modules/system/tests/src/Functional/File/ConfigTest.php +++ b/core/modules/system/tests/src/Functional/File/ConfigTest.php @@ -42,7 +42,7 @@ public function testFileConfigurationPage() { $this->assertText('Private local files served by Drupal.'); $this->drupalPostForm(NULL, $fields, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); foreach ($fields as $field => $value) { $this->assertSession()->fieldValueEquals($field, $value); } diff --git a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php index f031187c1b..3440a30315 100644 --- a/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php +++ b/core/modules/system/tests/src/Functional/Form/ConfirmFormTest.php @@ -30,7 +30,7 @@ public function testConfirmForm() { $this->drupalGet('form-test/confirm-form'); $site_name = $this->config('system.site')->get('name'); $this->assertSession()->titleEquals("ConfirmFormTestForm::getQuestion(). | $site_name"); - $this->assertText(t('ConfirmFormTestForm::getDescription().'), 'The description was used.'); + $this->assertText('ConfirmFormTestForm::getDescription().', 'The description was used.'); $this->assertFieldByXPath('//input[@id="edit-submit"]', t('ConfirmFormTestForm::getConfirmText().'), 'The confirm text was used.'); // Test cancelling the form. diff --git a/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php b/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php index 0203598437..99712dd3a0 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementsAccessTest.php @@ -34,7 +34,7 @@ public function testAccessFalse() { $this->assertNoText('This checkbox inside a container does not have its default value.'); $this->assertNoText('This checkbox inside a nested container does not have its default value.'); $this->assertNoText('This checkbox inside a vertical tab whose fieldset access is allowed does not have its default value.'); - $this->assertText(t('The form submitted correctly.')); + $this->assertText('The form submitted correctly.'); } } diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index 256cc67e19..c91baa4005 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -429,7 +429,7 @@ public function testSelect() { 'multiple_no_default_required', ]; foreach ($expected_errors as $key) { - $this->assertText(t('@name field is required.', ['@name' => $form[$key]['#title']])); + $this->assertText($form[$key]['#title'] . ' field is required.'); } // Post values for required fields. diff --git a/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php b/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php index 9beba1fc7d..1e98fd759e 100644 --- a/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php +++ b/core/modules/system/tests/src/Functional/Form/SystemConfigFormTest.php @@ -31,7 +31,7 @@ public function testSystemConfigForm() { $element = $this->xpath('//div[@id = :id]/input[contains(@class, :class)]', [':id' => 'edit-actions', ':class' => 'button--primary']); $this->assertNotEmpty($element, 'The primary action submit button was found.'); $this->drupalPostForm(NULL, [], t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); } } diff --git a/core/modules/system/tests/src/Functional/Form/ValidationTest.php b/core/modules/system/tests/src/Functional/Form/ValidationTest.php index de9e482578..f3f9c9c71d 100644 --- a/core/modules/system/tests/src/Functional/Form/ValidationTest.php +++ b/core/modules/system/tests/src/Functional/Form/ValidationTest.php @@ -142,7 +142,7 @@ public function testValidateLimitErrors() { // Now test full form validation and ensure that the #element_validate // handler is still triggered. $this->drupalPostForm($path, $edit, t('Full validate')); - $this->assertText(t('@name field is required.', ['@name' => 'Title'])); + $this->assertText('Title field is required.'); $this->assertText('Test element is invalid'); } diff --git a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php index 5ef24164ad..0e252d12a8 100644 --- a/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php +++ b/core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php @@ -92,7 +92,7 @@ protected function doTestTitleMenuCallback() { $this->assertNoText('Menu Callback Title'); // Verify that the menu router item title is output as page title. $this->drupalGet('menu_callback_title'); - $this->assertText(t('Menu Callback Title')); + $this->assertText('Menu Callback Title'); } /** @@ -101,7 +101,7 @@ protected function doTestTitleMenuCallback() { protected function doTestDescriptionMenuItems() { // Verify that the menu router item title is output as page title. $this->drupalGet('menu_callback_description'); - $this->assertText(t('Menu item description text')); + $this->assertText('Menu item description text'); } /** diff --git a/core/modules/system/tests/src/Functional/Module/DependencyTest.php b/core/modules/system/tests/src/Functional/Module/DependencyTest.php index 9439445487..34a3e26094 100644 --- a/core/modules/system/tests/src/Functional/Module/DependencyTest.php +++ b/core/modules/system/tests/src/Functional/Module/DependencyTest.php @@ -40,7 +40,7 @@ public function testEnableWithoutDependency() { $edit = []; $edit['modules[content_translation][enable]'] = 'content_translation'; $this->drupalPostForm('admin/modules', $edit, t('Install')); - $this->assertText(t('Some required modules must be enabled'), 'Dependency required.'); + $this->assertText('Some required modules must be enabled', 'Dependency required.'); $this->assertModules(['content_translation', 'language'], FALSE); @@ -48,7 +48,7 @@ public function testEnableWithoutDependency() { $this->assertTableCount('language', FALSE); $this->drupalPostForm(NULL, [], t('Continue')); - $this->assertText(t('2 modules have been enabled: Content Translation, Language.'), 'Modules status has been updated.'); + $this->assertText('2 modules have been enabled: Content Translation, Language.', 'Modules status has been updated.'); $this->assertModules(['content_translation', 'language'], TRUE); // Assert that the language YAML files were created. @@ -145,7 +145,7 @@ public function testEnableRequirementsFailureDependency() { $this->drupalPostForm('admin/modules', $edit, t('Install')); // Makes sure the modules were NOT installed. - $this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.'); + $this->assertText('Requirements 1 Test failed requirements', 'Modules status has been updated.'); $this->assertModules(['requirements1_test'], FALSE); $this->assertModules(['requirements2_test'], FALSE); @@ -177,7 +177,7 @@ public function testModuleEnableOrder() { $this->assertModules(['color'], FALSE); // Note that dependencies are sorted alphabetically in the confirmation // message. - $this->assertText(t('You must enable the Configuration Manager, Help modules to install Color.')); + $this->assertText('You must enable the Configuration Manager, Help modules to install Color.'); $edit['modules[config][enable]'] = 'config'; $edit['modules[help][enable]'] = 'help'; @@ -218,13 +218,13 @@ public function testUninstallDependents() { $edit = ['uninstall[forum]' => 'forum']; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + $this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.'); // Uninstall comment module. $edit = ['uninstall[comment]' => 'comment']; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + $this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.'); } } diff --git a/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php b/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php index 317634b4d2..9089c03e14 100644 --- a/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php +++ b/core/modules/system/tests/src/Functional/Module/HookRequirementsTest.php @@ -26,7 +26,7 @@ public function testHookRequirementsFailure() { $this->drupalPostForm('admin/modules', $edit, t('Install')); // Makes sure the module was NOT installed. - $this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.'); + $this->assertText('Requirements 1 Test failed requirements', 'Modules status has been updated.'); $this->assertModules(['requirements1_test'], FALSE); } diff --git a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php index 035c133d3a..28f7c2f658 100644 --- a/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/InstallUninstallTest.php @@ -75,7 +75,7 @@ public function testInstallUninstall() { $edit["modules[help][enable]"] = TRUE; $this->drupalPostForm('admin/modules', $edit, t('Install')); $this->assertText('has been enabled', 'Modules status has been updated.'); - $this->assertText(t('hook_modules_installed fired for help')); + $this->assertText('hook_modules_installed fired for help'); $this->assertModuleSuccessfullyInstalled('help'); // Test help for the required modules. @@ -144,7 +144,7 @@ public function testInstallUninstall() { // of modules, that each module's database tables now exist, and that // appropriate messages appear in the logs. foreach ($modules_to_install as $module_to_install) { - $this->assertText(t('hook_modules_installed fired for @module', ['@module' => $module_to_install])); + $this->assertText('hook_modules_installed fired for ' . $module_to_install); $this->assertLogMessage('system', "%module module installed.", ['%module' => $module_to_install], RfcLogLevel::INFO); $this->assertInstallModuleUpdates($module_to_install); $this->assertModuleSuccessfullyInstalled($module_to_install); @@ -225,7 +225,7 @@ public function testInstallUninstall() { // The string tested here is translatable but we are only using a part of it // so using a translated string is wrong. Doing so would create a new string // to translate. - $this->assertText(new FormattableMarkup('@count modules have been enabled: ', ['@count' => count($all_modules)]), 'Modules status has been updated.'); + $this->assertText(count($all_modules) . ' modules have been enabled: ', 'Modules status has been updated.'); } /** @@ -265,14 +265,14 @@ protected function assertSuccessfulUninstall($module, $package = 'Core') { $edit['uninstall[' . $module . ']'] = TRUE; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + $this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.'); $this->assertModules([$module], FALSE); // Check that the appropriate hook was fired and the appropriate log // message appears. (But don't check for the log message if the dblog // module was just uninstalled, since the {watchdog} table won't be there // anymore.) - $this->assertText(t('hook_modules_uninstalled fired for @module', ['@module' => $module])); + $this->assertText('hook_modules_uninstalled fired for ' . $module); $this->assertLogMessage('system', "%module module uninstalled.", ['%module' => $module], RfcLogLevel::INFO); // Check that the module's database tables no longer exist. diff --git a/core/modules/system/tests/src/Functional/Module/UninstallTest.php b/core/modules/system/tests/src/Functional/Module/UninstallTest.php index 32ea0c2871..aab9f9d245 100644 --- a/core/modules/system/tests/src/Functional/Module/UninstallTest.php +++ b/core/modules/system/tests/src/Functional/Module/UninstallTest.php @@ -90,7 +90,7 @@ public function testUninstallPage() { $this->assertText(\Drupal::translation()->translate('Configuration updates'), 'Configuration updates listed on the module install confirmation page.'); $this->assertText($node_type->label()); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + $this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.'); // Uninstall node testing that the configuration that will be deleted is // listed. @@ -122,7 +122,7 @@ public function testUninstallPage() { $this->assertEqual($cached->data, 'test_uninstall_page', new FormattableMarkup('Cache entry found: @bin', ['@bin' => $cached->data])); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + $this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.'); // Check that the page does not have double escaped HTML tags. $this->assertNoRaw('<label'); @@ -132,7 +132,7 @@ public function testUninstallPage() { // Make sure we get an error message when we try to confirm uninstallation // of an empty list of modules. $this->drupalGet('admin/modules/uninstall/confirm'); - $this->assertText(t('The selected modules could not be uninstalled, either due to a website problem or due to the uninstall confirmation form timing out. Please try again.'), 'Module uninstall confirmation form displays error message'); + $this->assertText('The selected modules could not be uninstalled, either due to a website problem or due to the uninstall confirmation form timing out. Please try again.', 'Module uninstall confirmation form displays error message'); // Make sure confirmation page is accessible only during uninstall process. $this->drupalGet('admin/modules/uninstall/confirm'); @@ -142,7 +142,7 @@ public function testUninstallPage() { // Make sure the correct error is shown when no modules are selected. $edit = []; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); - $this->assertText(t('No modules selected.'), 'No module is selected to uninstall'); + $this->assertText('No modules selected.', 'No module is selected to uninstall'); } /** @@ -168,7 +168,7 @@ public function testFailedInstallStatus() { $edit['uninstall[module_installer_config_test]'] = TRUE; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.')); + $this->assertText('The selected modules have been uninstalled.'); $this->assertNoText('Module installer config test'); } diff --git a/core/modules/system/tests/src/Functional/Pager/PagerTest.php b/core/modules/system/tests/src/Functional/Pager/PagerTest.php index c556d03bef..b6a2c66aca 100644 --- a/core/modules/system/tests/src/Functional/Pager/PagerTest.php +++ b/core/modules/system/tests/src/Functional/Pager/PagerTest.php @@ -84,14 +84,14 @@ public function testActiveClass() { public function testPagerQueryParametersAndCacheContext() { // First page. $this->drupalGet('pager-test/query-parameters'); - $this->assertText(t('Pager calls: 0'), 'Initial call to pager shows 0 calls.'); + $this->assertText('Pager calls: 0', 'Initial call to pager shows 0 calls.'); $this->assertText('[url.query_args.pagers:0]=0.0'); $this->assertCacheContext('url.query_args'); // Go to last page, the count of pager calls need to go to 1. $elements = $this->xpath('//li[contains(@class, :class)]/a', [':class' => 'pager__item--last']); $elements[0]->click(); - $this->assertText(t('Pager calls: 1'), 'First link call to pager shows 1 calls.'); + $this->assertText('Pager calls: 1', 'First link call to pager shows 1 calls.'); $this->assertText('[url.query_args.pagers:0]=0.60'); $this->assertCacheContext('url.query_args'); @@ -102,7 +102,7 @@ public function testPagerQueryParametersAndCacheContext() { $elements[0]->click(); $elements = $this->xpath('//li[contains(@class, :class)]/a', [':class' => 'pager__item--first']); $elements[0]->click(); - $this->assertText(t('Pager calls: 2'), 'Second link call to pager shows 2 calls.'); + $this->assertText('Pager calls: 2', 'Second link call to pager shows 2 calls.'); $this->assertText('[url.query_args.pagers:0]=0.0'); $this->assertCacheContext('url.query_args'); } diff --git a/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php b/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php index 305beb5923..610ba40b9f 100644 --- a/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php +++ b/core/modules/system/tests/src/Functional/ServiceProvider/ServiceProviderWebTest.php @@ -36,7 +36,7 @@ public function testServiceProviderRegistrationIntegration() { // saying it has fired. This will fire on every page request so it should // show up on the front page. $this->drupalGet(''); - $this->assertText(t('The service_provider_test event subscriber fired!'), 'The service_provider_test event subscriber fired'); + $this->assertText('The service_provider_test event subscriber fired!', 'The service_provider_test event subscriber fired'); } } diff --git a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php index 125a9563e5..cdfebd96be 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionHttpsTest.php @@ -87,7 +87,7 @@ public function testHttpsSession() { // Verify that user is logged in on secure URL. $this->drupalGet($this->httpsUrl('admin/config')); - $this->assertText(t('Configuration')); + $this->assertText('Configuration'); $this->assertSession()->statusCodeEquals(200); // Verify that user is not logged in on non-secure URL. diff --git a/core/modules/system/tests/src/Functional/Session/SessionTest.php b/core/modules/system/tests/src/Functional/Session/SessionTest.php index b35a20cbae..d0e6ccaa01 100644 --- a/core/modules/system/tests/src/Functional/Session/SessionTest.php +++ b/core/modules/system/tests/src/Functional/Session/SessionTest.php @@ -202,7 +202,7 @@ public function testEmptyAnonymousSession() { $this->assertSessionEmpty(FALSE); // Verify that caching was bypassed. $this->assertSession()->responseHeaderDoesNotExist('X-Drupal-Cache'); - $this->assertText(t('This is a dummy message.'), 'Message was displayed.'); + $this->assertText('This is a dummy message.', 'Message was displayed.'); // Verify that session cookie was deleted. $this->assertSession()->responseHeaderMatches('Set-Cookie', '/SESS\w+=deleted/'); diff --git a/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php b/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php index e580893d08..4b7f8b332c 100644 --- a/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php +++ b/core/modules/system/tests/src/Functional/System/AccessDeniedTest.php @@ -51,7 +51,7 @@ protected function setUp(): void { public function testAccessDenied() { $this->drupalGet('admin'); - $this->assertText(t('Access denied'), 'Found the default 403 page'); + $this->assertText('Access denied', 'Found the default 403 page'); $this->assertSession()->statusCodeEquals(403); // Ensure that users without permission are denied access and have the @@ -86,7 +86,7 @@ public function testAccessDenied() { $this->drupalLogout(); $this->drupalGet('admin'); $this->assertText($this->adminUser->getAccountName(), 'Found the custom 403 page'); - $this->assertText(t('Username'), 'Blocks are shown on the custom 403 page'); + $this->assertText('Username', 'Blocks are shown on the custom 403 page'); // Log back in and remove the custom 403 page. $this->drupalLogin($this->adminUser); @@ -98,9 +98,9 @@ public function testAccessDenied() { // Logout and check that the user login block is shown on default 403 pages. $this->drupalLogout(); $this->drupalGet('admin'); - $this->assertText(t('Access denied'), 'Found the default 403 page'); + $this->assertText('Access denied', 'Found the default 403 page'); $this->assertSession()->statusCodeEquals(403); - $this->assertText(t('Username'), 'Blocks are shown on the default 403 page'); + $this->assertText('Username', 'Blocks are shown on the default 403 page'); // Log back in, set the custom 403 page to /user/login and remove the block $this->drupalLogin($this->adminUser); @@ -116,7 +116,7 @@ public function testAccessDenied() { $this->drupalPostForm('admin/config/system/site-information', $edit, t('Log in')); // Check that we're still on the same page. - $this->assertText(t('Basic site settings')); + $this->assertText('Basic site settings'); } /** diff --git a/core/modules/system/tests/src/Functional/System/CronRunTest.php b/core/modules/system/tests/src/Functional/System/CronRunTest.php index 3371422aff..29b24686ec 100644 --- a/core/modules/system/tests/src/Functional/System/CronRunTest.php +++ b/core/modules/system/tests/src/Functional/System/CronRunTest.php @@ -82,7 +82,7 @@ public function testAutomatedCron() { // Disable cron through the interface by setting the interval to zero. $this->drupalPostForm('admin/config/system/cron', ['interval' => 0], t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); $this->drupalLogout(); // Test if cron does not run when the cron interval is set to zero. @@ -145,7 +145,7 @@ public function testManualCron() { $this->drupalGet('admin/reports/status'); $this->clickLink(t('Run cron')); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Cron ran successfully.')); + $this->assertText('Cron ran successfully.'); } } diff --git a/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php b/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php index c23c728a20..7e1ad91f57 100644 --- a/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php +++ b/core/modules/system/tests/src/Functional/System/DateFormatsMachineNameTest.php @@ -38,7 +38,7 @@ public function testDateFormatsMachineNameAllowedValues() { 'date_format_pattern' => 'Y-m-d', ]; $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertText(t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'), 'It is not possible to create a date format with the machine name that has any character other than lowercase letters, digits or underscore.'); + $this->assertText('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".', 'It is not possible to create a date format with the machine name that has any character other than lowercase letters, digits or underscore.'); // Try to create a date format with the reserved machine name "custom". $edit = [ @@ -47,7 +47,7 @@ public function testDateFormatsMachineNameAllowedValues() { 'date_format_pattern' => 'Y-m-d', ]; $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertText(t('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".'), 'It is not possible to create a date format with the machine name "custom".'); + $this->assertText('The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".', 'It is not possible to create a date format with the machine name "custom".'); // Try to create a date format with a machine name, "fallback", that // already exists. @@ -57,7 +57,7 @@ public function testDateFormatsMachineNameAllowedValues() { 'date_format_pattern' => 'j/m/Y', ]; $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertText(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a date format with the machine name "fallback". It is a built-in format that already exists.'); + $this->assertText('The machine-readable name is already in use. It must be unique.', 'It is not possible to create a date format with the machine name "fallback". It is a built-in format that already exists.'); // Create a date format with a machine name distinct from the previous two. $id = mb_strtolower($this->randomMachineName(16)); @@ -67,7 +67,7 @@ public function testDateFormatsMachineNameAllowedValues() { 'date_format_pattern' => 'd/m/Y', ]; $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertText(t('Custom date format added.'), 'It is possible to create a date format with a new machine name.'); + $this->assertText('Custom date format added.', 'It is possible to create a date format with a new machine name.'); // Try to create a date format with same machine name as the previous one. $edit = [ @@ -76,7 +76,7 @@ public function testDateFormatsMachineNameAllowedValues() { 'date_format_pattern' => 'd-m-Y', ]; $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertText(t('The machine-readable name is already in use. It must be unique.'), 'It is not possible to create a new date format with an existing machine name.'); + $this->assertText('The machine-readable name is already in use. It must be unique.', 'It is not possible to create a new date format with an existing machine name.'); } } diff --git a/core/modules/system/tests/src/Functional/System/DateTimeTest.php b/core/modules/system/tests/src/Functional/System/DateTimeTest.php index 75dfd53453..98832d20f9 100644 --- a/core/modules/system/tests/src/Functional/System/DateTimeTest.php +++ b/core/modules/system/tests/src/Functional/System/DateTimeTest.php @@ -106,9 +106,9 @@ public function testDateFormatConfiguration() { $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); // Verify that the user is redirected to the correct page. $this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection')); - $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.'); + $this->assertText('Custom date format added.', 'Date format added confirmation message appears.'); $this->assertText($name, 'Custom date format appears in the date format list.'); - $this->assertText(t('Delete'), 'Delete link for custom date format appears.'); + $this->assertText('Delete', 'Delete link for custom date format appears.'); // Edit the custom date format and re-save without editing the format. $this->drupalGet('admin/config/regional/date-time'); @@ -116,7 +116,7 @@ public function testDateFormatConfiguration() { $this->drupalPostForm(NULL, [], t('Save format')); // Verify that the user is redirected to the correct page. $this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection')); - $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.'); + $this->assertText('Custom date format updated.', 'Custom date format successfully updated.'); // Edit custom date format. $this->drupalGet('admin/config/regional/date-time'); @@ -127,7 +127,7 @@ public function testDateFormatConfiguration() { $this->drupalPostForm($this->getUrl(), $edit, t('Save format')); // Verify that the user is redirected to the correct page. $this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection')); - $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.'); + $this->assertText('Custom date format updated.', 'Custom date format successfully updated.'); // Delete custom date format. $this->clickLink(t('Delete')); @@ -152,9 +152,9 @@ public function testDateFormatConfiguration() { $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); // Verify that the user is redirected to the correct page. $this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection')); - $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.'); + $this->assertText('Custom date format added.', 'Date format added confirmation message appears.'); $this->assertText($name, 'Custom date format appears in the date format list.'); - $this->assertText(t('Delete'), 'Delete link for custom date format appears.'); + $this->assertText('Delete', 'Delete link for custom date format appears.'); $date_format = DateFormat::create([ 'id' => 'xss_short', @@ -179,7 +179,7 @@ public function testDateFormatConfiguration() { $this->drupalPostForm('admin/config/regional/date-time/formats/add', $edit, t('Add format')); // Verify that the user is redirected to the correct page. $this->assertSession()->addressEquals(Url::fromRoute('entity.date_format.collection')); - $this->assertText(t('Custom date format added.'), 'Date format added confirmation message appears.'); + $this->assertText('Custom date format added.', 'Date format added confirmation message appears.'); $this->assertText($name, 'Custom date format appears in the date format list.'); $this->assertSession()->assertEscaped('' . date("Y") . ''); } @@ -201,7 +201,7 @@ public function testEnteringDateTimeViaSelectors() { 'field_name' => 'dt', ]; $this->drupalPostForm('admin/structure/types/manage/page_with_date/fields/add-field', $edit, t('Save and continue')); - $this->assertText(t('These settings apply to the'), 'New datetime field created, now configuring'); + $this->assertText('These settings apply to the', 'New datetime field created, now configuring'); $this->drupalGet('admin/structure/types/manage/page_with_date/fields/node.page_with_date.field_dt/storage'); $edit = [ @@ -237,14 +237,14 @@ public function testEnteringDateTimeViaSelectors() { 'field_dt[0][value][minute]' => '30', ]; $this->drupalPostForm('node/add/page_with_date', $edit, t('Save')); - $this->assertText(t('Selected combination of day and month is not valid.'), 'Incorrect date failed validation'); + $this->assertText('Selected combination of day and month is not valid.', 'Incorrect date failed validation'); $edit['field_dt[0][value][day]'] = '29'; $this->drupalPostForm('node/add/page_with_date', $edit, t('Save')); $this->assertNoText('Selected combination of day and month is not valid.', 'Correct date passed validation.'); $this->drupalGet('node/1'); - $this->assertText(t('Mon, 02/29/2016 - 01:30'), 'Node successfully created with valid date.'); + $this->assertText('Mon, 02/29/2016 - 01:30', 'Node successfully created with valid date.'); } } diff --git a/core/modules/system/tests/src/Functional/System/FrontPageTest.php b/core/modules/system/tests/src/Functional/System/FrontPageTest.php index 70447be632..9261eab3b9 100644 --- a/core/modules/system/tests/src/Functional/System/FrontPageTest.php +++ b/core/modules/system/tests/src/Functional/System/FrontPageTest.php @@ -61,16 +61,16 @@ public function testDrupalFrontPage() { $this->drupalGet(''); $this->assertSession()->titleEquals('Home | Drupal'); - $this->assertText(t('On front page.'), 'Path is the front page.'); + $this->assertText('On front page.', 'Path is the front page.'); $this->drupalGet('node'); - $this->assertText(t('On front page.'), 'Path is the front page.'); + $this->assertText('On front page.', 'Path is the front page.'); $this->drupalGet($this->nodePath); $this->assertNoText('On front page.', 'Path is not the front page.'); // Change the front page to an invalid path. $edit = ['site_frontpage' => '/kittens']; $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration')); - $this->assertText(t("Either the path '@path' is invalid or you do not have access to it.", ['@path' => $edit['site_frontpage']])); + $this->assertText("Either the path '" . $edit['site_frontpage'] . "' is invalid or you do not have access to it."); // Change the front page to a path without a starting slash. $edit = ['site_frontpage' => $this->nodePath]; @@ -80,14 +80,14 @@ public function testDrupalFrontPage() { // Change the front page to a valid path. $edit['site_frontpage'] = '/' . $this->nodePath; $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), 'The front page path has been saved.'); + $this->assertText('The configuration options have been saved.', 'The front page path has been saved.'); $this->drupalGet(''); - $this->assertText(t('On front page.'), 'Path is the front page.'); + $this->assertText('On front page.', 'Path is the front page.'); $this->drupalGet('node'); $this->assertNoText('On front page.', 'Path is not the front page.'); $this->drupalGet($this->nodePath); - $this->assertText(t('On front page.'), 'Path is the front page.'); + $this->assertText('On front page.', 'Path is the front page.'); } } diff --git a/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php b/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php index 949c094eb7..ca2dcf9cf2 100644 --- a/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php +++ b/core/modules/system/tests/src/Functional/System/MainContentFallbackTest.php @@ -50,7 +50,7 @@ public function testMainContentFallback() { $edit['uninstall[block]'] = 'block'; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPostForm(NULL, [], t('Uninstall')); - $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + $this->assertText('The selected modules have been uninstalled.', 'Modules status has been updated.'); $this->rebuildContainer(); $this->assertFalse(\Drupal::moduleHandler()->moduleExists('block'), 'Block module uninstall.'); @@ -60,7 +60,7 @@ public function testMainContentFallback() { $this->drupalGet('admin/config/system/site-information'); $this->assertSession()->fieldExists('site_name'); $this->drupalGet('system-test/main-content-fallback'); - $this->assertText(t('Content to test main content fallback'), 'Fallback to SimplePageVariant works for front-end theme.'); + $this->assertText('Content to test main content fallback', 'Fallback to SimplePageVariant works for front-end theme.'); // Request a user* page and see if it is displayed. $this->drupalLogin($this->webUser); $this->drupalGet('user/' . $this->webUser->id() . '/edit'); @@ -71,7 +71,7 @@ public function testMainContentFallback() { $edit = []; $edit['modules[block][enable]'] = 'block'; $this->drupalPostForm('admin/modules', $edit, t('Install')); - $this->assertText(t('Module Block has been enabled.'), 'Modules status has been updated.'); + $this->assertText('Module Block has been enabled.', 'Modules status has been updated.'); $this->rebuildContainer(); $this->assertTrue(\Drupal::moduleHandler()->moduleExists('block'), 'Block module re-enabled.'); } diff --git a/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php b/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php index 537b1ec717..e1b4fbf3da 100644 --- a/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php +++ b/core/modules/system/tests/src/Functional/System/PageNotFoundTest.php @@ -48,7 +48,7 @@ protected function setUp(): void { public function testPageNotFound() { $this->drupalLogin($this->adminUser); $this->drupalGet($this->randomMachineName(10)); - $this->assertText(t('Page not found'), 'Found the default 404 page'); + $this->assertText('Page not found', 'Found the default 404 page'); // Set a custom 404 page without a starting slash. $edit = [ diff --git a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php index 96d2768b2f..f4cba7d16b 100644 --- a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php +++ b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php @@ -128,7 +128,7 @@ public function testSiteMaintenance() { // Verify that custom site offline message is not displayed on user/password. $this->drupalGet('user/password'); - $this->assertText(t('Username or email address'), 'Anonymous users can access user/password'); + $this->assertText('Username or email address', 'Anonymous users can access user/password'); // Submit password reset form. $edit = [ diff --git a/core/modules/system/tests/src/Functional/System/StatusTest.php b/core/modules/system/tests/src/Functional/System/StatusTest.php index 5656c23700..4580496687 100644 --- a/core/modules/system/tests/src/Functional/System/StatusTest.php +++ b/core/modules/system/tests/src/Functional/System/StatusTest.php @@ -70,7 +70,7 @@ public function testStatusPage() { // update_test_postupdate_update_8001() needs to be executed. drupal_set_installed_schema_version('update_test_postupdate', 8000); $this->drupalGet('admin/reports/status'); - $this->assertText(t('Out of date')); + $this->assertText('Out of date'); // Now cleanup the executed post update functions. drupal_set_installed_schema_version('update_test_postupdate', 8001); @@ -78,7 +78,7 @@ public function testStatusPage() { $post_update_registry = \Drupal::service('update.post_update_registry'); $post_update_registry->filterOutInvokedUpdatesByModule('update_test_postupdate'); $this->drupalGet('admin/reports/status'); - $this->assertText(t('Out of date')); + $this->assertText('Out of date'); $this->drupalGet('admin/reports/status/php'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/system/tests/src/Functional/System/ThemeTest.php b/core/modules/system/tests/src/Functional/System/ThemeTest.php index 513b38efae..9c6b9ea381 100644 --- a/core/modules/system/tests/src/Functional/System/ThemeTest.php +++ b/core/modules/system/tests/src/Functional/System/ThemeTest.php @@ -386,9 +386,9 @@ public function testInvalidTheme() { // Clear the system_list() and theme listing cache to pick up the change. $this->container->get('theme_handler')->reset(); $this->drupalGet('admin/appearance'); - $this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', ['@base_theme' => 'not_real_test_basetheme'])); - $this->assertText(t('This theme requires the base theme @base_theme to operate correctly.', ['@base_theme' => 'test_invalid_basetheme'])); - $this->assertText(t('This theme requires the theme engine @theme_engine to operate correctly.', ['@theme_engine' => 'not_real_engine'])); + $this->assertText('This theme requires the base theme not_real_test_basetheme to operate correctly.'); + $this->assertText('This theme requires the base theme test_invalid_basetheme to operate correctly.'); + $this->assertText('This theme requires the theme engine not_real_engine to operate correctly.'); // Check for the error text of a theme with the wrong core version // using 7.x and ^7. $incompatible_core_message = 'This theme is not compatible with Drupal ' . \Drupal::VERSION . ". Check that the .info.yml file contains a compatible 'core' or 'core_version_requirement' value."; diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php index ad372d3b0b..f3ac0ee5b0 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/InvalidUpdateHookTest.php @@ -61,7 +61,7 @@ public function testInvalidUpdateHook() { $this->drupalGet($this->updateUrl); $this->updateRequirementsProblem(); $this->clickLink(t('Continue')); - $this->assertText(t('Some of the pending updates cannot be applied because their dependencies were not met.')); + $this->assertText('Some of the pending updates cannot be applied because their dependencies were not met.'); } } diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php index 7db2827f65..b87ce892b9 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php @@ -130,9 +130,9 @@ public function testRequirements() { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->updateRequirementsProblem(); $this->clickLink(t('Continue')); - $this->assertText(t('No pending updates.'), 'End of update process was reached.'); + $this->assertText('No pending updates.', 'End of update process was reached.'); // Confirm that all caches were cleared. - $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared when there were no requirements warnings or errors.'); + $this->assertText('hook_cache_flush() invoked for update_script_test.module.', 'Caches were cleared when there were no requirements warnings or errors.'); // If there is a requirements warning, we expect it to be initially // displayed, but clicking the link to proceed should allow us to go @@ -150,9 +150,9 @@ public function testRequirements() { $this->clickLink(t('Continue')); $this->clickLink(t('Apply pending updates')); $this->checkForMetaRefresh(); - $this->assertText(t('The update_script_test_update_8001() update was executed successfully.'), 'End of update process was reached.'); + $this->assertText('The update_script_test_update_8001() update was executed successfully.', 'End of update process was reached.'); // Confirm that all caches were cleared. - $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after resolving a requirements warning and applying updates.'); + $this->assertText('hook_cache_flush() invoked for update_script_test.module.', 'Caches were cleared after resolving a requirements warning and applying updates.'); // Now try again without pending updates to make sure that works too. $this->drupalGet($this->updateUrl, ['external' => TRUE]); @@ -160,9 +160,9 @@ public function testRequirements() { $this->clickLink('try again'); $this->assertNoText('This is a requirements warning provided by the update_script_test module.'); $this->clickLink(t('Continue')); - $this->assertText(t('No pending updates.'), 'End of update process was reached.'); + $this->assertText('No pending updates.', 'End of update process was reached.'); // Confirm that all caches were cleared. - $this->assertText(t('hook_cache_flush() invoked for update_script_test.module.'), 'Caches were cleared after applying updates and re-running the script.'); + $this->assertText('hook_cache_flush() invoked for update_script_test.module.', 'Caches were cleared after applying updates and re-running the script.'); // If there is a requirements error, it should be displayed even after // clicking the link to proceed (since the problem that triggered the error @@ -518,7 +518,7 @@ public function testNoUpdateFunctionality() { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->updateRequirementsProblem(); $this->clickLink(t('Continue')); - $this->assertText(t('No pending updates.')); + $this->assertText('No pending updates.'); $this->assertSession()->linkNotExists('Administration pages'); $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php'])); $this->clickLink('Front page'); @@ -533,7 +533,7 @@ public function testNoUpdateFunctionality() { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->updateRequirementsProblem(); $this->clickLink(t('Continue')); - $this->assertText(t('No pending updates.')); + $this->assertText('No pending updates.'); $this->assertSession()->linkExists('Administration pages'); $this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [':href' => 'update.php'])); $this->clickLink('Administration pages'); diff --git a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php index 0934d88fa4..2ecebc6641 100644 --- a/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php +++ b/core/modules/system/tests/src/Functional/UpdateSystem/UpdatesWith7xTest.php @@ -62,7 +62,7 @@ public function testWith7x() { $this->drupalGet($this->updateUrl, ['external' => TRUE]); $this->updateRequirementsProblem(); $this->clickLink(t('Continue')); - $this->assertText(t('Some of the pending updates cannot be applied because their dependencies were not met.')); + $this->assertText('Some of the pending updates cannot be applied because their dependencies were not met.'); } } diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php index bce13935a5..83bbf9b444 100644 --- a/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyImageTest.php @@ -96,7 +96,7 @@ public function testTaxonomyImageAccess() { $this->drupalPostForm(NULL, ['field_test[0][alt]' => $this->randomMachineName()], t('Save')); $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $edit['name[0][value]']]); $term = reset($terms); - $this->assertText(t('Created new term @name.', ['@name' => $term->getName()])); + $this->assertText('Created new term ' . $term->getName() . '.'); // Create a user that should have access to the file and one that doesn't. $access_user = $this->drupalCreateUser(['access content']); diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php index 578779f29d..1e1849d9e9 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -276,7 +276,7 @@ public function testNodeTermCreationAndDeletion() { // Save, creating the terms. $this->drupalPostForm('node/add/article', $edit, t('Save')); - $this->assertText(t('@type @title has been created.', ['@type' => t('Article'), '@title' => $edit['title[0][value]']]), 'The node was created successfully.'); + $this->assertText('Article ' . $edit['title[0][value]'] . ' has been created.', 'The node was created successfully.'); // Verify that the creation message contains a link to a node. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "node/")]'); diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php index b766418209..502adcec87 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php @@ -243,7 +243,7 @@ public function testVocabularyPermissionsTaxonomyTerm() { $edit['name[0][value]'] = $this->randomMachineName(); $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('Created new term @name.', ['@name' => $edit['name[0][value]']]), 'Term created successfully.'); + $this->assertText('Created new term ' . $edit['name[0][value]'] . '.', 'Term created successfully.'); // Verify that the creation message contains a link to a term. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "term/")]'); @@ -260,7 +260,7 @@ public function testVocabularyPermissionsTaxonomyTerm() { $edit['name[0][value]'] = $this->randomMachineName(); $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('Updated term @name.', ['@name' => $edit['name[0][value]']]), 'Term updated successfully.'); + $this->assertText('Updated term ' . $edit['name[0][value]'] . '.', 'Term updated successfully.'); // Delete the vocabulary. $this->drupalGet('taxonomy/term/' . $term->id() . '/delete'); @@ -317,7 +317,7 @@ public function testVocabularyPermissionsTaxonomyTerm() { $edit['name[0][value]'] = $this->randomMachineName(); $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('Updated term @name.', ['@name' => $edit['name[0][value]']]), 'Term updated successfully.'); + $this->assertText('Updated term ' . $edit['name[0][value]'] . '.', 'Term updated successfully.'); // Verify that the update message contains a link to a term. $this->assertSession()->elementExists('xpath', '//div[@data-drupal-messages]//a[contains(@href, "term/")]'); diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php index b93172e8d0..9789844552 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php @@ -66,12 +66,12 @@ public function testVocabularyInterface() { // Try to submit a vocabulary with a duplicate machine name. $edit['vid'] = $vid; $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save')); - $this->assertText(t('The machine-readable name is already in use. It must be unique.')); + $this->assertText('The machine-readable name is already in use. It must be unique.'); // Try to submit an invalid machine name. $edit['vid'] = '!&^%'; $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save')); - $this->assertText(t('The machine-readable name must contain only lowercase letters, numbers, and underscores.')); + $this->assertText('The machine-readable name must contain only lowercase letters, numbers, and underscores.'); // Ensure that vocabulary titles are escaped properly. $edit = []; @@ -126,7 +126,7 @@ public function testTaxonomyAdminNoVocabularies() { $this->assertEmpty(Vocabulary::loadMultiple(), 'No vocabularies found.'); $this->drupalGet('admin/structure/taxonomy'); // Check the default message for no vocabularies. - $this->assertText(t('No vocabularies available.')); + $this->assertText('No vocabularies available.'); } /** @@ -140,7 +140,7 @@ public function testTaxonomyAdminDeletingVocabulary() { 'vid' => $vid, ]; $this->drupalPostForm('admin/structure/taxonomy/add', $edit, t('Save')); - $this->assertText(t('Created new vocabulary'), 'New vocabulary was created.'); + $this->assertText('Created new vocabulary', 'New vocabulary was created.'); // Check the created vocabulary. $this->container->get('entity_type.manager')->getStorage('taxonomy_vocabulary')->resetCache(); @@ -150,8 +150,8 @@ public function testTaxonomyAdminDeletingVocabulary() { // Delete the vocabulary. $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id()); $this->clickLink(t('Delete')); - $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', ['%name' => $vocabulary->label()])); - $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), '[confirm deletion] Inform that all terms will be deleted.'); + $this->assertRaw('Are you sure you want to delete the vocabulary %name?', ['%name' => $vocabulary->label()])); + $this->assertText('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.', '[confirm deletion] Inform that all terms will be deleted.'); // Confirm deletion. $this->drupalPostForm(NULL, [], t('Delete')); diff --git a/core/modules/text/tests/src/Functional/TextFieldTest.php b/core/modules/text/tests/src/Functional/TextFieldTest.php index 1dbd9d82ff..78cfb7a777 100644 --- a/core/modules/text/tests/src/Functional/TextFieldTest.php +++ b/core/modules/text/tests/src/Functional/TextFieldTest.php @@ -207,7 +207,7 @@ public function _testTextfieldWidgetsFormatted($field_type, $widget_type) { $this->drupalPostForm(NULL, $edit, t('Save')); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertText(t('entity_test @id has been created.', ['@id' => $id]), 'Entity was created'); + $this->assertText('entity_test ' . $id . ' has been created.', 'Entity was created'); // Display the entity. $entity = EntityTest::load($id); @@ -245,7 +245,7 @@ public function _testTextfieldWidgetsFormatted($field_type, $widget_type) { "{$field_name}[0][format]" => $format_id, ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('entity_test @id has been updated.', ['@id' => $id]), 'Entity was updated'); + $this->assertText('entity_test ' . $id . ' has been updated.', 'Entity was updated'); // Display the entity. $this->container->get('entity_type.manager')->getStorage('entity_test')->resetCache([$id]); diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php index 3a679fc0fe..dd5ecd3b29 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php @@ -199,7 +199,7 @@ public function testUserRoleUpdateSubtreesHashCacheClear() { // Assign the role to the user. $this->drupalPostForm('user/' . $this->adminUser->id() . '/edit', ["roles[$rid]" => $rid], t('Save')); - $this->assertText(t('The changes have been saved.')); + $this->assertText('The changes have been saved.'); // Assert that the subtrees hash has been altered because the subtrees // structure changed. @@ -240,7 +240,7 @@ public function testNonCurrentUserAccountUpdates() { // Assign the role to the user. $this->drupalPostForm('user/' . $admin_user_id . '/edit', ["roles[$rid]" => $rid], t('Save')); - $this->assertText(t('The changes have been saved.')); + $this->assertText('The changes have been saved.'); // Log in adminUser and assert that the subtrees hash has changed. $this->drupalLogin($this->adminUser); @@ -287,7 +287,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() { // Reset locale cache. $this->container->get('string_translation')->reset(); $this->assertRaw('"edit-languages-' . $langcode . '-weight"'); - $this->assertText(t($name), 'Test language added.'); + $this->assertText($name, 'Test language added.'); // Have the adminUser request a page in the new language. $this->drupalGet($langcode . '/test-page'); @@ -321,7 +321,7 @@ public function testLocaleTranslationSubtreesHashCacheClear() { $lid => $translation, ]; $this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations')); - $this->assertText(t('The strings have been saved.'), 'The strings have been saved.'); + $this->assertText('The strings have been saved.', 'The strings have been saved.'); // Verify that the user is redirected to the correct page. $this->assertSession()->addressEquals(Url::fromRoute('locale.translate_page')); $this->drupalLogout(); diff --git a/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php index 6494bc850f..da9b64e443 100644 --- a/core/modules/tracker/tests/src/Functional/TrackerTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php @@ -446,7 +446,7 @@ public function testTrackerAdminUnpublish() { $this->drupalPostForm('admin/content', $edit, t('Apply to selected items')); $this->drupalGet('activity'); - $this->assertText(t('No content available.'), 'A node is displayed on the tracker listing pages.'); + $this->assertText('No content available.', 'A node is displayed on the tracker listing pages.'); } /** diff --git a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php index 754d0b41ae..8b6d2c0f90 100644 --- a/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php +++ b/core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php @@ -63,7 +63,7 @@ public function testViaAuthorize($url) { 'connection_settings[system_test][update_test_username]' => $this->randomMachineName(), ]; $this->drupalPostForm(NULL, $edit, t('Continue')); - $this->assertText(t('Installation was completed successfully.')); + $this->assertText('Installation was completed successfully.'); // Ensure the module is available to install. $this->drupalGet('admin/modules'); diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php index bbd858b896..ffbe6797c3 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -70,10 +70,10 @@ public function testNoReleasesAvailable() { // 'No available releases found' string. $this->assertRaw('

' . t('Drupal core') . '

'); $this->assertRaw(Link::fromTextAndUrl(t('Drupal'), Url::fromUri('http://example.com/project/drupal'))->toString()); - $this->assertText(t('Up to date')); + $this->assertText('Up to date'); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText('Update available'); - $this->assertText(t('No available releases found')); + $this->assertText('No available releases found'); $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); $available = update_get_available(); @@ -103,7 +103,7 @@ public function testUpdateContribBasic() { ] ); $this->standardTests(); - $this->assertText(t('Up to date')); + $this->assertText('Up to date'); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText('Update available'); $this->assertRaw($project_link); @@ -181,13 +181,13 @@ public function testUpdateContribOrder() { $this->refreshUpdateStatus(['drupal' => '0.0', '#all' => '1_0']); $this->standardTests(); // We're expecting the report to say all projects are up to date. - $this->assertText(t('Up to date')); + $this->assertText('Up to date'); $this->assertNoText('Update available'); // We want to see all 3 module names listed, since they'll show up either // as project names or as modules under the "Includes" listing. - $this->assertText(t('AAA Update test')); - $this->assertText(t('BBB Update test')); - $this->assertText(t('CCC Update test')); + $this->assertText('AAA Update test'); + $this->assertText('BBB Update test'); + $this->assertText('CCC Update test'); // We want aaa_update_test included in the ccc_update_test project, not as // its own project on the report. $this->assertNoRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); @@ -239,7 +239,7 @@ public function testUpdateBaseThemeSecurityUpdate() { 'update_test_basetheme' => '1_1-sec', ]; $this->refreshUpdateStatus($xml_mapping); - $this->assertText(t('Security update required!')); + $this->assertText('Security update required!'); $this->assertRaw(Link::fromTextAndUrl(t('Update test base theme'), Url::fromUri('http://example.com/project/update_test_basetheme'))->toString()); } @@ -395,7 +395,7 @@ public function testUpdateShowDisabledThemes() { // themes. $this->assertNoText('Themes'); if ($check_disabled) { - $this->assertText(t('Uninstalled themes')); + $this->assertText('Uninstalled themes'); $this->assertRaw($base_theme_project_link); $this->assertRaw($sub_theme_project_link); } @@ -475,7 +475,7 @@ public function testUpdateBrokenFetchURL() { ]; $this->refreshUpdateStatus($xml_mapping); - $this->assertText(t('Up to date')); + $this->assertText('Up to date'); // We're expecting the report to say most projects are up to date, so we // hope that 'Up to date' is not unique. $this->assertSession()->pageTextMatchesCount(3, '/Up to date/'); @@ -538,7 +538,7 @@ public function testHookUpdateStatusAlter() { ); $this->drupalGet('admin/reports/updates'); $this->assertRaw('

' . t('Modules') . '

'); - $this->assertText(t('Security update required!')); + $this->assertText('Security update required!'); $this->assertRaw(Link::fromTextAndUrl(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'))->toString()); // Visit the reports page again without the altering and make sure the @@ -552,7 +552,7 @@ public function testHookUpdateStatusAlter() { // Turn the altering back on and visit the Update manager UI. $update_test_config->set('update_status', $update_status)->save(); $this->drupalGet('admin/modules/update'); - $this->assertText(t('Security update')); + $this->assertText('Security update'); // Turn the altering back off and visit the Update manager UI. $update_test_config->set('update_status', [])->save(); diff --git a/core/modules/update/tests/src/Functional/UpdateCoreTest.php b/core/modules/update/tests/src/Functional/UpdateCoreTest.php index 63a5b603a5..06dd74c4d8 100644 --- a/core/modules/update/tests/src/Functional/UpdateCoreTest.php +++ b/core/modules/update/tests/src/Functional/UpdateCoreTest.php @@ -85,7 +85,7 @@ public function testNoUpdatesAvailable() { // release but because '8.2.0' is not in a supported branch it will // not be in the available updates. $this->assertNoRaw('8.2.0'); - $this->assertText(t('Up to date')); + $this->assertText('Up to date'); $this->assertNoText('Update available'); $this->assertNoText('Security update required!'); $this->assertRaw('check.svg'); @@ -123,7 +123,7 @@ public function testNormalUpdateAvailable() { // A stable release is the latest. if ($extra_version == '') { $this->assertNoText('Up to date'); - $this->assertText(t('Update available')); + $this->assertText('Update available'); $this->assertVersionUpdateLinks('Recommended version:', $full_version); $this->assertNoText('Latest version:'); $this->assertRaw('warning.svg'); @@ -131,7 +131,7 @@ public function testNormalUpdateAvailable() { // Only unstable releases are available. // An unstable release is the latest. else { - $this->assertText(t('Up to date')); + $this->assertText('Up to date'); $this->assertNoText('Update available'); $this->assertNoText('Recommended version:'); $this->assertVersionUpdateLinks('Latest version:', $full_version); @@ -144,7 +144,7 @@ public function testNormalUpdateAvailable() { // A stable release is the latest. if ($extra_version == '') { $this->assertNoText('Up to date'); - $this->assertText(t('Update available')); + $this->assertText('Update available'); $this->assertVersionUpdateLinks('Recommended version:', $full_version); $this->assertNoText('Latest version:'); $this->assertRaw('warning.svg'); @@ -153,7 +153,7 @@ public function testNormalUpdateAvailable() { // An unstable release is the latest. else { $this->assertNoText('Up to date'); - $this->assertText(t('Update available')); + $this->assertText('Update available'); $this->assertVersionUpdateLinks('Recommended version:', '8.1.0'); $this->assertVersionUpdateLinks('Latest version:', $full_version); $this->assertRaw('warning.svg'); @@ -182,8 +182,8 @@ public function testMajorUpdateAvailable() { $this->assertRaw(Link::fromTextAndUrl(t('Download'), Url::fromUri("http://example.com/drupal-9-0-0.tar.gz"))->toString()); $this->assertRaw(Link::fromTextAndUrl(t('Release notes'), Url::fromUri("http://example.com/drupal-9-0-0-release"))->toString()); $this->assertNoText('Up to date'); - $this->assertText(t('Not supported!')); - $this->assertText(t('Recommended version:')); + $this->assertText('Not supported!'); + $this->assertText('Recommended version:'); $this->assertNoText('Latest version:'); $this->assertRaw('error.svg'); } @@ -637,7 +637,7 @@ public function testDatestampMismatch() { $this->config('update_test.settings')->set('system_info', $system_info)->save(); $this->refreshUpdateStatus(['drupal' => 'dev']); $this->assertNoText('2001-Sep-'); - $this->assertText(t('Up to date')); + $this->assertText('Up to date'); $this->assertNoText('Update available'); $this->assertNoText('Security update required!'); } @@ -692,7 +692,7 @@ public function testModulePageUpToDate() { $this->drupalGet('admin/reports/updates'); $this->clickLink(t('Check manually')); $this->checkForMetaRefresh(); - $this->assertText(t('Checked available update data for one project.')); + $this->assertText('Checked available update data for one project.'); $this->drupalGet('admin/modules'); $this->assertNoText('There are updates available for your version of Drupal.'); $this->assertNoText('There is a security update available for your version of Drupal.'); @@ -714,9 +714,9 @@ public function testModulePageRegularUpdate() { $this->drupalGet('admin/reports/updates'); $this->clickLink(t('Check manually')); $this->checkForMetaRefresh(); - $this->assertText(t('Checked available update data for one project.')); + $this->assertText('Checked available update data for one project.'); $this->drupalGet('admin/modules'); - $this->assertText(t('There are updates available for your version of Drupal.')); + $this->assertText('There are updates available for your version of Drupal.'); $this->assertNoText('There is a security update available for your version of Drupal.'); } @@ -736,15 +736,15 @@ public function testModulePageSecurityUpdate() { $this->drupalGet('admin/reports/updates'); $this->clickLink(t('Check manually')); $this->checkForMetaRefresh(); - $this->assertText(t('Checked available update data for one project.')); + $this->assertText('Checked available update data for one project.'); $this->drupalGet('admin/modules'); $this->assertNoText('There are updates available for your version of Drupal.'); - $this->assertText(t('There is a security update available for your version of Drupal.')); + $this->assertText('There is a security update available for your version of Drupal.'); // Make sure admin/appearance warns you you're missing a security update. $this->drupalGet('admin/appearance'); $this->assertNoText('There are updates available for your version of Drupal.'); - $this->assertText(t('There is a security update available for your version of Drupal.')); + $this->assertText('There is a security update available for your version of Drupal.'); // Make sure duplicate messages don't appear on Update status pages. $this->drupalGet('admin/reports/status'); @@ -811,7 +811,7 @@ public function testLanguageModuleUpdate() { ->save(); $this->drupalGet('admin/reports/updates'); - $this->assertText(t('Language')); + $this->assertText('Language'); } /** diff --git a/core/modules/update/tests/src/Functional/UpdateUploadTest.php b/core/modules/update/tests/src/Functional/UpdateUploadTest.php index b4c984f0a5..f30127cfe7 100644 --- a/core/modules/update/tests/src/Functional/UpdateUploadTest.php +++ b/core/modules/update/tests/src/Functional/UpdateUploadTest.php @@ -70,7 +70,7 @@ public function testUploadModule() { 'files[project_upload]' => $validArchiveFile, ]; $this->drupalPostForm('admin/modules/install', $edit, t('Install')); - $this->assertText(t('@module_name is already installed.', ['@module_name' => 'AAA Update test']), 'Existing module was extracted and not reinstalled.'); + $this->assertText('AAA Update test is already installed.', 'Existing module was extracted and not reinstalled.'); $this->assertSession()->addressEquals('admin/modules/install'); // Ensure that a new module can be extracted and installed. @@ -132,7 +132,7 @@ public function testUploadModule() { // Run the updates for the new module. $this->drupalPostForm('admin/reports/updates/update', ['projects[update_test_new_module]' => TRUE], t('Download these updates')); $this->drupalPostForm(NULL, ['maintenance_mode' => FALSE], t('Continue')); - $this->assertText(t('Update was completed successfully.')); + $this->assertText('Update was completed successfully.'); $this->assertRaw(t('Installed %project_name successfully', ['%project_name' => 'update_test_new_module'])); // Parse the info file again to check that the module has been updated to diff --git a/core/modules/user/tests/src/Functional/UserBlocksTest.php b/core/modules/user/tests/src/Functional/UserBlocksTest.php index 9e8e0c3b8f..69d47d0c8c 100644 --- a/core/modules/user/tests/src/Functional/UserBlocksTest.php +++ b/core/modules/user/tests/src/Functional/UserBlocksTest.php @@ -125,7 +125,7 @@ public function testUserLoginBlock() { $edit['name'] = 'foo'; $edit['pass'] = 'invalid password'; $this->drupalPostForm('filter/tips', $edit, t('Log in')); - $this->assertText(t('Unrecognized username or password. Forgot your password?')); + $this->assertText('Unrecognized username or password. Forgot your password?'); $this->drupalGet('filter/tips'); $this->assertNoText('Unrecognized username or password. Forgot your password?'); } diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php index da42078599..1f85c7d96d 100644 --- a/core/modules/user/tests/src/Functional/UserCancelTest.php +++ b/core/modules/user/tests/src/Functional/UserCancelTest.php @@ -143,12 +143,12 @@ public function testUserCancelInvalid() { // Confirm account cancellation. $timestamp = time(); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.'); + $this->assertText('A confirmation request to cancel your account has been sent to your email address.', 'Account cancellation request mailed message displayed.'); // Attempt bogus account cancellation request confirmation. $bogus_timestamp = $timestamp + 60; $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account, $bogus_timestamp)); - $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Bogus cancelling request rejected.'); + $this->assertText('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.', 'Bogus cancelling request rejected.'); $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); $this->assertTrue($account->isActive(), 'User account was not canceled.'); @@ -156,7 +156,7 @@ public function testUserCancelInvalid() { // Attempt expired account cancellation request confirmation. $bogus_timestamp = $timestamp - 86400 - 60; $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account, $bogus_timestamp)); - $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Expired cancel account request rejected.'); + $this->assertText('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.', 'Expired cancel account request rejected.'); $user_storage->resetCache([$account->id()]); $account = $user_storage->load($account->id()); $this->assertTrue($account->isActive(), 'User account was not canceled.'); @@ -185,15 +185,15 @@ public function testUserBlock() { // Attempt to cancel account. $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.'); - $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your username.'), 'Informs that all content will be remain as is.'); + $this->assertText('Are you sure you want to cancel your account?', 'Confirmation form to cancel account displayed.'); + $this->assertText('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your username.', 'Informs that all content will be remain as is.'); $this->assertNoText('Select the method to cancel the account above.', 'Does not allow user to select account cancellation method.'); // Confirm account cancellation. $timestamp = time(); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.'); + $this->assertText('A confirmation request to cancel your account has been sent to your email address.', 'Account cancellation request mailed message displayed.'); // Confirm account cancellation request. $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp)); @@ -245,13 +245,13 @@ public function testUserBlockUnpublish() { // Attempt to cancel account. $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.'); - $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), 'Informs that all content will be unpublished.'); + $this->assertText('Are you sure you want to cancel your account?', 'Confirmation form to cancel account displayed.'); + $this->assertText('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.', 'Informs that all content will be unpublished.'); // Confirm account cancellation. $timestamp = time(); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.'); + $this->assertText('A confirmation request to cancel your account has been sent to your email address.', 'Account cancellation request mailed message displayed.'); // Confirm account cancellation request. $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp)); @@ -325,13 +325,13 @@ public function testUserAnonymize() { // Attempt to cancel account. $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.'); + $this->assertText('Are you sure you want to cancel your account?', 'Confirmation form to cancel account displayed.'); $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')])); // Confirm account cancellation. $timestamp = time(); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.'); + $this->assertText('A confirmation request to cancel your account has been sent to your email address.', 'Account cancellation request mailed message displayed.'); // Confirm account cancellation request. $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp)); @@ -385,13 +385,13 @@ public function testUserAnonymizeBatch() { // Attempt to cancel account. $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.'); + $this->assertText('Are you sure you want to cancel your account?', 'Confirmation form to cancel account displayed.'); $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', ['%anonymous-name' => $this->config('user.settings')->get('anonymous')])); // Confirm account cancellation. $timestamp = time(); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.'); + $this->assertText('A confirmation request to cancel your account has been sent to your email address.', 'Account cancellation request mailed message displayed.'); // Confirm account cancellation request. $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp)); @@ -438,7 +438,7 @@ public function testUserDelete() { $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $edit, t('Preview')); $this->drupalPostForm(NULL, [], t('Save')); - $this->assertText(t('Your comment has been posted.')); + $this->assertText('Your comment has been posted.'); $comments = \Drupal::entityTypeManager()->getStorage('comment')->loadByProperties(['subject' => $edit['subject[0][value]']]); $comment = reset($comments); $this->assertNotEmpty($comment->id(), 'Comment found.'); @@ -456,13 +456,13 @@ public function testUserDelete() { // Attempt to cancel account. $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.'); - $this->assertText(t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), 'Informs that all content will be deleted.'); + $this->assertText('Are you sure you want to cancel your account?', 'Confirmation form to cancel account displayed.'); + $this->assertText('Your account will be removed and all account information deleted. All of your content will also be deleted.', 'Informs that all content will be deleted.'); // Confirm account cancellation. $timestamp = time(); $this->drupalPostForm(NULL, [], t('Cancel account')); - $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.'); + $this->assertText('A confirmation request to cancel your account has been sent to your email address.', 'Account cancellation request mailed message displayed.'); // Confirm account cancellation request. $this->drupalGet("user/" . $account->id() . "/cancel/confirm/$timestamp/" . user_pass_rehash($account, $timestamp)); @@ -499,7 +499,7 @@ public function testUserCancelByAdmin() { $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, [], t('Cancel account')); $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()])); - $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.'); + $this->assertText('Select the method to cancel the account above.', 'Allows to select account cancellation method.'); // Confirm deletion. $this->drupalPostForm(NULL, [], t('Cancel account')); @@ -527,7 +527,7 @@ public function testUserWithoutEmailCancelByAdmin() { $this->drupalGet('user/' . $account->id() . '/edit'); $this->drupalPostForm(NULL, [], t('Cancel account')); $this->assertRaw(t('Are you sure you want to cancel the account %name?', ['%name' => $account->getAccountName()])); - $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.'); + $this->assertText('Select the method to cancel the account above.', 'Allows to select account cancellation method.'); // Confirm deletion. $this->drupalPostForm(NULL, [], t('Cancel account')); @@ -563,10 +563,10 @@ public function testMassUserCancelByAdmin() { $edit['user_bulk_form[' . $i . ']'] = TRUE; } $this->drupalPostForm('admin/people', $edit, t('Apply to selected items')); - $this->assertText(t('Are you sure you want to cancel these user accounts?'), 'Confirmation form to cancel accounts displayed.'); - $this->assertText(t('When cancelling these accounts'), 'Allows to select account cancellation method.'); - $this->assertText(t('Require email confirmation to cancel account'), 'Allows to send confirmation mail.'); - $this->assertText(t('Notify user when account is canceled'), 'Allows to send notification mail.'); + $this->assertText('Are you sure you want to cancel these user accounts?', 'Confirmation form to cancel accounts displayed.'); + $this->assertText('When cancelling these accounts', 'Allows to select account cancellation method.'); + $this->assertText('Require email confirmation to cancel account', 'Allows to send confirmation mail.'); + $this->assertText('Notify user when account is canceled', 'Allows to send notification mail.'); // Confirm deletion. $this->drupalPostForm(NULL, [], t('Cancel accounts')); @@ -579,7 +579,7 @@ public function testMassUserCancelByAdmin() { $this->assertTrue($status, 'Users deleted and not found in the database.'); // Ensure that admin account was not cancelled. - $this->assertText(t('A confirmation request to cancel your account has been sent to your email address.'), 'Account cancellation request mailed message displayed.'); + $this->assertText('A confirmation request to cancel your account has been sent to your email address.', 'Account cancellation request mailed message displayed.'); $admin_user = $user_storage->load($admin_user->id()); $this->assertTrue($admin_user->isActive(), 'Administrative user is found in the database and enabled.'); diff --git a/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php b/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php index 6e6d0ce56a..c67b578f28 100644 --- a/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php +++ b/core/modules/user/tests/src/Functional/UserCreateFailMailTest.php @@ -43,7 +43,7 @@ public function testUserAdd() { ]; $this->drupalPostForm('admin/people/create', $edit, t('Create new account')); - $this->assertText(t('Unable to send email. Contact the site administrator if the problem persists.')); + $this->assertText('Unable to send email. Contact the site administrator if the problem persists.'); $this->assertNoText('A welcome message with further instructions has been emailed to the new user ' . $edit['name'] . '.'); } diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php index f9037d9aed..d2b7720d4d 100644 --- a/core/modules/user/tests/src/Functional/UserCreateTest.php +++ b/core/modules/user/tests/src/Functional/UserCreateTest.php @@ -108,11 +108,11 @@ public function testUserAdd() { $this->drupalPostForm('admin/people/create', $edit, t('Create new account')); if ($notify) { - $this->assertText(t('A welcome message with further instructions has been emailed to the new user @name.', ['@name' => $edit['name']]), 'User created'); + $this->assertText('A welcome message with further instructions has been emailed to the new user ' . $edit['name'] . '.', 'User created'); $this->assertCount(1, $this->drupalGetMails(), 'Notification email sent'); } else { - $this->assertText(t('Created a new user account for @name. No email has been sent.', ['@name' => $edit['name']]), 'User created'); + $this->assertText('Created a new user account for ' . $edit['name'] . '. No email has been sent.', 'User created'); $this->assertCount(0, $this->drupalGetMails(), 'Notification email not sent'); } diff --git a/core/modules/user/tests/src/Functional/UserEditTest.php b/core/modules/user/tests/src/Functional/UserEditTest.php index b2e32f1ac2..b90db34c65 100644 --- a/core/modules/user/tests/src/Functional/UserEditTest.php +++ b/core/modules/user/tests/src/Functional/UserEditTest.php @@ -49,12 +49,12 @@ public function testUserEdit() { $edit['pass[pass1]'] = ''; $edit['pass[pass2]'] = $this->randomMachineName(); $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save')); - $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.'); + $this->assertText("The specified passwords do not match.", 'Typing mismatched passwords displays an error message.'); $edit['pass[pass1]'] = $this->randomMachineName(); $edit['pass[pass2]'] = ''; $this->drupalPostForm("user/" . $user1->id() . "/edit", $edit, t('Save')); - $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.'); + $this->assertText("The specified passwords do not match.", 'Typing mismatched passwords displays an error message.'); // Test that the error message appears when attempting to change the mail or // pass without the current password. @@ -111,13 +111,13 @@ public function testUserEdit() { $edit = ['status' => 0]; $this->drupalPostForm('user/' . $user1->id() . '/edit', $edit, t('Save')); - $this->assertText(t('The changes have been saved.')); + $this->assertText('The changes have been saved.'); $this->assertSession()->checkboxChecked('edit-status-0'); $this->assertSession()->checkboxNotChecked('edit-status-1'); $edit = ['status' => 1]; $this->drupalPostForm('user/' . $user1->id() . '/edit', $edit, t('Save')); - $this->assertText(t('The changes have been saved.')); + $this->assertText('The changes have been saved.'); $this->assertSession()->checkboxNotChecked('edit-status-0'); $this->assertSession()->checkboxChecked('edit-status-1'); } diff --git a/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php b/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php index 5f3d065de0..2598f2a3e1 100644 --- a/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php +++ b/core/modules/user/tests/src/Functional/UserLanguageCreationTest.php @@ -46,7 +46,7 @@ public function testLocalUserCreation() { 'language_interface[enabled][language-url]' => TRUE, ]; $this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings')); - $this->assertText(t('Language detection configuration saved.'), 'Set language negotiation.'); + $this->assertText('Language detection configuration saved.', 'Set language negotiation.'); // Check if the language selector is available on admin/people/create and // set to the currently active language. diff --git a/core/modules/user/tests/src/Functional/UserLanguageTest.php b/core/modules/user/tests/src/Functional/UserLanguageTest.php index ebc5a1bf5a..6cfbbb5975 100644 --- a/core/modules/user/tests/src/Functional/UserLanguageTest.php +++ b/core/modules/user/tests/src/Functional/UserLanguageTest.php @@ -56,7 +56,7 @@ public function testUserLanguageConfiguration() { $path = 'user/' . $web_user->id() . '/edit'; $this->drupalGet($path); // Ensure language settings widget is available. - $this->assertText(t('Language'), 'Language selector available.'); + $this->assertText('Language', 'Language selector available.'); // Ensure custom language is present. $this->assertText($name, 'Language present on form.'); // Switch to our custom language. @@ -65,7 +65,7 @@ public function testUserLanguageConfiguration() { ]; $this->drupalPostForm($path, $edit, t('Save')); // Ensure form was submitted successfully. - $this->assertText(t('The changes have been saved.'), 'Changes were saved.'); + $this->assertText('The changes have been saved.', 'Changes were saved.'); // Check if language was changed. $this->assertTrue($this->assertSession()->optionExists('edit-preferred-langcode', $langcode)->isSelected()); diff --git a/core/modules/user/tests/src/Functional/UserLoginTest.php b/core/modules/user/tests/src/Functional/UserLoginTest.php index eafa70d7d5..6fe4c3dc56 100644 --- a/core/modules/user/tests/src/Functional/UserLoginTest.php +++ b/core/modules/user/tests/src/Functional/UserLoginTest.php @@ -194,7 +194,7 @@ public function assertFailedLogin($account, $flood_trigger = NULL) { } else { $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('Unrecognized username or password. Forgot your password?')); + $this->assertText('Unrecognized username or password. Forgot your password?'); } } diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php index ac536b9f57..adb59712d5 100644 --- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -104,7 +104,7 @@ public function testUserPasswordReset() { // Check the one-time login page. $this->assertText($this->account->getAccountName(), 'One-time login page contains the correct username.'); - $this->assertText(t('This login can be used only once.'), 'Found warning about one-time login.'); + $this->assertText('This login can be used only once.', 'Found warning about one-time login.'); $this->assertSession()->titleEquals('Reset password | Drupal'); // Check successful login. @@ -116,17 +116,17 @@ public function testUserPasswordReset() { $password = \Drupal::service('password_generator')->generate(); $edit = ['pass[pass1]' => $password, 'pass[pass2]' => $password]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('The changes have been saved.'), 'Forgotten password changed.'); + $this->assertText('The changes have been saved.', 'Forgotten password changed.'); // Verify that the password reset session has been destroyed. $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t("Your current password is missing or incorrect; it's required to change the Password."), 'Password needed to make profile changes.'); + $this->assertText("Your current password is missing or incorrect; it's required to change the Password.", 'Password needed to make profile changes.'); // Log out, and try to log in again using the same one-time link. $this->drupalLogout(); $this->drupalGet($resetURL); $this->drupalPostForm(NULL, [], t('Log in')); - $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.'); + $this->assertText('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.', 'One-time link is no longer valid.'); // Request a new password again, this time using the email address. // Count email messages before to compare with after. @@ -152,7 +152,7 @@ public function testUserPasswordReset() { $_uid = $this->account->id(); $this->drupalGet("user/reset/$_uid/$bogus_timestamp/" . user_pass_rehash($this->account, $bogus_timestamp)); $this->drupalPostForm(NULL, [], t('Log in')); - $this->assertText(t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'), 'Expired password reset request rejected.'); + $this->assertText('You have tried to use a one-time login link that has expired. Please request a new one using the form below.', 'Expired password reset request rejected.'); // Create a user, block the account, and verify that a login link is denied. $timestamp = REQUEST_TIME - 1; @@ -179,7 +179,7 @@ public function testUserPasswordReset() { $this->account->save(); $this->drupalGet($old_email_reset_link); $this->drupalPostForm(NULL, [], t('Log in')); - $this->assertText(t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'One-time link is no longer valid.'); + $this->assertText('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.', 'One-time link is no longer valid.'); // Verify a password reset link will automatically log a user when /login is // appended. @@ -257,7 +257,7 @@ public function testUserPasswordResetLoggedIn() { $password = \Drupal::service('password_generator')->generate(); $edit = ['pass[pass1]' => $password, 'pass[pass2]' => $password]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(t('The changes have been saved.'), 'Password changed.'); + $this->assertText('The changes have been saved.', 'Password changed.'); // Logged in users should not be able to access the user.reset.login or the // user.reset.form routes. @@ -386,7 +386,7 @@ public function assertValidPasswordReset($name) { */ public function assertNoValidPasswordReset($name) { // Make sure the error text is displayed and no email sent. - $this->assertText(t('@name is not recognized as a username or an email address.', ['@name' => $name]), 'Validation error message shown when trying to request password for invalid account.'); + $this->assertText($name . ' is not recognized as a username or an email address.', 'Validation error message shown when trying to request password for invalid account.'); $this->assertCount(0, $this->drupalGetMails(['id' => 'user_password_reset']), 'No e-mail was sent when requesting a password for an invalid account.'); } @@ -394,7 +394,7 @@ public function assertNoValidPasswordReset($name) { * Makes assertions about a password reset triggering user flood control. */ public function assertPasswordUserFlood() { - $this->assertText(t('Too many password recovery requests for this account. It is temporarily blocked. Try again later or contact the site administrator.'), 'User password reset flood error message shown.'); + $this->assertText('Too many password recovery requests for this account. It is temporarily blocked. Try again later or contact the site administrator.', 'User password reset flood error message shown.'); } /** @@ -408,7 +408,7 @@ public function assertNoPasswordUserFlood() { * Makes assertions about a password reset triggering IP flood control. */ public function assertPasswordIpFlood() { - $this->assertText(t('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.'), 'IP password reset flood error message shown.'); + $this->assertText('Too many password recovery requests from your IP address. It is temporarily blocked. Try again later or contact the site administrator.', 'IP password reset flood error message shown.'); } /** diff --git a/core/modules/user/tests/src/Functional/UserPermissionsTest.php b/core/modules/user/tests/src/Functional/UserPermissionsTest.php index d755c39e65..9b7973499e 100644 --- a/core/modules/user/tests/src/Functional/UserPermissionsTest.php +++ b/core/modules/user/tests/src/Functional/UserPermissionsTest.php @@ -73,7 +73,7 @@ public function testUserPermissionChanges() { $edit = []; $edit[$rid . '[administer users]'] = TRUE; $this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions')); - $this->assertText(t('The changes have been saved.'), 'Successful save message displayed.'); + $this->assertText('The changes have been saved.', 'Successful save message displayed.'); $storage->resetCache(); $this->assertTrue($account->hasPermission('administer users'), 'User now has "administer users" permission.'); $current_permissions_hash = $permissions_hash_generator->generate($account); @@ -86,7 +86,7 @@ public function testUserPermissionChanges() { $edit = []; $edit[$rid . '[access user profiles]'] = FALSE; $this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions')); - $this->assertText(t('The changes have been saved.'), 'Successful save message displayed.'); + $this->assertText('The changes have been saved.', 'Successful save message displayed.'); $storage->resetCache(); $this->assertFalse($account->hasPermission('access user profiles'), 'User no longer has "access user profiles" permission.'); $current_permissions_hash = $permissions_hash_generator->generate($account); diff --git a/core/modules/user/tests/src/Functional/UserRegistrationTest.php b/core/modules/user/tests/src/Functional/UserRegistrationTest.php index 76cf00caf2..6800b353e9 100644 --- a/core/modules/user/tests/src/Functional/UserRegistrationTest.php +++ b/core/modules/user/tests/src/Functional/UserRegistrationTest.php @@ -46,7 +46,7 @@ public function testRegistrationWithEmailVerification() { $edit['name'] = $name = $this->randomMachineName(); $edit['mail'] = $mail = $edit['name'] . '@example.com'; $this->drupalPostForm('user/register', $edit, t('Create new account')); - $this->assertText(t('A welcome message with further instructions has been sent to your email address.'), 'User registered successfully.'); + $this->assertText('A welcome message with further instructions has been sent to your email address.', 'User registered successfully.'); /** @var EntityStorageInterface $storage */ $storage = $this->container->get('entity_type.manager')->getStorage('user'); @@ -86,7 +86,7 @@ public function testRegistrationWithoutEmailVerification() { $edit['pass[pass1]'] = '99999.0'; $edit['pass[pass2]'] = '99999'; $this->drupalPostForm('user/register', $edit, t('Create new account')); - $this->assertText(t('The specified passwords do not match.'), 'Typing mismatched passwords displays an error message.'); + $this->assertText('The specified passwords do not match.', 'Typing mismatched passwords displays an error message.'); // Enter a correct password. $edit['pass[pass1]'] = $new_pass = $this->randomMachineName(); @@ -97,7 +97,7 @@ public function testRegistrationWithoutEmailVerification() { ->loadByProperties(['name' => $name, 'mail' => $mail]); $new_user = reset($accounts); $this->assertNotNull($new_user, 'New account successfully created with matching passwords.'); - $this->assertText(t('Registration successful. You are now logged in.'), 'Users are logged in after registering.'); + $this->assertText('Registration successful. You are now logged in.', 'Users are logged in after registering.'); $this->drupalLogout(); // Allow registration by site visitors, but require administrator approval. @@ -108,7 +108,7 @@ public function testRegistrationWithoutEmailVerification() { $edit['pass[pass1]'] = $pass = $this->randomMachineName(); $edit['pass[pass2]'] = $pass; $this->drupalPostForm('user/register', $edit, t('Create new account')); - $this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval'); + $this->assertText('Thank you for applying for an account. Your account is currently pending approval by the site administrator.', 'Users are notified of pending approval'); // Try to log in before administrator approval. $auth = [ @@ -116,7 +116,7 @@ public function testRegistrationWithoutEmailVerification() { 'pass' => $pass, ]; $this->drupalPostForm('user/login', $auth, t('Log in')); - $this->assertText(t('The username @name has not been activated or is blocked.', ['@name' => $name]), 'User cannot log in yet.'); + $this->assertText('The username ' . $name . ' has not been activated or is blocked.', 'User cannot log in yet.'); // Activate the new account. $accounts = $this->container->get('entity_type.manager')->getStorage('user') @@ -132,7 +132,7 @@ public function testRegistrationWithoutEmailVerification() { // Log in after administrator approval. $this->drupalPostForm('user/login', $auth, t('Log in')); - $this->assertText(t('Member for'), 'User can log in after administrator approval.'); + $this->assertText('Member for', 'User can log in after administrator approval.'); } public function testRegistrationEmailDuplicates() { @@ -152,13 +152,13 @@ public function testRegistrationEmailDuplicates() { // Attempt to create a new account using an existing email address. $this->drupalPostForm('user/register', $edit, t('Create new account')); - $this->assertText(t('The email address @email is already taken.', ['@email' => $duplicate_user->getEmail()]), 'Supplying an exact duplicate email address displays an error message'); + $this->assertText('The email address ' . $duplicate_user->getEmail() . ' is already taken.', 'Supplying an exact duplicate email address displays an error message'); // Attempt to bypass duplicate email registration validation by adding spaces. $edit['mail'] = ' ' . $duplicate_user->getEmail() . ' '; $this->drupalPostForm('user/register', $edit, t('Create new account')); - $this->assertText(t('The email address @email is already taken.', ['@email' => $duplicate_user->getEmail()]), 'Supplying a duplicate email address with added whitespace displays an error message'); + $this->assertText('The email address ' . $duplicate_user->getEmail() . ' is already taken.', 'Supplying a duplicate email address with added whitespace displays an error message'); } /** diff --git a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php index 58b9de6126..b71e203020 100644 --- a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php @@ -122,7 +122,7 @@ public function testRoleWeightOrdering() { $weight--; } $this->drupalPostForm('admin/people/roles', $edit, t('Save')); - $this->assertText(t('The role settings have been updated.'), 'The role settings form submitted successfully.'); + $this->assertText('The role settings have been updated.', 'The role settings form submitted successfully.'); // Load up the user roles with the new weights. $roles = user_roles(); diff --git a/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php b/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php index 285169d0d8..9b6fca3eab 100644 --- a/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php +++ b/core/modules/user/tests/src/Functional/UserRolesAssignmentTest.php @@ -35,13 +35,13 @@ public function testAssignAndRemoveRole() { // Assign the role to the user. $this->drupalPostForm('user/' . $account->id() . '/edit', ["roles[$rid]" => $rid], t('Save')); - $this->assertText(t('The changes have been saved.')); + $this->assertText('The changes have been saved.'); $this->assertSession()->checkboxChecked('edit-roles-' . $rid); $this->userLoadAndCheckRoleAssigned($account, $rid); // Remove the role from the user. $this->drupalPostForm('user/' . $account->id() . '/edit', ["roles[$rid]" => FALSE], t('Save')); - $this->assertText(t('The changes have been saved.')); + $this->assertText('The changes have been saved.'); $this->assertSession()->checkboxNotChecked('edit-roles-' . $rid); $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE); } @@ -61,7 +61,7 @@ public function testCreateUserWithRole() { "roles[$rid]" => $rid, ]; $this->drupalPostForm('admin/people/create', $edit, t('Create new account')); - $this->assertText(t('Created a new user account for @name.', ['@name' => $edit['name']])); + $this->assertText('Created a new user account for ' . $edit['name'] . '.'); // Get the newly added user. $account = user_load_by_name($edit['name']); @@ -71,7 +71,7 @@ public function testCreateUserWithRole() { // Remove the role again. $this->drupalPostForm('user/' . $account->id() . '/edit', ["roles[$rid]" => FALSE], t('Save')); - $this->assertText(t('The changes have been saved.')); + $this->assertText('The changes have been saved.'); $this->assertSession()->checkboxNotChecked('edit-roles-' . $rid); $this->userLoadAndCheckRoleAssigned($account, $rid, FALSE); } diff --git a/core/modules/user/tests/src/Functional/UserSearchTest.php b/core/modules/user/tests/src/Functional/UserSearchTest.php index 7e334e4f05..d2635a7d4b 100644 --- a/core/modules/user/tests/src/Functional/UserSearchTest.php +++ b/core/modules/user/tests/src/Functional/UserSearchTest.php @@ -36,7 +36,7 @@ public function testUserSearch() { $keys = $user1->getEmail(); $edit = ['keys' => $keys]; $this->drupalPostForm('search/user', $edit, t('Search')); - $this->assertText(t('Your search yielded no results.'), 'Search by email did not work for non-admin user'); + $this->assertText('Your search yielded no results.', 'Search by email did not work for non-admin user'); $this->assertText('no results', 'Search by email gave no-match message'); // Verify that a non-matching query gives an appropriate message. @@ -113,7 +113,7 @@ public function testUserSearch() { $this->drupalLogin($user1); $edit = ['keys' => $blocked_user->getAccountName()]; $this->drupalPostForm('search/user', $edit, t('Search')); - $this->assertText(t('Your search yielded no results.'), 'Blocked users are hidden from the user search results.'); + $this->assertText('Your search yielded no results.', 'Blocked users are hidden from the user search results.'); // Ensure that a user without access to user profiles cannot access the // user search page. diff --git a/core/modules/user/tests/src/Functional/UserTimeZoneTest.php b/core/modules/user/tests/src/Functional/UserTimeZoneTest.php index e5fb9ad2e0..9ab8ffce61 100644 --- a/core/modules/user/tests/src/Functional/UserTimeZoneTest.php +++ b/core/modules/user/tests/src/Functional/UserTimeZoneTest.php @@ -72,7 +72,7 @@ public function testUserTimeZone() { $edit['mail'] = $web_user->getEmail(); $edit['timezone'] = 'America/Santiago'; $this->drupalPostForm("user/" . $web_user->id() . "/edit", $edit, t('Save')); - $this->assertText(t('The changes have been saved.'), 'Time zone changed to Santiago time.'); + $this->assertText('The changes have been saved.', 'Time zone changed to Santiago time.'); // Confirm date format and time zone. $this->drupalGet('node/' . $node1->id()); diff --git a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php index ec15ddca38..156043edf8 100644 --- a/core/modules/user/tests/src/Functional/Views/BulkFormTest.php +++ b/core/modules/user/tests/src/Functional/Views/BulkFormTest.php @@ -52,7 +52,7 @@ public function testBulkForm() { 'action' => 'user_block_user_action', ]; $this->drupalPostForm('test-user-bulk-form', $edit, t('Apply to selected items')); - $this->assertText(t('No users selected.')); + $this->assertText('No users selected.'); // Assign a role to a user. $account = $user_storage->load($this->users[0]->id()); diff --git a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php index b4fd00808f..f8238a5259 100644 --- a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php +++ b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php @@ -35,8 +35,8 @@ public function testUserFieldAccess() { $this->drupalGet('test_user_fields_access'); // User has access to name and created date by default. - $this->assertText(t('Name')); - $this->assertText(t('Created')); + $this->assertText('Name'); + $this->assertText('Created'); // User does not by default have access to init, mail and status. $this->assertNoText('Init'); @@ -49,9 +49,9 @@ public function testUserFieldAccess() { $this->drupalGet('test_user_fields_access'); // Access for init, mail and status is added in hook_entity_field_access(). - $this->assertText(t('Init')); - $this->assertText(t('Email')); - $this->assertText(t('Status')); + $this->assertText('Init'); + $this->assertText('Email'); + $this->assertText('Status'); } /** diff --git a/core/modules/views/tests/src/Functional/BulkFormTest.php b/core/modules/views/tests/src/Functional/BulkFormTest.php index 2317507153..b01e94b091 100644 --- a/core/modules/views/tests/src/Functional/BulkFormTest.php +++ b/core/modules/views/tests/src/Functional/BulkFormTest.php @@ -35,7 +35,7 @@ public function testBulkForm() { // First, test an empty bulk form with the default style plugin to make sure // the empty region is rendered correctly. $this->drupalGet('test_bulk_form_empty'); - $this->assertText(t('This view is empty.'), 'Empty text found on empty bulk form.'); + $this->assertText('This view is empty.', 'Empty text found on empty bulk form.'); $nodes = []; for ($i = 0; $i < 10; $i++) { @@ -159,7 +159,7 @@ public function testBulkForm() { $errors = $this->xpath('//div[contains(@class, "messages--status")]'); $this->assertEmpty($errors, 'No action message shown.'); $this->drupalPostForm(NULL, [], t('Delete')); - $this->assertText(t('Deleted 5 content items.')); + $this->assertText('Deleted 5 content items.'); // Check if we got redirected to the original page. $this->assertSession()->addressEquals('test_bulk_form'); @@ -197,7 +197,7 @@ public function testBulkForm() { $errors = $this->xpath('//div[contains(@class, "messages--status")]'); $this->assertEmpty($errors, 'No action message shown.'); $this->drupalPostForm(NULL, [], t('Delete')); - $this->assertText(t('Deleted 1 content item.')); + $this->assertText('Deleted 1 content item.'); // Test that the bulk form works when multiple nodes are selected // but all of the selected nodes are already deleted diff --git a/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php b/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php index 44020ba5d4..52f3cd7280 100644 --- a/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php +++ b/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php @@ -196,7 +196,7 @@ protected function _testUiValidation() { // Generate a definitive wrong value, which should be checked by validation. $edit['options[value][value]'] = $this->randomString() . '-------'; $this->drupalPostForm(NULL, $edit, t('Apply')); - $this->assertText(t('Invalid date format.'), 'Make sure that validation is run and the invalidate date format is identified.'); + $this->assertText('Invalid date format.', 'Make sure that validation is run and the invalidate date format is identified.'); } /** diff --git a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php index 6144c9cd66..4ba7c698fb 100644 --- a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php +++ b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php @@ -31,7 +31,7 @@ public function testViewsWizardAndListing() { // Check if we can access the main views admin page. $this->drupalGet('admin/structure/views'); - $this->assertText(t('Add view')); + $this->assertText('Add view'); // Create a simple and not at all useful view. $view1 = []; diff --git a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php index a8822a0a35..a1bf2c43a5 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayAttachmentTest.php @@ -30,7 +30,7 @@ class DisplayAttachmentTest extends UITestBase { */ public function testAttachmentUI() { $this->drupalGet('admin/structure/views/view/test_attachment_ui/edit/attachment_1'); - $this->assertText(t('Not defined'), 'The right text appears if there is no attachment selection yet.'); + $this->assertText('Not defined', 'The right text appears if there is no attachment selection yet.'); $attachment_display_url = 'admin/structure/views/nojs/display/test_attachment_ui/attachment_1/displays'; $this->drupalGet($attachment_display_url); @@ -75,7 +75,7 @@ public function testRemoveAttachedDisplay() { // Open the Page display and create the attachment display. $this->drupalGet($path_prefix . '/page_1'); $this->drupalPostForm(NULL, [], 'Add Attachment'); - $this->assertText(t('Not defined'), 'The right text appears if there is no attachment selection yet.'); + $this->assertText('Not defined', 'The right text appears if there is no attachment selection yet.'); // Attach the Attachment to the Page display. $this->drupalPostForm($attachment_display_url, ['displays[page_1]' => 1], t('Apply')); @@ -94,7 +94,7 @@ public function testRemoveAttachedDisplay() { $this->assertNoText("Plugin ID 'page_1' was not found."); // Check that the attachment is no longer linked to the removed display. - $this->assertText(t('Not defined'), 'The right text appears if there is no attachment selection yet.'); + $this->assertText('Not defined', 'The right text appears if there is no attachment selection yet.'); } diff --git a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php index 0ddac63fa6..55eba76a1e 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php @@ -132,7 +132,7 @@ public function testDuplicateDisplay() { $this->drupalPostForm(NULL, [], 'Duplicate as Block'); $this->assertSession()->linkByHrefExists($path_prefix . '/block_1', 0, 'Make sure after duplicating the new display appears in the UI'); $this->assertSession()->addressEquals($path_prefix . '/block_1'); - $this->assertText(t('Block settings')); + $this->assertText('Block settings'); $this->assertNoText('Page settings'); $this->drupalPostForm(NULL, [], t('Save')); diff --git a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php index e17ddf92f8..2dd1fab88c 100644 --- a/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php +++ b/core/modules/views_ui/tests/src/Functional/DisplayPathTest.php @@ -56,7 +56,7 @@ protected function doBasicPathUITest() { // Add a new page display and check the appearing text. $this->drupalPostForm(NULL, [], 'Add Page'); - $this->assertText(t('No path is set'), 'The right text appears if no path was set.'); + $this->assertText('No path is set', 'The right text appears if no path was set.'); $this->assertSession()->linkNotExists('View page', 'No view page link found on the page.'); // Save a path and make sure the summary appears as expected. diff --git a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php index beece8ce2b..ba2adc1408 100644 --- a/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php +++ b/core/modules/views_ui/tests/src/Functional/ExposedFormUITest.php @@ -93,12 +93,12 @@ public function testExposedAdminUi() { $edit = []; $edit['options[expose][identifier]'] = ''; $this->drupalPostForm(NULL, $edit, t('Apply')); - $this->assertText(t('The identifier is required if the filter is exposed.')); + $this->assertText('The identifier is required if the filter is exposed.'); $edit = []; $edit['options[expose][identifier]'] = 'value'; $this->drupalPostForm(NULL, $edit, t('Apply')); - $this->assertText(t('This identifier is not allowed.')); + $this->assertText('This identifier is not allowed.'); // Now check the sort criteria. $this->drupalGet('admin/structure/views/nojs/handler/test_exposed_admin_ui/default/sort/created'); diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index 0f00b7dde3..af5b16303d 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -233,7 +233,7 @@ public function testBrokenHandlers() { ]; foreach ($original_configuration as $key => $value) { - $this->assertText(new FormattableMarkup('@key: @value', ['@key' => $key, '@value' => $value])); + $this->assertText($key . ': ' . $value); } } } diff --git a/core/modules/views_ui/tests/src/Functional/PreviewTest.php b/core/modules/views_ui/tests/src/Functional/PreviewTest.php index 0a1f348d05..8cc7dd5a1d 100644 --- a/core/modules/views_ui/tests/src/Functional/PreviewTest.php +++ b/core/modules/views_ui/tests/src/Functional/PreviewTest.php @@ -95,17 +95,17 @@ public function testPreviewUI() { $settings->set('ui.show.performance_statistics', TRUE)->save(); $this->drupalGet('admin/structure/views/view/test_preview/edit'); $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview')); - $this->assertText(t('Query build time')); - $this->assertText(t('Query execute time')); - $this->assertText(t('View render time')); + $this->assertText('Query build time'); + $this->assertText('Query execute time'); + $this->assertText('View render time'); $this->assertNoRaw('Query'); // Statistics and query. $settings->set('ui.show.sql_query.enabled', TRUE)->save(); $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview')); - $this->assertText(t('Query build time')); - $this->assertText(t('Query execute time')); - $this->assertText(t('View render time')); + $this->assertText('Query build time'); + $this->assertText('Query execute time'); + $this->assertText('View render time'); $this->assertRaw('Query'); $query_string = <<drupalPostForm('admin/structure/views/settings', [], t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); // Configure to always show the master display. $edit = [ @@ -130,7 +130,7 @@ public function testEditUI() { // Test the confirmation message. $this->drupalPostForm('admin/structure/views/settings/advanced', [], t('Save configuration')); - $this->assertText(t('The configuration options have been saved.')); + $this->assertText('The configuration options have been saved.'); $edit = [ 'skip_cache' => TRUE, @@ -143,7 +143,7 @@ public function testEditUI() { // Test the "Clear Views' cache" button. $this->drupalPostForm('admin/structure/views/settings/advanced', [], t("Clear Views' cache")); - $this->assertText(t('The cache has been cleared.')); + $this->assertText('The cache has been cleared.'); } } diff --git a/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php b/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php index 6086aa5fc5..4b693b5bd0 100644 --- a/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php +++ b/core/modules/views_ui/tests/src/Functional/UnsavedPreviewTest.php @@ -66,7 +66,7 @@ public function testUnsavedPageDisplayPreview() { $this->drupalPostForm(NULL, [], t('Update preview')); $this->assertSession()->statusCodeEquals(200); - $this->assertText(t('This display has no path')); + $this->assertText('This display has no path'); $this->drupalGet('admin/structure/views/view/content/edit/page_2'); $this->assertSession()->statusCodeEquals(200); diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php index e6c4440f17..d156fd0bf3 100644 --- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php +++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php @@ -77,7 +77,7 @@ public function testOtherOptions() { // Test the form validation with invalid IDs. $machine_name_edit_url = 'admin/structure/views/nojs/display/test_view/test_1/display_id'; - $error_text = t('Display machine name must contain only lowercase letters, numbers, or underscores.'); + $error_text = 'Display machine name must contain only lowercase letters, numbers, or underscores.'; // Test that potential invalid display ID requests are detected try { @@ -99,7 +99,7 @@ public function testOtherOptions() { // Test using an existing display ID. $edit = ['display_id' => 'default']; $this->drupalPostForm($machine_name_edit_url, $edit, 'Apply'); - $this->assertText(t('Display id should be unique.')); + $this->assertText('Display id should be unique.'); // Test that the display ID has not been changed. $this->drupalGet('admin/structure/views/view/test_view/edit/test_1'); @@ -165,7 +165,7 @@ public function testEditFormLanguageOptions() { $this->drupalGet($langcode_url); $this->assertSession()->statusCodeEquals(200); if ($view_name == 'test_view') { - $this->assertText(t('The view is not based on a translatable entity type or the site is not multilingual.')); + $this->assertText('The view is not based on a translatable entity type or the site is not multilingual.'); } else { $this->assertSession()->fieldValueEquals('rendering_language', '***LANGUAGE_entity_translation***'); diff --git a/core/profiles/minimal/tests/src/Functional/MinimalTest.php b/core/profiles/minimal/tests/src/Functional/MinimalTest.php index 72e164a45a..02e6ec7aba 100644 --- a/core/profiles/minimal/tests/src/Functional/MinimalTest.php +++ b/core/profiles/minimal/tests/src/Functional/MinimalTest.php @@ -39,8 +39,8 @@ public function testMinimal() { ]); $this->drupalLogin($user); $this->drupalGet(''); - $this->assertText(t('Tools')); - $this->assertText(t('Administration')); + $this->assertText('Tools'); + $this->assertText('Administration'); // Ensure that there are no pending updates after installation. $this->drupalLogin($this->rootUser); diff --git a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php index e46331ba92..0b5326f1ea 100644 --- a/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php @@ -73,6 +73,9 @@ protected function assertElementNotPresent($css_selector) { */ protected function assertText($text) { @trigger_error('AssertLegacyTrait::assertText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() or $this->assertSession()->pageTextContains() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED); + if (is_object($text)) { + @trigger_error('Passing MarkupInterface objects to AssertLegacyTrait::assertText() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Pass plain strings instead. See https://www.drupal.org/node/xxxxxxx', E_USER_DEPRECATED); + } // Cast MarkupInterface to string. $text = (string) $text; diff --git a/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php b/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php index eb35f1355e..07ff5a5c6d 100644 --- a/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php +++ b/core/tests/Drupal/FunctionalTests/Image/ToolkitSetupFormTest.php @@ -65,7 +65,7 @@ public function testToolkitSetupForm() { // Test changing the test toolkit parameter. $edit = ['test[test_parameter]' => '0']; $this->drupalPostForm(NULL, $edit, 'Save configuration'); - $this->assertText(t('Test parameter should be different from 0.'), 'Validation error displayed.'); + $this->assertText('Test parameter should be different from 0.', 'Validation error displayed.'); $edit = ['test[test_parameter]' => '20']; $this->drupalPostForm(NULL, $edit, 'Save configuration'); $this->assertEqual($this->config('system.image.test_toolkit')->get('test_parameter'), '20');