diff --git a/core/modules/aggregator/tests/src/Functional/ItemCacheTagsTest.php b/core/modules/aggregator/tests/src/Functional/ItemCacheTagsTest.php index c7bce98ff211446982b68f96dfaa0fb8d2db1b28..93b6e8e48d90150d8c1eed5e8417a66afc2440c1 100644 --- a/core/modules/aggregator/tests/src/Functional/ItemCacheTagsTest.php +++ b/core/modules/aggregator/tests/src/Functional/ItemCacheTagsTest.php @@ -56,7 +56,7 @@ protected function createEntity() { // Create a "Llama" aggregator feed item. $item = Item::create([ 'fid' => $feed->id(), - 'title' => t('Llama'), + 'title' => 'Llama', 'path' => 'https://www.drupal.org/', ]); $item->save(); @@ -77,7 +77,7 @@ public function testEntityCreation() { // Now create a feed item in that feed. Item::create([ 'fid' => $this->entity->getFeedId(), - 'title' => t('Llama 2'), + 'title' => 'Llama 2', 'path' => 'https://groups.drupal.org/', ])->save(); diff --git a/core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php b/core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php index f4a5e8f3f34dffa5349b20bfe491e6208f6f0bbb..8a604eeb701c187bb0a64c4d8f7f12576b5c3499 100644 --- a/core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php +++ b/core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php @@ -31,7 +31,7 @@ protected function setUp(): void { */ public function testEntityCreation() { $entity = Item::create([ - 'title' => t('Llama 2'), + 'title' => 'Llama 2', 'path' => 'https://groups.drupal.org/', ]); $violations = $entity->validate(); diff --git a/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php index 49772173409c922b2285a83d42a37d22f1bf7683..d47ac18cff82b241f100d1801893264c5467430c 100644 --- a/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php +++ b/core/modules/block/tests/src/Kernel/BlockInterfaceTest.php @@ -59,7 +59,7 @@ public function testBlockInterface() { ], 'admin_label' => [ '#type' => 'item', - '#title' => t('Block description'), + '#title' => 'Block description', '#plain_text' => $definition['admin_label'], ], 'label' => [ @@ -78,7 +78,7 @@ public function testBlockInterface() { 'context_mapping' => [], 'display_message' => [ '#type' => 'textfield', - '#title' => t('Display message'), + '#title' => 'Display message', '#default_value' => 'My custom display message.', ], ]; diff --git a/core/modules/comment/tests/src/Functional/CommentPagerTest.php b/core/modules/comment/tests/src/Functional/CommentPagerTest.php index 6e3d1b853378b227e99af34e3a59955ad2c9d90a..ef4fe3c018fea8257a7eabc8d1512f85d9dfd3db 100644 --- a/core/modules/comment/tests/src/Functional/CommentPagerTest.php +++ b/core/modules/comment/tests/src/Functional/CommentPagerTest.php @@ -370,11 +370,8 @@ public function testTwoPagers() { // Set comments to one per page so that we are able to test paging without // needing to insert large numbers of comments. $this->setCommentsPerPage(1, $field_name); - for ($i = 0; $i < 3; $i++) { - $comment = t('Comment @count on field @field', [ - '@count' => $i + 1, - '@field' => $field_name, - ]); + for ($i = 1; $i <= 4; $i++) { + $comment = "Comment $i on field $field_name"; $comments[] = $this->postComment($node, $comment, $comment, TRUE, $field_name); } } diff --git a/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php b/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php index 9a34ac30387ba925bd6239d852091dd983a404c9..cddb174fed9eebd6f3fb4bbd2f6a07dbb8c5e01d 100644 --- a/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php +++ b/core/modules/comment/tests/src/Functional/CommentStatusFieldAccessTest.php @@ -57,7 +57,7 @@ protected function setUp(): void { parent::setUp(); $node_type = NodeType::create([ 'type' => 'article', - 'name' => t('Article'), + 'name' => 'Article', ]); $node_type->save(); $this->nodeAuthor = $this->drupalCreateUser([ diff --git a/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php b/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php index 3c68670db755abafcdd8d749ac31fcea91ad77a9..685fbf2203344bfcb1ed0eacd127b89bec71e924 100644 --- a/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php +++ b/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php @@ -51,7 +51,7 @@ public function testCommentCount() { $this->assertCount(1, $comment_count_without_comment); // Create a content type with no comment field, and add a node. - $this->drupalCreateContentType(['type' => 'no_comment', 'name' => t('No comment page')]); + $this->drupalCreateContentType(['type' => 'no_comment', 'name' => 'No comment page']); $this->nodeUserPosted = $this->drupalCreateNode(['type' => 'no_comment']); $this->drupalGet('test-comment-count'); diff --git a/core/modules/comment/tests/src/Functional/Views/WizardTest.php b/core/modules/comment/tests/src/Functional/Views/WizardTest.php index 0103c3d123620a4cfce800e5216b6a59f613d221..ecabc08b96b1c0e69451616fcedd10e116758445 100644 --- a/core/modules/comment/tests/src/Functional/Views/WizardTest.php +++ b/core/modules/comment/tests/src/Functional/Views/WizardTest.php @@ -33,7 +33,7 @@ class WizardTest extends WizardTestBase { */ protected function setUp($import_test_views = TRUE): void { parent::setUp($import_test_views); - $this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]); + $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); // Add comment field to page node type. $this->addDefaultCommentField('node', 'page'); } diff --git a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php index aa58a411ec679c69a3d9be0f749eaf04eb9d38f3..e80cf5b4df3192180f00c481236cd37c0c59169c 100644 --- a/core/modules/config/tests/src/Functional/ConfigEntityListTest.php +++ b/core/modules/config/tests/src/Functional/ConfigEntityListTest.php @@ -59,17 +59,17 @@ public function testList() { // Test getOperations() method. $expected_operations = [ 'edit' => [ - 'title' => t('Edit'), + 'title' => 'Edit', 'weight' => 10, 'url' => $entity->toUrl()->setOption('query', $this->getRedirectDestination()->getAsArray()), ], 'disable' => [ - 'title' => t('Disable'), + 'title' => 'Disable', 'weight' => 40, 'url' => $entity->toUrl('disable')->setOption('query', $this->getRedirectDestination()->getAsArray()), ], 'delete' => [ - 'title' => t('Delete'), + 'title' => 'Delete', 'weight' => 100, 'url' => $entity->toUrl('delete-form')->setOption('query', $this->getRedirectDestination()->getAsArray()), ], @@ -134,12 +134,12 @@ public function testList() { // Test getOperations() method. $expected_operations = [ 'edit' => [ - 'title' => t('Edit'), + 'title' => 'Edit', 'weight' => 10, 'url' => $entity->toUrl()->setOption('query', $this->getRedirectDestination()->getAsArray()), ], 'delete' => [ - 'title' => t('Delete'), + 'title' => 'Delete', 'weight' => 100, 'url' => $entity->toUrl('delete-form')->setOption('query', $this->getRedirectDestination()->getAsArray()), ], diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php index 820201eea234c4bc5a7578bfa6afa56a3a3c333f..e28c8aae9b15bbd09e8c8871f8e769c00f4672a8 100644 --- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php +++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\contact\Functional; use Drupal\Component\Render\FormattableMarkup; -use Drupal\Component\Render\PlainTextOutput; use Drupal\Component\Utility\Html; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Test\AssertMailTrait; @@ -93,14 +92,9 @@ public function testSendPersonalContactMessage() { $this->assertEquals($this->config('system.site')->get('mail'), $mail['from']); $this->assertEquals($this->webUser->getEmail(), $mail['reply-to']); $this->assertEquals('user_mail', $mail['key']); - $variables = [ - '@site-name' => $this->config('system.site')->get('name'), - '@subject' => $message['subject[0][value]'], - '@recipient-name' => $this->contactUser->getDisplayName(), - ]; - $subject = PlainTextOutput::renderFromHtml(t('[@site-name] @subject', $variables)); + $subject = '[' . $this->config('system.site')->get('name') . '] ' . $message['subject[0][value]']; $this->assertEquals($subject, $mail['subject'], 'Subject is in sent message.'); - $this->assertStringContainsString('Hello ' . $variables['@recipient-name'], $mail['body'], 'Recipient name is in sent message.'); + $this->assertStringContainsString('Hello ' . $this->contactUser->getDisplayName(), $mail['body'], 'Recipient name is in sent message.'); $this->assertStringContainsString($this->webUser->getDisplayName(), $mail['body'], 'Sender name is in sent message.'); $this->assertStringContainsString($message['message[0][value]'], $mail['body'], 'Message body is in sent message.'); @@ -128,7 +122,7 @@ public function testSendPersonalContactMessage() { $message = $this->submitPersonalContact($this->contactUser, $message); // Assert mail content. - $this->assertMailString('body', 'Hello ' . $variables['@recipient-name'], 1); + $this->assertMailString('body', 'Hello ' . $this->contactUser->getDisplayName(), 1); $this->assertMailString('body', $this->webUser->getDisplayName(), 1); $this->assertMailString('body', Html::Escape($message['message[0][value]']), 1); } diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php index a57864d83556be8cd734c8ad63eaf4a454a92079..9360122fb2bd9904d764249c6b48712a12610a00 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationWorkflowsTest.php @@ -225,7 +225,7 @@ public function testWorkflows() { $this->doTestWorkflows($this->administrator, $expected_status); // Check that translation permissions allow the associated operations. - $ops = ['create' => t('Add'), 'update' => t('Edit'), 'delete' => t('Delete')]; + $ops = ['create' => 'Add', 'update' => 'Edit', 'delete' => 'Delete']; $translations_url = $this->entity->toUrl('drupal:content-translation-overview'); foreach ($ops as $current_op => $item) { $user = $this->drupalCreateUser([ diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index 2965cd96f4d272607850778afe6630bdcc42390d..4b7ef3c2266fa8dc705daefa80e1061a05419186 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -377,8 +377,8 @@ private function verifyBreadcrumbs() { private function verifyEvents() { // Invoke events. $this->doUser(); - $this->drupalCreateContentType(['type' => 'article', 'name' => t('Article')]); - $this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]); + $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']); + $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); $this->doNode('article'); $this->doNode('page'); $this->doNode('forum'); diff --git a/core/modules/field/tests/src/Functional/NestedFormTest.php b/core/modules/field/tests/src/Functional/NestedFormTest.php index 4dd8993d5cbee0795c36c766b672ebeece897cbc..7621b07e3a33663d25610538c31ec6c471e2512f 100644 --- a/core/modules/field/tests/src/Functional/NestedFormTest.php +++ b/core/modules/field/tests/src/Functional/NestedFormTest.php @@ -204,7 +204,7 @@ public function testNestedEntityFormEntityLevelValidation() { // Submit the form and check that the entities are updated accordingly. $assert_session->hiddenFieldExists('entity_2[changed]') ->setValue(REQUEST_TIME - 86400); - $page->pressButton(t('Save')); + $page->pressButton('Save'); $elements = $this->cssSelect('.entity-2.error'); $this->assertCount(1, $elements, 'The whole nested entity form has been correctly flagged with an error class.'); diff --git a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php index 85b056e6575baf163e274851bf997f055d30bfc4..1d54d284713527f56f9ea97731159e60a84284d7 100644 --- a/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php +++ b/core/modules/field_ui/tests/src/Functional/ManageFieldsFunctionalTest.php @@ -166,12 +166,7 @@ public function manageFieldsPage($type = '') { $type = empty($type) ? $this->contentType : $type; $this->drupalGet('admin/structure/types/manage/' . $type . '/fields'); // Check all table columns. - $table_headers = [ - t('Label'), - t('Machine name'), - t('Field type'), - t('Operations'), - ]; + $table_headers = ['Label', 'Machine name', 'Field type', 'Operations']; foreach ($table_headers as $table_header) { // We check that the label appear in the table headings. $this->assertSession()->responseContains($table_header . '</th>'); @@ -688,7 +683,7 @@ public function testHiddenFields() { 'field_name' => $field_name, 'bundle' => $this->contentType, 'entity_type' => 'node', - 'label' => t('Hidden field'), + 'label' => 'Hidden field', ]; FieldConfig::create($field)->save(); \Drupal::service('entity_display.repository') diff --git a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php index dbd1b088169834c13cc1f70f3d7b8af88df1a6f7..c0ee1aff261eaad1cd86d07604f5a2afde055f9f 100644 --- a/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php +++ b/core/modules/field_ui/tests/src/FunctionalJavascript/ManageDisplayTest.php @@ -454,7 +454,7 @@ public function fieldUIAddNewField($bundle_path, $field_name, $label = NULL, $fi $field_field_name->setValue($field_name); $assert_session->assertWaitOnAjaxRequest(); - $page->findButton(t('Save and continue'))->click(); + $page->findButton('Save and continue')->click(); $assert_session->pageTextContains("These settings apply to the $label field everywhere it is used."); $breadcrumb_link = $page->findLink($label); diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php index 9312e7a27181b942e8bd7399eb83c0305f5bdf88..84ad60cd3c0b5feccf43b3735d6950520ea012e9 100644 --- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php +++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php @@ -629,7 +629,7 @@ public function testComponentDependencies() { $this->assertNull($form_display->getComponent($field_name)); $this->assertTrue($form_display->get('hidden')[$field_name]); // The correct warning message has been logged. - $arguments = ['@display' => (string) t('Entity form display'), '@id' => $form_display->id(), '@name' => $field_name]; + $arguments = ['@display' => 'Entity form display', '@id' => $form_display->id(), '@name' => $field_name]; $variables = Database::getConnection()->select('watchdog', 'w') ->fields('w', ['variables']) ->condition('type', 'system') diff --git a/core/modules/file/tests/src/Functional/FilePrivateTest.php b/core/modules/file/tests/src/Functional/FilePrivateTest.php index 8d82b2fb34bb30722c56e40a076dd4bd628228dc..c1f4b3d2367da29fb9546ffdb28f6f125761afbb 100644 --- a/core/modules/file/tests/src/Functional/FilePrivateTest.php +++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php @@ -90,7 +90,7 @@ public function testPrivateFile() { // Can't use submitForm() to set hidden fields. $this->drupalGet('node/' . $new_node->id() . '/edit'); $this->getSession()->getPage()->find('css', 'input[name="' . $field_name . '[0][fids]"]')->setValue($node_file->id()); - $this->getSession()->getPage()->pressButton(t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $this->assertSession()->addressEquals('node/' . $new_node->id()); // Make sure the submitted hidden file field is empty. $new_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($new_node->id()); @@ -103,7 +103,7 @@ public function testPrivateFile() { $this->drupalGet('node/add/' . $type_name); $this->getSession()->getPage()->find('css', 'input[name="title[0][value]"]')->setValue($edit['title[0][value]']); $this->getSession()->getPage()->find('css', 'input[name="' . $field_name . '[0][fids]"]')->setValue($node_file->id()); - $this->getSession()->getPage()->pressButton(t('Save')); + $this->getSession()->getPage()->pressButton('Save'); $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']); $this->assertSession()->addressEquals('node/' . $new_node->id()); // Make sure the submitted hidden file field is empty. diff --git a/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php b/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php index 18c197746d66862367b1551b937de256e599720f..20dfa742fdcd7f92977d432de30d4ffe0bb6364e 100644 --- a/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php +++ b/core/modules/file/tests/src/FunctionalJavascript/FileManagedFileElementTest.php @@ -76,7 +76,7 @@ public function testManagedFile() { $this->submitForm([], 'Save'); // Remove, then Submit. - $remove_button_title = $multiple ? t('Remove selected') : t('Remove'); + $remove_button_title = $multiple ? 'Remove selected' : 'Remove'; $this->drupalGet($path . '/' . $last_fid); if ($multiple) { $selected_checkbox = ($tree ? 'nested[file]' : 'file') . '[file_' . $last_fid . '][selected]'; diff --git a/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php b/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php index 25d101977b99a152e7ca6bed66e2b6249d168e5d..3d5e5ee756a06ab00dd6c7b8a8702c786568f5be 100644 --- a/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php +++ b/core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php @@ -94,8 +94,6 @@ public function testImageSource() { $druplicon = 'core/misc/druplicon.png'; $red_x_image = base_path() . 'core/misc/icons/e32700/error.svg'; - $alt_text = t('Image removed.'); - $title_text = t('This image has been removed. For security reasons, only images from the local domain are allowed.'); // Put a test image in the files directory. $test_images = $this->getTestFiles('image'); @@ -152,8 +150,8 @@ public function testImageSource() { $found = TRUE; if ($converted == $red_x_image) { $this->assertEquals($red_x_image, $element->getAttribute('src')); - $this->assertEquals($alt_text, $element->getAttribute('alt')); - $this->assertEquals($title_text, $element->getAttribute('title')); + $this->assertEquals('Image removed.', $element->getAttribute('alt')); + $this->assertEquals('This image has been removed. For security reasons, only images from the local domain are allowed.', $element->getAttribute('title')); $this->assertEquals('16', $element->getAttribute('height')); $this->assertEquals('16', $element->getAttribute('width')); } diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php index 50d5a302c137b9667079afa897679de05e88cf3b..4d1e0767eacb6a18cfb0182276e3ffcba1718060 100644 --- a/core/modules/forum/tests/src/Functional/ForumTest.php +++ b/core/modules/forum/tests/src/Functional/ForumTest.php @@ -584,14 +584,13 @@ public function createForumTopic($forum, $container = FALSE) { $this->drupalGet('node/add/forum', ['query' => ['forum_id' => $tid]]); $this->submitForm($edit, 'Save'); - $type = t('Forum topic'); if ($container) { - $this->assertSession()->pageTextNotContains("$type $title has been created."); + $this->assertSession()->pageTextNotContains("Forum topic $title has been created."); $this->assertSession()->pageTextContains("The item {$forum['name']} is a forum container, not a forum."); return; } else { - $this->assertSession()->pageTextContains($type . ' ' . $title . ' has been created.'); + $this->assertSession()->pageTextContains("Forum topic $title has been created."); $this->assertSession()->pageTextNotContains("The item {$forum['name']} is a forum container, not a forum."); // Verify that the creation message contains a link to a node. @@ -644,8 +643,8 @@ private function verifyForums(EntityInterface $node, $admin, $response = 200) { $this->assertSession()->statusCodeEquals(200); $this->assertSession()->titleEquals($node->label() . ' | Drupal'); $breadcrumb_build = [ - Link::createFromRoute(t('Home'), '<front>'), - Link::createFromRoute(t('Forums'), 'forum.index'), + Link::createFromRoute('Home', '<front>'), + Link::createFromRoute('Forums', 'forum.index'), Link::createFromRoute($this->forumContainer['name'], 'forum.page', ['taxonomy_term' => $this->forumContainer['tid']]), Link::createFromRoute($this->forum['name'], 'forum.page', ['taxonomy_term' => $this->forum['tid']]), ]; @@ -708,8 +707,8 @@ private function verifyForumView($forum, $parent = NULL) { $this->assertSession()->titleEquals($forum['name'] . ' | Drupal'); $breadcrumb_build = [ - Link::createFromRoute(t('Home'), '<front>'), - Link::createFromRoute(t('Forums'), 'forum.index'), + Link::createFromRoute('Home', '<front>'), + Link::createFromRoute('Forums', 'forum.index'), ]; if (isset($parent)) { $breadcrumb_build[] = Link::createFromRoute($parent['name'], 'forum.page', ['taxonomy_term' => $parent['tid']]); diff --git a/core/modules/forum/tests/src/Functional/ForumUninstallTest.php b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php index 440d3b9f94a8e4531e5b3bf7c20c81fb7ab18535..30ea8c1fd07a61f6f1c47b18b575e621f0f123ba 100644 --- a/core/modules/forum/tests/src/Functional/ForumUninstallTest.php +++ b/core/modules/forum/tests/src/Functional/ForumUninstallTest.php @@ -45,7 +45,7 @@ public function testForumUninstallWithField() { // Create a taxonomy term. $term = Term::create([ - 'name' => t('A term'), + 'name' => 'A term', 'langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId(), 'description' => '', 'parent' => [0], diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php index 4e3d31cfa74961803ace80ef3eb1e68a8fb088df..551c77aa0ebae1b81fc41afcf6d4f7478127525d 100644 --- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php +++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php @@ -437,7 +437,7 @@ public function testImageFieldDefaultImage() { // Can't use fillField cause Mink can't fill hidden fields. $this->drupalGet("admin/structure/types/manage/article/fields/node.article.$field_name/storage"); $this->getSession()->getPage()->find('css', 'input[name="settings[default_image][uuid][fids]"]')->setValue(0); - $this->getSession()->getPage()->pressButton(t('Save field settings')); + $this->getSession()->getPage()->pressButton('Save field settings'); // Clear field definition cache so the new default image is detected. \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); diff --git a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php index 75d1b058eea065cc49c843ec41052da199c2f9bb..b0a198312f8d1a7ba09c66598949baedbcd1c859 100644 --- a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php +++ b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php @@ -56,7 +56,7 @@ public function testFriendlyAjaxValidation() { 'entity_type' => 'node', 'bundle' => 'article', 'field_name' => 'field_dummy_select', - 'label' => t('Dummy select'), + 'label' => 'Dummy select', ])->save(); \Drupal::entityTypeManager() diff --git a/core/modules/jsonapi/tests/src/Functional/ActionTest.php b/core/modules/jsonapi/tests/src/Functional/ActionTest.php index 4fcc0e9e2bb75ccb238214bd23b6eb130238781c..9450f274ec66d2eaabfaedfe288b1e3f9a7ec53e 100644 --- a/core/modules/jsonapi/tests/src/Functional/ActionTest.php +++ b/core/modules/jsonapi/tests/src/Functional/ActionTest.php @@ -54,7 +54,7 @@ protected function createEntity() { $action = Action::create([ 'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID, 'type' => 'user', - 'label' => t('Add the anonymous role to the selected users'), + 'label' => 'Add the anonymous role to the selected users', 'configuration' => [ 'rid' => RoleInterface::ANONYMOUS_ID, ], diff --git a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php index 6267a483364b9cacd1442769d8df1d7304c5bc2e..c03a78ab651b13e3a6fc8f9a2ad34ca0f6358ac2 100644 --- a/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php +++ b/core/modules/jsonapi/tests/src/Functional/ShortcutTest.php @@ -65,7 +65,7 @@ protected function setUpAuthorization($method) { protected function createEntity() { $shortcut = Shortcut::create([ 'shortcut_set' => 'default', - 'title' => t('Comments'), + 'title' => 'Comments', 'weight' => -20, 'link' => [ 'uri' => 'internal:/user/logout', diff --git a/core/modules/language/tests/src/Functional/ConfigurableLanguageManagerTest.php b/core/modules/language/tests/src/Functional/ConfigurableLanguageManagerTest.php index 6a8dd1571906f49176a51dea66e080aa0453dc77..d6b71e3a36a5b5f7029d9e3dd833fbfa9c7173a2 100644 --- a/core/modules/language/tests/src/Functional/ConfigurableLanguageManagerTest.php +++ b/core/modules/language/tests/src/Functional/ConfigurableLanguageManagerTest.php @@ -53,7 +53,7 @@ protected function setUp(): void { // Create a page node type and make it translatable. NodeType::create([ 'type' => 'page', - 'name' => t('Page'), + 'name' => 'Page', ])->save(); $config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'page'); diff --git a/core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php b/core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php index 64028cf28c95f208c178563ef3b441f8b269f658..a01d65dba157d8c067cd686f2dbd60bd640208e3 100644 --- a/core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php +++ b/core/modules/language/tests/src/Functional/LanguageBreadcrumbTest.php @@ -40,7 +40,7 @@ protected function setUp(): void { public function testBreadCrumbs() { // Prepare common base breadcrumb elements. $home = ['' => 'Home']; - $admin = $home + ['admin' => t('Administration')]; + $admin = $home + ['admin' => 'Administration']; $page = $this->getSession()->getPage(); diff --git a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php index bf19edd0961eb8cb5fe1244d24923849a18c5df8..c1a561550d8a9c6e1f8a70f1bd53c4ffc252562a 100644 --- a/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleUpdateInterfaceTest.php @@ -3,7 +3,6 @@ namespace Drupal\Tests\locale\Functional; use Drupal\Core\Url; -use Drupal\Component\Render\FormattableMarkup; /** * Tests for the user interface of project interface translations. @@ -97,12 +96,7 @@ public function testInterface() { $this->assertSession()->linkByHrefExists(Url::fromRoute('locale.translate_status')->toString()); $this->drupalGet('admin/reports/translations'); $this->assertSession()->pageTextContains('Missing translations for one project'); - $release_details = new FormattableMarkup('@module (@version). @info', [ - '@module' => 'Locale test translate', - '@version' => '1.3-dev', - '@info' => t('File not found at %local_path', ['%local_path' => 'core/modules/locale/tests/test.de.po']), - ]); - $this->assertSession()->responseContains($release_details->__toString()); + $this->assertSession()->pageTextContains('Locale test translate (1.3-dev). File not found at core/modules/locale/tests/test.de.po'); // Override Drupal core translation status as 'no translations found'. $status = locale_translation_get_status(); diff --git a/core/modules/media/tests/src/Kernel/MediaSourceTest.php b/core/modules/media/tests/src/Kernel/MediaSourceTest.php index cf6a75cae70e19f253dadc367f1c2eb8f6f6694f..07e764544848e083b205460f28fa25a52c212c9d 100644 --- a/core/modules/media/tests/src/Kernel/MediaSourceTest.php +++ b/core/modules/media/tests/src/Kernel/MediaSourceTest.php @@ -582,7 +582,7 @@ protected function createMediaTypeViaForm($source_plugin_id, $field_name) { $form_state->setValues([ 'label' => 'Test type', 'id' => $source_plugin_id, - 'op' => t('Save'), + 'op' => 'Save', ]); /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $field_manager */ 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 87e6c684f2f1894ad10875989ca38203c712248b..cd7b6aaaeb5f3dd5c92fdcd0773c12850e9ae9b7 100644 --- a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php +++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentDeleteFormTest.php @@ -41,7 +41,7 @@ public function testMenuLinkContentDeleteForm() { // Add new menu item. $this->drupalGet('admin/structure/menu/manage/admin/add'); $this->submitForm([ - 'title[0][value]' => t('Front page'), + 'title[0][value]' => 'Front page', 'link[0][uri]' => '<front>', ], 'Save'); $this->assertSession()->pageTextContains('The menu link has been saved.'); 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 b57bc58d55c71a320ab70c17da4084fa5fa12013..d4e47cc3a70a80727407c3fd69f172b2ecafe6c0 100644 --- a/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php +++ b/core/modules/menu_link_content/tests/src/Functional/MenuLinkContentFormTest.php @@ -89,7 +89,7 @@ public function testMenuLinkContentForm() { $this->assertSession()->pageTextContains('The location this menu link points to.'); $this->submitForm([ - 'title[0][value]' => t('Front page'), + 'title[0][value]' => 'Front page', 'link[0][uri]' => '<front>', ], 'Save'); $this->assertSession()->pageTextContains('The menu link has been saved.'); @@ -101,7 +101,7 @@ public function testMenuLinkContentForm() { public function testMenuLinkContentFormValidation() { $this->drupalGet('admin/structure/menu/manage/admin/add'); $this->submitForm([ - 'title[0][value]' => t('Test page'), + 'title[0][value]' => 'Test page', 'link[0][uri]' => '<test>', ], 'Save'); $this->assertSession()->pageTextContains('Manually entered paths should start with one of the following characters: / ? #'); diff --git a/core/modules/menu_ui/tests/src/Functional/MenuUiContentModerationTest.php b/core/modules/menu_ui/tests/src/Functional/MenuUiContentModerationTest.php index 02d8d038f3c4414f077e03c061ac8c936cd8962d..2491150a6f5a6edce8b4af0f10d257bb632682a0 100644 --- a/core/modules/menu_ui/tests/src/Functional/MenuUiContentModerationTest.php +++ b/core/modules/menu_ui/tests/src/Functional/MenuUiContentModerationTest.php @@ -74,13 +74,13 @@ public function testMenuUiWithPendingRevisions() { // Publish the node with no changes. $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm([], 'Save'); - $this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()])); + $this->assertSession()->pageTextContains("Page {$node->label()} has been updated."); // Create a pending revision with no changes. $edit = ['moderation_state[0][state]' => 'draft']; $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Save'); - $this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()])); + $this->assertSession()->pageTextContains("Page {$node->label()} has been updated."); // Add a menu link and save a new default (published) revision. $edit = [ @@ -138,7 +138,7 @@ public function testMenuUiWithPendingRevisions() { ]; $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Save'); - $this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()])); + $this->assertSession()->pageTextContains("Page {$node->label()} has been updated."); // Ensure the content was not immediately published. $this->assertSession()->linkExists('Test menu link'); @@ -164,7 +164,7 @@ public function testMenuUiWithPendingRevisions() { $edit = ['moderation_state[0][state]' => 'published']; $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Save'); - $this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()])); + $this->assertSession()->pageTextContains("Page {$node->label()} has been updated."); // Add a menu link and save and create a new non-default (draft) revision // and ensure it's not immediately published. @@ -175,7 +175,7 @@ public function testMenuUiWithPendingRevisions() { ]; $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Save'); - $this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()])); + $this->assertSession()->pageTextContains("Page {$node->label()} has been updated."); $this->assertSession()->linkNotExists('Second test menu link'); // Publish the content and ensure the new menu link shows up. @@ -184,7 +184,7 @@ public function testMenuUiWithPendingRevisions() { ]; $this->drupalGet('node/' . $node->id() . '/edit'); $this->submitForm($edit, 'Save'); - $this->assertSession()->responseContains(t('Page %label has been updated.', ['%label' => $node->toLink($node->label())->toString()])); + $this->assertSession()->pageTextContains("Page {$node->label()} has been updated."); $this->assertSession()->linkExists('Second test menu link'); } diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php index 4da757565387105046c69ba74ec1d4609dc0e9d2..87731aadb09d1d8a642dc319497d90478d267cf9 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php @@ -146,16 +146,16 @@ class TestDrupal6SqlBase extends DrupalSqlBase { */ public function fields() { return [ - 'filename' => t('The path of the primary file for this item.'), - 'name' => t('The name of the item; e.g. node.'), - 'type' => t('The type of the item, either module, theme, or theme_engine.'), - 'owner' => t("A theme's 'parent'. Can be either a theme or an engine."), - 'status' => t('Boolean indicating whether or not this item is enabled.'), - 'throttle' => t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'), - 'bootstrap' => t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."), - 'schema_version' => t("The module's database schema version number."), - 'weight' => t("The order in which this module's hooks should be invoked."), - 'info' => t("A serialized array containing information from the module's .info file."), + 'filename' => $this->t('The path of the primary file for this item.'), + 'name' => $this->t('The name of the item; e.g. node.'), + 'type' => $this->t('The type of the item, either module, theme, or theme_engine.'), + 'owner' => $this->t("A theme's 'parent'. Can be either a theme or an engine."), + 'status' => $this->t('Boolean indicating whether or not this item is enabled.'), + 'throttle' => $this->t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'), + 'bootstrap' => $this->t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."), + 'schema_version' => $this->t("The module's database schema version number."), + 'weight' => $this->t("The order in which this module's hooks should be invoked."), + 'info' => $this->t("A serialized array containing information from the module's .info file."), ]; } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php index 9fa261d2a31c88adb566a81e78d31f4361ff6e82..e6768723eb8a36af20fc7edf358b1513c18cf2c2 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/SourceProviderTest.php @@ -32,8 +32,8 @@ public function testSourceProvider($path_to_database) { $this->submitCredentialForm(); // Ensure we get errors about missing modules. - $session->pageTextContains(t('Resolve all issues below to continue the upgrade.')); - $session->pageTextContains(t('The no_source_module plugin must define the source_module property.')); + $session->pageTextContains('Resolve all issues below to continue the upgrade.'); + $session->pageTextContains('The no_source_module plugin must define the source_module property.'); // Uninstall the module causing the missing module error messages. $this->container->get('module_installer') @@ -45,10 +45,10 @@ public function testSourceProvider($path_to_database) { $this->submitForm($this->edits, 'Review upgrade'); // Ensure there are no errors about missing modules from the test module. - $session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.')); - $session->pageTextNotContains(t('Source module not found for migration_provider_test.')); + $session->pageTextNotContains('Source module not found for migration_provider_no_annotation.'); + $session->pageTextNotContains('Source module not found for migration_provider_test.'); // Ensure there are no errors about any other missing migration providers. - $session->pageTextNotContains(t('module not found')); + $session->pageTextNotContains('module not found'); } /** diff --git a/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php index 7b6889d9c3468a0743c318789b20e552e159019f..a20379f1682213a4448009b3e542427f0d26e96b 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php @@ -108,7 +108,7 @@ public function testNodeAccessBasic() { $this->drupalLogin($this->webUser); foreach ([0 => 'Public', 1 => 'Private'] as $is_private => $type) { $edit = [ - 'title[0][value]' => t('@private_public Article created by @user', ['@private_public' => $type, '@user' => $this->webUser->getAccountName()]), + 'title[0][value]' => "$type Article created by " . $this->webUser->getAccountName(), ]; if ($is_private) { $edit['private[0][value]'] = TRUE; diff --git a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php index c47c35dda157fa5cb9f869e97f82d7d408051f9a..9000a1f6617beddf1478c099410cb0c728656f8c 100644 --- a/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php +++ b/core/modules/node/tests/src/Functional/NodeAccessPagerTest.php @@ -32,7 +32,7 @@ protected function setUp(): void { parent::setUp(); node_access_rebuild(); - $this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]); + $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); $this->addDefaultCommentField('node', 'page'); $this->webUser = $this->drupalCreateUser([ 'access content', diff --git a/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php b/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php index e1357d705bfa4511f616ef27ef96e587afa063ac..25a2758717b2ed4de1f5a784a55bd4d88bd7822c 100644 --- a/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php +++ b/core/modules/node/tests/src/Functional/NodeEntityViewModeAlterTest.php @@ -37,8 +37,8 @@ public function testNodeViewModeChange() { // Create a node. $edit = []; $edit['title[0][value]'] = $this->randomMachineName(8); - $edit['body[0][value]'] = t('Data that should appear only in the body for the node.'); - $edit['body[0][summary]'] = t('Extra data that should appear only in the teaser for the node.'); + $edit['body[0][value]'] = 'Data that should appear only in the body for the node.'; + $edit['body[0][summary]'] = 'Extra data that should appear only in the teaser for the node.'; $this->drupalGet('node/add/page'); $this->submitForm($edit, 'Save'); diff --git a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php index 1fd49d3eb67b1915d6390f32a35f6953ffb63e34..a7a1ad4e88fcbbfdd6402b9a059112ee913121c1 100644 --- a/core/modules/node/tests/src/Functional/NodeRSSContentTest.php +++ b/core/modules/node/tests/src/Functional/NodeRSSContentTest.php @@ -60,7 +60,7 @@ public function testNodeRSSContent() { $this->assertSession()->responseNotContains($non_rss_content); // Check that extra RSS elements and namespaces are added to RSS feed. - $test_element = '<testElement>' . t('Value of testElement RSS element for node @nid.', ['@nid' => $node->id()]) . '</testElement>'; + $test_element = "<testElement>Value of testElement RSS element for node {$node->id()}.</testElement>"; $test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"'; $this->assertSession()->responseContains($test_element); $this->assertSession()->responseContains($test_ns); diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php index 624c70906c83139049af2c76197aaa9aefbd9866..8934c958d920a1131a465a61785cd985e1faf782 100644 --- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php +++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php @@ -456,7 +456,7 @@ protected function getFormSubmitSuffix(EntityInterface $entity, $langcode) { if (!$entity->isNew() && $entity->isTranslatable()) { $translations = $entity->getTranslationLanguages(); if ((count($translations) > 1 || !isset($translations[$langcode])) && ($field = $entity->getFieldDefinition('status'))) { - return ' ' . ($field->isTranslatable() ? t('(this translation)') : t('(all translations)')); + return ' ' . ($field->isTranslatable() ? '(this translation)' : '(all translations)'); } } return ''; diff --git a/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php b/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php index a7b8b7f37854bbede17f47333d5a886fc5f7530e..30e75d63cb9a9161ff27219065478a1364a283ae 100644 --- a/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php +++ b/core/modules/node/tests/src/Functional/Views/FilterNodeAccessTest.php @@ -68,7 +68,7 @@ protected function setUp($import_test_views = TRUE): void { 'format' => filter_default_format(), ], ], - 'title' => t('@private_public Article created by @user', ['@private_public' => $type, '@user' => $web_user->getAccountName()]), + 'title' => "$type Article created by " . $web_user->getAccountName(), 'type' => 'article', 'uid' => $web_user->id(), 'private' => (bool) $is_private, diff --git a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php index 1a5cfb93498b16d2239b8822f4e05989e875603c..821727d1993afe0e5a2380640c64c0d93e8558de 100644 --- a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php +++ b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php @@ -28,7 +28,7 @@ protected function setUp(): void { // Create a Tags vocabulary for the Article node type. $vocabulary = Vocabulary::create([ - 'name' => t('Tags'), + 'name' => 'Tags', 'vid' => 'tags', ]); $vocabulary->save(); diff --git a/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php b/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php index ab0b75c7ae6661279e62841e27cbaa7530af64d2..e4cc514c241c9f1829310abf0ec1071ca462c3b3 100644 --- a/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php +++ b/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php @@ -77,7 +77,7 @@ public function testCustomPipeline() { 'body[0][summary]' => '', 'body[0][value]' => '<p>Fine thanks.</p>', 'body[0][format]' => 'filtered_html', - 'op' => t('Save'), + 'op' => 'Save', ]; // Assume there is another field on this page, which doesn't use a custom // render pipeline, but the default one, and it uses the "full" view mode. diff --git a/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php b/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php index fcf9de0c0d414f370c2a2f2da97ac13d02b3b079..1cb90adf40db13966eda6296620ee770f5b71b60 100644 --- a/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php +++ b/core/modules/quickedit/tests/src/Functional/QuickEditEndPointAccessTest.php @@ -61,7 +61,7 @@ public function testEndPointAccess() { $edit['body[0][summary]'] = ''; $edit['body[0][value]'] = '<p>Malicious content.</p>'; $edit['body[0][format]'] = 'filtered_html'; - $edit['op'] = t('Save'); + $edit['op'] = 'Save'; $this->assertAccessIsBlocked($url, $edit); $post = ['nocssjs' => 'true']; diff --git a/core/modules/quickedit/tests/src/Functional/QuickEditImageControllerTest.php b/core/modules/quickedit/tests/src/Functional/QuickEditImageControllerTest.php index 7642f6fcf0d08ff94d65b7371265e972a54aa301..a1e3932c6d5cfd464bbeab2a04034ac800d17059 100644 --- a/core/modules/quickedit/tests/src/Functional/QuickEditImageControllerTest.php +++ b/core/modules/quickedit/tests/src/Functional/QuickEditImageControllerTest.php @@ -83,7 +83,7 @@ public function testAccess() { // Create a test Node. $node = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('Test Node'), + 'title' => 'Test Node', ]); $this->drupalGet('quickedit/image/info/node/' . $node->id() . '/' . $this->fieldName . '/' . $node->language()->getId() . '/default'); $this->assertSession()->statusCodeEquals(403); @@ -101,7 +101,7 @@ public function testFieldInfo() { // Create a test Node. $node = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('Test Node'), + 'title' => 'Test Node', ]); $json = $this->drupalGet('quickedit/image/info/node/' . $node->id() . '/' . $this->fieldName . '/' . $node->language()->getId() . '/default', ['query' => ['_format' => 'json']]); $info = Json::decode($json); @@ -118,7 +118,7 @@ public function testValidImageUpload() { // Create a test Node. $node = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('Test Node'), + 'title' => 'Test Node', ]); // We want a test image that is a valid size. @@ -145,7 +145,7 @@ public function testInvalidUpload() { // Create a test Node. $node = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('Test Node'), + 'title' => 'Test Node', ]); // We want a test image that will fail validation. diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php index 2d48df5b66c2b7c1bdf90b15e688d420c30cee05..daa5a192c4d9a36793da9e072b73542b1f6e1b05 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php @@ -70,7 +70,7 @@ protected function setUp(): void { $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']); $this->article = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('My Test Node'), + 'title' => 'My Test Node', 'body' => [ 'value' => 'Hello Layout Builder!', 'format' => 'plain_text', diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditFileTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditFileTest.php index f6a12e36073cfb2c9301a208e6db6f57ac34fc2d..53fad46e43be8a9ddde751b355319e0ffdcc1b86 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditFileTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditFileTest.php @@ -70,7 +70,7 @@ public function testRemove() { // Create test node. $node = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('My Test Node'), + 'title' => 'My Test Node', 'field_file' => [ 'target_id' => $file->id(), ], diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditImageTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditImageTest.php index 198ddf52dda45a853fca52a1ae669ba54b729942..7ed590965248fef7b4ea11c3edb98f518fb857ad 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditImageTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditImageTest.php @@ -104,7 +104,7 @@ public function testImageInPlaceEditor($admin_permission = FALSE) { $image = $image_factory->get($valid_images[0]->uri); $node = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('Test Node'), + 'title' => 'Test Node', $field_name => [ 'target_id' => $file->id(), 'alt' => 'Hello world', diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php index 3669dfa9256e4c1a1fba8f5362821318c8f2bb53..2ee31915478c5dbdbe49dc94bfa94b4f688cb2fb 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php @@ -127,7 +127,7 @@ public function testArticleNode() { $node = $this->drupalCreateNode([ 'type' => 'article', - 'title' => t('My Test Node'), + 'title' => 'My Test Node', 'body' => [ 'value' => '<p>Hello world!</p><p>I do not know what to say…</p><p>I wish I were eloquent.</p>', 'format' => 'some_format', diff --git a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php index 86e95b75e67da2c138ac6c340eabe4173302a295..18e59f1b46e74c8f409c99516a73d31b14e40cbb 100644 --- a/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php +++ b/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php @@ -354,7 +354,7 @@ public function testImageField() { FieldConfig::create([ 'field_name' => 'field_image', 'field_type' => 'image', - 'label' => t('Image'), + 'label' => 'Image', 'entity_type' => 'node', 'bundle' => 'article', ])->save(); diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php index b6e924bd3edf9004741ea5d20e14ea70aaef57f0..bcafe2c4b23d08fc66f74f0525e3d291959b13c7 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutCacheTagsTest.php @@ -54,7 +54,7 @@ protected function createEntity() { // Create a "Llama" shortcut. $shortcut = Shortcut::create([ 'shortcut_set' => 'default', - 'title' => t('Llama'), + 'title' => 'Llama', 'weight' => 0, 'link' => [['uri' => 'internal:/admin']], ]); diff --git a/core/modules/statistics/tests/src/Functional/StatisticsTokenReplaceTest.php b/core/modules/statistics/tests/src/Functional/StatisticsTokenReplaceTest.php index 160650bc61446687cddaa0269d1d1f4576e85983..879f16cc90bc6c7ee5d96dc548ef7ae9a7b96474 100644 --- a/core/modules/statistics/tests/src/Functional/StatisticsTokenReplaceTest.php +++ b/core/modules/statistics/tests/src/Functional/StatisticsTokenReplaceTest.php @@ -36,7 +36,7 @@ public function testStatisticsTokenReplacement() { $tests = []; $tests['[node:total-count]'] = 0; $tests['[node:day-count]'] = 0; - $tests['[node:last-view]'] = t('never'); + $tests['[node:last-view]'] = 'never'; $tests['[node:last-view:short]'] = $date_formatter->format($request_time, 'short'); foreach ($tests as $input => $expected) { diff --git a/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php b/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php index f38ea7a2fca18e4cb23acf80a2479e5b0425b758..6d20a2e4cb125ccec38489a058a7d9a9bc5f5039 100644 --- a/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php +++ b/core/modules/system/tests/src/Functional/Database/SelectTableSortDefaultTest.php @@ -24,10 +24,10 @@ class SelectTableSortDefaultTest extends DatabaseTestBase { */ public function testTableSortQuery() { $sorts = [ - ['field' => t('Task ID'), 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'], - ['field' => t('Task ID'), 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'], - ['field' => t('Task'), 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'], - ['field' => t('Task'), 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'], + ['field' => 'Task ID', 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'], + ['field' => 'Task ID', 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'], + ['field' => 'Task', 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'], + ['field' => 'Task', 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'], // more elements here ]; @@ -52,10 +52,10 @@ public function testTableSortQuery() { */ public function testTableSortQueryFirst() { $sorts = [ - ['field' => t('Task ID'), 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'], - ['field' => t('Task ID'), 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'], - ['field' => t('Task'), 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'], - ['field' => t('Task'), 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'], + ['field' => 'Task ID', 'sort' => 'desc', 'first' => 'perform at superbowl', 'last' => 'eat'], + ['field' => 'Task ID', 'sort' => 'asc', 'first' => 'eat', 'last' => 'perform at superbowl'], + ['field' => 'Task', 'sort' => 'asc', 'first' => 'code', 'last' => 'sleep'], + ['field' => 'Task', 'sort' => 'desc', 'first' => 'sleep', 'last' => 'code'], // more elements here ]; diff --git a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php index 76be86fcac4a2e59b3642887be95fe29d20c6405..f20a753b719d0d8239190c23af613d77d3ffcb24 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php @@ -216,7 +216,7 @@ private function formSubmitHelper($form, $edit) { $form_id = $this->randomMachineName(); $form_state = new FormState(); - $form['op'] = ['#type' => 'submit', '#value' => t('Submit')]; + $form['op'] = ['#type' => 'submit', '#value' => 'Submit']; // The form token CSRF protection should not interfere with this test, so we // bypass it by setting the token to FALSE. $form['#token'] = FALSE; diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php index 47416c0dba35057f7a884454104ae372170eec5c..860ff8dd007782384a64875528f93d53cee03670 100644 --- a/core/modules/system/tests/src/Functional/Form/FormTest.php +++ b/core/modules/system/tests/src/Functional/Form/FormTest.php @@ -85,7 +85,7 @@ public function testRequiredFields() { $elements['textarea']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'textarea']; $elements['textarea']['empty_values'] = $empty_strings; - $elements['radios']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'radios', '#options' => ['' => t('None'), $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]]; + $elements['radios']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'radios', '#options' => ['' => 'None', $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]]; $elements['radios']['empty_values'] = $empty_arrays; $elements['checkbox']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'checkbox', '#required' => TRUE]; @@ -94,7 +94,7 @@ public function testRequiredFields() { $elements['checkboxes']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'checkboxes', '#options' => [$this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]]; $elements['checkboxes']['empty_values'] = $empty_arrays; - $elements['select']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'select', '#options' => ['' => t('None'), $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]]; + $elements['select']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'select', '#options' => ['' => 'None', $this->randomMachineName(), $this->randomMachineName(), $this->randomMachineName()]]; $elements['select']['empty_values'] = $empty_strings; $elements['file']['element'] = ['#title' => $this->randomMachineName(), '#type' => 'file']; @@ -109,7 +109,7 @@ public function testRequiredFields() { $form_id = $this->randomMachineName(); $form = []; $form_state = new FormState(); - $form['op'] = ['#type' => 'submit', '#value' => t('Submit')]; + $form['op'] = ['#type' => 'submit', '#value' => 'Submit']; $element = $data['element']['#title']; $form[$element] = $data['element']; $form[$element]['#required'] = $required; @@ -185,7 +185,7 @@ public function testRequiredCheckboxesRadio() { $expected[] = $form[$key]['#form_test_required_error']; } else { - $expected[] = t('@name field is required.', ['@name' => $form[$key]['#title']]); + $expected[] = $form[$key]['#title'] . ' field is required.'; } } diff --git a/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php b/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php index 02331c47c7abd5c55d87972f36fd3a27a6fafb0a..fa623992416d5a8e37de5c2417770d6ccc2e7367 100644 --- a/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php +++ b/core/modules/system/tests/src/Functional/Form/LanguageSelectElementTest.php @@ -58,7 +58,7 @@ public function testLanguageSelectElementOptions() { /** @var \Drupal\Core\Language\LanguageManagerInterface $language_manager */ $language_manager = $this->container->get('language_manager'); foreach ($language_manager->getLanguages($flags) as $langcode => $language) { - $options[$langcode] = $language->isLocked() ? t('- @name -', ['@name' => $language->getName()]) : $language->getName(); + $options[$langcode] = $language->isLocked() ? "- {$language->getName()} -" : $language->getName(); } $this->_testLanguageSelectElementOptions($id, $options); } diff --git a/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php b/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php index 849399fd230b521953439c18a30bf9d7159bcd8f..12461125711aff76972e4b0067e861c83a7b3d45 100644 --- a/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php +++ b/core/modules/system/tests/src/Functional/Menu/BreadcrumbTest.php @@ -68,62 +68,62 @@ protected function setUp(): void { public function testBreadCrumbs() { // Prepare common base breadcrumb elements. $home = ['' => 'Home']; - $admin = $home + ['admin' => t('Administration')]; - $config = $admin + ['admin/config' => t('Configuration')]; + $admin = $home + ['admin' => 'Administration']; + $config = $admin + ['admin/config' => 'Configuration']; $type = 'article'; // Verify Taxonomy administration breadcrumbs. $trail = $admin + [ - 'admin/structure' => t('Structure'), + 'admin/structure' => 'Structure', ]; $this->assertBreadcrumb('admin/structure/taxonomy', $trail); $trail += [ - 'admin/structure/taxonomy' => t('Taxonomy'), + 'admin/structure/taxonomy' => 'Taxonomy', ]; $this->assertBreadcrumb('admin/structure/taxonomy/manage/tags', $trail); $trail += [ - 'admin/structure/taxonomy/manage/tags' => t('Edit Tags'), + 'admin/structure/taxonomy/manage/tags' => 'Edit Tags', ]; $this->assertBreadcrumb('admin/structure/taxonomy/manage/tags/overview', $trail); $this->assertBreadcrumb('admin/structure/taxonomy/manage/tags/add', $trail); // Verify Menu administration breadcrumbs. $trail = $admin + [ - 'admin/structure' => t('Structure'), + 'admin/structure' => 'Structure', ]; $this->assertBreadcrumb('admin/structure/menu', $trail); $trail += [ - 'admin/structure/menu' => t('Menus'), + 'admin/structure/menu' => 'Menus', ]; $this->assertBreadcrumb('admin/structure/menu/manage/tools', $trail); $trail += [ - 'admin/structure/menu/manage/tools' => t('Tools'), + 'admin/structure/menu/manage/tools' => 'Tools', ]; $this->assertBreadcrumb("admin/structure/menu/link/node.add_page/edit", $trail); $this->assertBreadcrumb('admin/structure/menu/manage/tools/add', $trail); // Verify Node administration breadcrumbs. $trail = $admin + [ - 'admin/structure' => t('Structure'), - 'admin/structure/types' => t('Content types'), + 'admin/structure' => 'Structure', + 'admin/structure/types' => 'Content types', ]; $this->assertBreadcrumb('admin/structure/types/add', $trail); $this->assertBreadcrumb("admin/structure/types/manage/$type", $trail); $trail += [ - "admin/structure/types/manage/$type" => t('Article'), + "admin/structure/types/manage/$type" => 'Article', ]; $this->assertBreadcrumb("admin/structure/types/manage/$type/fields", $trail); $this->assertBreadcrumb("admin/structure/types/manage/$type/display", $trail); $trail_teaser = $trail + [ - "admin/structure/types/manage/$type/display" => t('Manage display'), + "admin/structure/types/manage/$type/display" => 'Manage display', ]; $this->assertBreadcrumb("admin/structure/types/manage/$type/display/teaser", $trail_teaser); $this->assertBreadcrumb("admin/structure/types/manage/$type/delete", $trail); $trail += [ - "admin/structure/types/manage/$type/fields" => t('Manage fields'), + "admin/structure/types/manage/$type/fields" => 'Manage fields', ]; $this->assertBreadcrumb("admin/structure/types/manage/$type/fields/node.$type.body", $trail); @@ -132,12 +132,12 @@ public function testBreadCrumbs() { $format = reset($filter_formats); $format_id = $format->id(); $trail = $config + [ - 'admin/config/content' => t('Content authoring'), + 'admin/config/content' => 'Content authoring', ]; $this->assertBreadcrumb('admin/config/content/formats', $trail); $trail += [ - 'admin/config/content/formats' => t('Text formats and editors'), + 'admin/config/content/formats' => 'Text formats and editors', ]; $this->assertBreadcrumb('admin/config/content/formats/add', $trail); $this->assertBreadcrumb("admin/config/content/formats/manage/$format_id", $trail); @@ -379,7 +379,7 @@ public function testBreadCrumbs() { $this->assertSession()->statusCodeNotEquals(403); // Since the Reports page is accessible, that will show. - $trail += ['admin/reports' => t('Reports')]; + $trail += ['admin/reports' => 'Reports']; $this->assertBreadcrumb('admin/reports/dblog', $trail, 'Recent log messages'); $this->assertSession()->statusCodeNotEquals(403); @@ -395,7 +395,7 @@ public function testBreadCrumbs() { public function testAssertBreadcrumbTrait() { // Ensure the test trait works as expected using menu_test routes. $home = ['' => 'Home']; - $trail = $home + ['menu-test' => t('Menu test root')]; + $trail = $home + ['menu-test' => 'Menu test root']; // Test a passing assertion. $this->assertBreadcrumb('menu-test/breadcrumb1', $trail); diff --git a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php index 1400fb0561ee27a954620a77ed4659beff7e10b9..0503da1715ec907d12834b78bd8a80ffc4d65c22 100644 --- a/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php +++ b/core/modules/system/tests/src/Functional/System/SiteMaintenanceTest.php @@ -54,12 +54,12 @@ protected function setUp(): void { public function testSiteMaintenance() { // Verify that permission message is displayed. - $permission_handler = $this->container->get('user.permissions'); - $permissions = $permission_handler->getPermissions(); - $permission_label = $permissions['access site in maintenance mode']['title']; - $permission_message = t('Visitors will only see the maintenance mode message. Only users with the "@permission-label" <a href=":permissions-url">permission</a> will be able to access the site. Authorized users can log in directly via the <a href=":user-login">user login</a> page.', ['@permission-label' => $permission_label, ':permissions-url' => Url::fromRoute('user.admin_permissions')->toString(), ':user-login' => Url::fromRoute('user.login')->toString()]); $this->drupalGet(Url::fromRoute('system.site_maintenance_mode')); - $this->assertSession()->responseContains($permission_message); + $this->assertSession()->pageTextContains('Visitors will only see the maintenance mode message. Only users with the "Use the site in maintenance mode" permission will be able to access the site. Authorized users can log in directly via the user login page.'); + $this->assertSession()->linkExists('permission'); + $this->assertSession()->linkByHrefExists(Url::fromRoute('user.admin_permissions')->toString()); + $this->assertSession()->linkExists('user login'); + $this->assertSession()->linkByHrefExists(Url::fromRoute('user.login')->toString()); $this->drupalGet(Url::fromRoute('user.page')); // JS should be aggregated, so drupal.js is not in the page source. @@ -72,7 +72,7 @@ public function testSiteMaintenance() { $this->drupalGet('admin/config/development/maintenance'); $this->submitForm($edit, 'Save configuration'); - $admin_message = t('Operating in maintenance mode. <a href=":url">Go online.</a>', [':url' => Url::fromRoute('system.site_maintenance_mode')->toString()]); + $admin_message = 'Operating in maintenance mode. Go online.'; $user_message = 'Operating in maintenance mode.'; $offline_message = $this->config('system.site')->get('name') . ' is currently under maintenance. We should be back shortly. Thank you for your patience.'; @@ -80,7 +80,9 @@ public function testSiteMaintenance() { // JS should not be aggregated, so drupal.js is expected in the page source. $links = $this->xpath('//script[contains(@src, :href)]', [':href' => '/core/misc/drupal.js']); $this->assertTrue(isset($links[0]), 'script /core/misc/drupal.js in page'); - $this->assertSession()->responseContains($admin_message); + $this->assertSession()->pageTextContains($admin_message); + $this->assertSession()->linkExists('Go online.'); + $this->assertSession()->linkByHrefExists(Url::fromRoute('system.site_maintenance_mode')->toString()); // Logout and verify that offline message is displayed. $this->drupalLogout(); @@ -113,7 +115,7 @@ public function testSiteMaintenance() { $this->drupalLogout(); $this->drupalLogin($this->adminUser); $this->drupalGet('admin/config/development/maintenance'); - $this->assertSession()->responseNotContains($admin_message); + $this->assertSession()->pageTextNotContains($admin_message); $offline_message = 'Sorry, not online.'; $edit = [ diff --git a/core/modules/system/tests/src/Kernel/Action/ActionTest.php b/core/modules/system/tests/src/Kernel/Action/ActionTest.php index 47d39cdbd24048a648e51817d623e527b3e2d1a2..2dac37555cec52d73f7476076ab4dd4176800d53 100644 --- a/core/modules/system/tests/src/Kernel/Action/ActionTest.php +++ b/core/modules/system/tests/src/Kernel/Action/ActionTest.php @@ -80,7 +80,7 @@ public function testDependencies() { $action = Action::create([ 'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID, 'type' => 'user', - 'label' => t('Add the anonymous role to the selected users'), + 'label' => 'Add the anonymous role to the selected users', 'configuration' => [ 'rid' => RoleInterface::ANONYMOUS_ID, ], diff --git a/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php b/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php index c924b55676f2c1bb7e015875fc69353497a092bf..4cb67b5425e059919bc3159c949f85985d91ac01 100644 --- a/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php +++ b/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php @@ -76,7 +76,7 @@ protected function doSubmitForm($values, $valid_input) { $valid_form = empty($errors); $args = [ '%values' => print_r($values, TRUE), - '%errors' => $valid_form ? t('None') : implode(' ', $errors), + '%errors' => $valid_form ? 'None' : implode(' ', $errors), ]; $this->assertSame($valid_form, $valid_input, new FormattableMarkup('Input values: %values<br />Validation handler errors: %errors', $args)); diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php index c96ec87df6ed2f20dd8703963a7e044425c81ad9..1794ecde34cf3a8a73e4fe8e2ee6be547af15c87 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyPermissionsTest.php @@ -73,8 +73,9 @@ public function testTaxonomyVocabularyOverviewPermissions() { $this->createTerm($vocabulary1); // Assert expected help texts on first vocabulary. - $edit_help_text = t('You can reorganize the terms in @capital_name using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent.', ['@capital_name' => Unicode::ucfirst($vocabulary1->label())]); - $no_edit_help_text = t('@capital_name contains the following terms.', ['@capital_name' => Unicode::ucfirst($vocabulary1->label())]); + $vocabulary1_label = Unicode::ucfirst($vocabulary1->label()); + $edit_help_text = "You can reorganize the terms in $vocabulary1_label using their drag-and-drop handles, and group terms under a parent term by sliding them under and to the right of the parent."; + $no_edit_help_text = "$vocabulary1_label contains the following terms."; $assert_session = $this->assertSession(); diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php index 9bcf06075f5e580e61878d5cf94590b428ce0168..4eb7cecce8b9cfbaba80ac5ab85eb2f33ffd1aa1 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyTranslationTest.php @@ -87,7 +87,7 @@ public function testVocabularyTitleLabelTranslation(): void { $edit['langcode'] = 'en'; $edit['vid'] = $vid; $edit['default_language[content_translation]'] = TRUE; - $this->submitForm($edit, t('Save')); + $this->submitForm($edit, 'Save'); $langcode = $this->additionalLangcodes[0]; $vid_name = $edit['name']; @@ -100,7 +100,7 @@ public function testVocabularyTitleLabelTranslation(): void { $this->drupalGet("admin/structure/taxonomy/manage/$vid/translate/$langcode/add"); // Translate the name label. - $this->submitForm(["translation[config_names][taxonomy.vocabulary.$vid][name]" => $translated_vid_name], t('Save translation')); + $this->submitForm(["translation[config_names][taxonomy.vocabulary.$vid][name]" => $translated_vid_name], 'Save translation'); // Assert that the right name label is displayed on the taxonomy term // overview page. diff --git a/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php b/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php index e3921eb0307f72c0311dfc99ece88baef2132892..e06fd4cd14c5947a5f019abe0389d2a0de318d88 100644 --- a/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php +++ b/core/modules/tracker/tests/src/Functional/TrackerNodeAccessTest.php @@ -50,7 +50,7 @@ public function testTrackerNodeAccessIndexing() { // queries run for the anonymous user will miss it. $author = $this->drupalCreateUser(); $private_node = $this->drupalCreateNode([ - 'title' => t('Private node test'), + 'title' => 'Private node test', 'private' => TRUE, 'uid' => $author->id(), ]); @@ -85,11 +85,11 @@ public function testTrackerNodeAccess() { // Create some nodes. $private_node = $this->drupalCreateNode([ - 'title' => t('Private node test'), + 'title' => 'Private node test', 'private' => TRUE, ]); $public_node = $this->drupalCreateNode([ - 'title' => t('Public node test'), + 'title' => 'Public node test', 'private' => FALSE, ]); diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php index ae93524c788a81556394eed9f42cbc213bf15b7b..8fedf64f7c07f5846cb7d3d762a39fc9c65f21e9 100644 --- a/core/modules/user/tests/src/Functional/UserAdminTest.php +++ b/core/modules/user/tests/src/Functional/UserAdminTest.php @@ -75,7 +75,7 @@ public function testUserAdmin() { $this->assertSession()->pageTextContains($admin_user->getAccountName()); // Test for existence of edit link in table. - $link = $user_a->toLink(t('Edit'), 'edit-form', ['query' => ['destination' => $user_a->toUrl('collection')->toString()]])->toString(); + $link = $user_a->toLink('Edit', 'edit-form', ['query' => ['destination' => $user_a->toUrl('collection')->toString()]])->toString(); $this->assertSession()->responseContains($link); // Test exposed filter elements. diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php index b87998ff83f03b3335da7a1b9edda3f24f5aa8e6..dee27b7054da9be9c879d1d532d2ccc34ee09dba 100644 --- a/core/modules/user/tests/src/Functional/UserCreateTest.php +++ b/core/modules/user/tests/src/Functional/UserCreateTest.php @@ -61,7 +61,7 @@ public function testUserAdd() { 'entity_type' => 'user', 'label' => 'Picture', 'bundle' => 'user', - 'description' => t('Your virtual face or picture.'), + 'description' => 'Your virtual face or picture.', 'required' => FALSE, 'settings' => [ 'file_extensions' => 'png gif jpg jpeg', diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php index 515a149f4849ecbb4a3e507852a6978016974481..31c0db9ed3d2a8f2f4519964235d162779c35a45 100644 --- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php +++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php @@ -490,7 +490,7 @@ public function testUserResetPasswordUserFloodControlIsCleared() { public function assertValidPasswordReset($name) { $this->assertSession()->pageTextContains("If $name is a valid account, an email will be sent with instructions to reset your password."); $this->assertMail('to', $this->account->getEmail(), 'Password e-mail sent to user.'); - $subject = t('Replacement login information for @username at @site', ['@username' => $this->account->getAccountName(), '@site' => \Drupal::config('system.site')->get('name')]); + $subject = 'Replacement login information for ' . $this->account->getAccountName() . ' at Drupal'; $this->assertMail('subject', $subject, 'Password reset e-mail subject is correct.'); } diff --git a/core/modules/user/tests/src/Functional/UserTokenReplaceTest.php b/core/modules/user/tests/src/Functional/UserTokenReplaceTest.php index 7a3f5ca34c5a6910946bd8ddcd956818a262fadc..4ea4a29c89c6fabb97cd4c3748efa212ba07d6bd 100644 --- a/core/modules/user/tests/src/Functional/UserTokenReplaceTest.php +++ b/core/modules/user/tests/src/Functional/UserTokenReplaceTest.php @@ -118,7 +118,7 @@ public function testUserTokenReplacement() { // Generate tokens for the anonymous user. $anonymous_user = User::load(0); $tests = []; - $tests['[user:uid]'] = t('not yet assigned'); + $tests['[user:uid]'] = 'not yet assigned'; $tests['[user:display-name]'] = $anonymous_user->getDisplayName(); $base_bubbleable_metadata = BubbleableMetadata::createFromObject($anonymous_user); diff --git a/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php b/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php index 988a9b88be887c4e7cc9a02718f692dfd94f7c15..da488b759840b9d2ac8dace34f5170e374c7d758 100644 --- a/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php +++ b/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php @@ -94,7 +94,7 @@ public function testRegistrationWithUserFields() { $this->page->fillField('edit-mail', $name . '@example.com'); $this->page->pressButton('edit-submit'); - $this->webAssert->pageTextContains(t('@name field is required.', ['@name' => $field->label()])); + $this->webAssert->pageTextContains($field->label() . ' field is required.'); // Invalid input. $this->page->fillField('edit-test-user-field-0-value', '-1'); diff --git a/core/modules/user/tests/src/Kernel/Views/HandlerFieldPermissionTest.php b/core/modules/user/tests/src/Kernel/Views/HandlerFieldPermissionTest.php index 1cfe12f8a076b229e8aa78c4bb26d2f68b987310..37ff151b28a423ebcf1d6d0b8335e1789e0ea3ae 100644 --- a/core/modules/user/tests/src/Kernel/Views/HandlerFieldPermissionTest.php +++ b/core/modules/user/tests/src/Kernel/Views/HandlerFieldPermissionTest.php @@ -34,12 +34,12 @@ public function testFieldPermission() { $expected_permissions = []; $expected_permissions[$this->users[0]->id()] = []; $expected_permissions[$this->users[1]->id()] = []; - $expected_permissions[$this->users[2]->id()][] = t('Administer roles and permissions'); + $expected_permissions[$this->users[2]->id()][] = 'Administer roles and permissions'; // View user profiles comes first, because we sort by the permission // machine name. - $expected_permissions[$this->users[3]->id()][] = t('View user information'); - $expected_permissions[$this->users[3]->id()][] = t('Administer roles and permissions'); - $expected_permissions[$this->users[3]->id()][] = t('Administer users'); + $expected_permissions[$this->users[3]->id()][] = 'View user information'; + $expected_permissions[$this->users[3]->id()][] = 'Administer roles and permissions'; + $expected_permissions[$this->users[3]->id()][] = 'Administer users'; foreach ($view->result as $index => $row) { $uid = $view->field['uid']->getValue($row); diff --git a/core/modules/views/tests/src/Functional/Handler/HandlerTest.php b/core/modules/views/tests/src/Functional/Handler/HandlerTest.php index 47f8015ff5f27f849ad57fce6ba406be6390a216..2ac51567d82e8d5b06bf55b0e86a22d9697ea1b0 100644 --- a/core/modules/views/tests/src/Functional/Handler/HandlerTest.php +++ b/core/modules/views/tests/src/Functional/Handler/HandlerTest.php @@ -79,41 +79,41 @@ public function testBreakString() { // Test ors $handler = HandlerBase::breakString('word1 word2+word'); - $this->assertEqualValue(['word1', 'word2', 'word'], $handler); + $this->assertEquals(['word1', 'word2', 'word'], $handler->value); $this->assertEquals('or', $handler->operator); $handler = HandlerBase::breakString('word1+word2+word'); - $this->assertEqualValue(['word1', 'word2', 'word'], $handler); + $this->assertEquals(['word1', 'word2', 'word'], $handler->value); $this->assertEquals('or', $handler->operator); $handler = HandlerBase::breakString('word1 word2 word'); - $this->assertEqualValue(['word1', 'word2', 'word'], $handler); + $this->assertEquals(['word1', 'word2', 'word'], $handler->value); $this->assertEquals('or', $handler->operator); $handler = HandlerBase::breakString('word-1+word-2+word'); - $this->assertEqualValue(['word-1', 'word-2', 'word'], $handler); + $this->assertEquals(['word-1', 'word-2', 'word'], $handler->value); $this->assertEquals('or', $handler->operator); $handler = HandlerBase::breakString('wõrd1+wõrd2+wõrd'); - $this->assertEqualValue(['wõrd1', 'wõrd2', 'wõrd'], $handler); + $this->assertEquals(['wõrd1', 'wõrd2', 'wõrd'], $handler->value); $this->assertEquals('or', $handler->operator); // Test ands. $handler = HandlerBase::breakString('word1,word2,word'); - $this->assertEqualValue(['word1', 'word2', 'word'], $handler); + $this->assertEquals(['word1', 'word2', 'word'], $handler->value); $this->assertEquals('and', $handler->operator); $handler = HandlerBase::breakString('word1 word2,word'); - $this->assertEqualValue(['word1 word2', 'word'], $handler); + $this->assertEquals(['word1 word2', 'word'], $handler->value); $this->assertEquals('and', $handler->operator); $handler = HandlerBase::breakString('word1,word2 word'); - $this->assertEqualValue(['word1', 'word2 word'], $handler); + $this->assertEquals(['word1', 'word2 word'], $handler->value); $this->assertEquals('and', $handler->operator); $handler = HandlerBase::breakString('word-1,word-2,word'); - $this->assertEqualValue(['word-1', 'word-2', 'word'], $handler); + $this->assertEquals(['word-1', 'word-2', 'word'], $handler->value); $this->assertEquals('and', $handler->operator); $handler = HandlerBase::breakString('wõrd1,wõrd2,wõrd'); - $this->assertEqualValue(['wõrd1', 'wõrd2', 'wõrd'], $handler); + $this->assertEquals(['wõrd1', 'wõrd2', 'wõrd'], $handler->value); $this->assertEquals('and', $handler->operator); // Test a single word $handler = HandlerBase::breakString('word'); - $this->assertEqualValue(['word'], $handler); + $this->assertEquals(['word'], $handler->value); $this->assertEquals('and', $handler->operator); $s1 = $this->randomMachineName(); @@ -124,45 +124,45 @@ public function testBreakString() { // Test "or"s. $handlerBase = HandlerBase::breakString("$s1 $n2+$n3"); - $this->assertEqualValue([$s1, $n2, $n3], $handlerBase); + $this->assertEquals([$s1, $n2, $n3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1+$n2+$n3"); - $this->assertEqualValue([$s1, $n2, $n3], $handlerBase); + $this->assertEquals([$s1, $n2, $n3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1 $n2 $n3"); - $this->assertEqualValue([$s1, $n2, $n3], $handlerBase); + $this->assertEquals([$s1, $n2, $n3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1 $n2++$n3"); - $this->assertEqualValue([$s1, $n2, $n3], $handlerBase); + $this->assertEquals([$s1, $n2, $n3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); // Test "and"s. $handlerBase = HandlerBase::breakString("$s1,$n2,$n3"); - $this->assertEqualValue([$s1, $n2, $n3], $handlerBase); + $this->assertEquals([$s1, $n2, $n3], $handlerBase->value); $this->assertEquals('and', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1,,$n2,$n3"); - $this->assertEqualValue([$s1, $n2, $n3], $handlerBase); + $this->assertEquals([$s1, $n2, $n3], $handlerBase->value); $this->assertEquals('and', $handlerBase->operator); // Enforce int values. $handlerBase = HandlerBase::breakString("$n1,$n2,$n3", TRUE); - $this->assertEqualValue([$n1, $n2, $n3], $handlerBase); + $this->assertEquals([$n1, $n2, $n3], $handlerBase->value); $this->assertEquals('and', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$n1+$n2+$n3", TRUE); - $this->assertEqualValue([$n1, $n2, $n3], $handlerBase); + $this->assertEquals([$n1, $n2, $n3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1,$n2,$n3", TRUE); - $this->assertEqualValue([(int) $s1, $n2, $n3], $handlerBase); + $this->assertEquals([(int) $s1, $n2, $n3], $handlerBase->value); $this->assertEquals('and', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1+$n2+$n3", TRUE); - $this->assertEqualValue([(int) $s1, $n2, $n3], $handlerBase); + $this->assertEquals([(int) $s1, $n2, $n3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); // Generate three random decimals which can be used below; @@ -172,28 +172,28 @@ public function testBreakString() { // Test "or"s. $handlerBase = HandlerBase::breakString("$s1 $d1+$d2"); - $this->assertEqualValue([$s1, $d1, $d2], $handlerBase); + $this->assertEquals([$s1, $d1, $d2], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1+$d1+$d3"); - $this->assertEqualValue([$s1, $d1, $d3], $handlerBase); + $this->assertEquals([$s1, $d1, $d3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1 $d2 $d3"); - $this->assertEqualValue([$s1, $d2, $d3], $handlerBase); + $this->assertEquals([$s1, $d2, $d3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1 $d2++$d3"); - $this->assertEqualValue([$s1, $d2, $d3], $handlerBase); + $this->assertEquals([$s1, $d2, $d3], $handlerBase->value); $this->assertEquals('or', $handlerBase->operator); // Test "and"s. $handlerBase = HandlerBase::breakString("$s1,$d2,$d3"); - $this->assertEqualValue([$s1, $d2, $d3], $handlerBase); + $this->assertEquals([$s1, $d2, $d3], $handlerBase->value); $this->assertEquals('and', $handlerBase->operator); $handlerBase = HandlerBase::breakString("$s1,,$d2,$d3"); - $this->assertEqualValue([$s1, $d2, $d3], $handlerBase); + $this->assertEquals([$s1, $d2, $d3], $handlerBase->value); $this->assertEquals('and', $handlerBase->operator); } @@ -223,30 +223,6 @@ public function testHandlerWeights() { } } - /** - * Check to see if a value is the same as the value on a certain handler. - * - * @param $expected - * The expected value to check. - * @param \Drupal\views\Plugin\views\ViewsHandlerInterface $handler - * The handler that has the $handler->value property to compare with first. - * @param string $message - * The message to display along with the assertion. - * @param string $group - * The type of assertion - examples are "Browser", "PHP". - * - * @return bool - * TRUE if the assertion succeeded. - */ - protected function assertEqualValue($expected, $handler, $message = '', $group = 'Other') { - if (empty($message)) { - $message = t('Comparing @first and @second', ['@first' => implode(',', $expected), '@second' => implode(',', $handler->value)]); - } - - $this->assertEquals($expected, $handler->value, $message); - return TRUE; - } - /** * Tests the relationship ui for field/filter/argument/relationship. */ diff --git a/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php b/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php index 49ed139ae0f47387530b4bf824a6a7df4470304f..868de09ac6c64e07f325551db4db85944d70f709 100644 --- a/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php +++ b/core/modules/views/tests/src/Functional/ViewsFormMultipleTest.php @@ -36,8 +36,8 @@ protected function setUp($import_test_views = TRUE): void { protected function viewsData() { $data = parent::viewsData(); $data['views_test_data']['field_form_button_test']['field'] = [ - 'title' => t('Button test'), - 'help' => t('Adds a test form button.'), + 'title' => 'Button test', + 'help' => 'Adds a test form button.', 'id' => 'field_form_button_test', ]; return $data; diff --git a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php index 8f30fb2db1ad0d775ec08a2cb30c941cd2a9c7d0..24873e674f5c5450a9edc1fa7ec0641811e86e15 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php @@ -179,7 +179,7 @@ public function testExposedFilteringWithButtonElement() { $ajax_views_before = $drupal_settings['views']['ajaxViews']; // Search for "Page One". - $this->submitForm(['title' => 'Page One'], t('Filter')); + $this->submitForm(['title' => 'Page One'], 'Filter'); $this->assertSession()->assertWaitOnAjaxRequest(); // Verify that only the "Page One" Node is present. diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php index 5640dbb710ecbd6a961214b886a01a8867edad95..e3bc2e71dd4bfe9dd570f5abb3898cad25d8bb7e 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php @@ -70,7 +70,7 @@ public function testFieldBoolean() { $this->assertEquals('✔', $view->field['age']->advancedRender($view->result[1])); // Set a custom output format. - $view->field['age']->formats['test'] = [t('Test-True'), t('Test-False')]; + $view->field['age']->formats['test'] = ['Test-True', 'Test-False']; $view->field['age']->options['type'] = 'test'; $this->assertEquals('Test-False', $view->field['age']->advancedRender($view->result[0])); $this->assertEquals('Test-True', $view->field['age']->advancedRender($view->result[1])); diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php index 0b3ddc4f68ddef7193bc79018b1fe7a721ada87c..5ce5e83c83256d56fdc43f7dc46869c1012391b3 100644 --- a/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/FieldDateTest.php @@ -122,10 +122,10 @@ public function testFieldDate() { $time_since = $date_formatter->formatTimeDiffSince($time); $intervals = [ 'raw time ago' => $time_since, - 'time ago' => t('%time ago', ['%time' => $time_since]), + 'time ago' => "$time_since ago", 'raw time span' => $time_since, 'inverse time span' => "-$time_since", - 'time span' => t('%time ago', ['%time' => $time_since]), + 'time span' => "$time_since ago", ]; $this->assertRenderedDatesEqual($view, $intervals); @@ -134,9 +134,7 @@ public function testFieldDate() { $formatted = $date_formatter->formatTimeDiffUntil($time); $intervals = [ 'raw time span' => "-$formatted", - 'time span' => t('%time hence', [ - '%time' => $formatted, - ]), + 'time span' => "$formatted hence", ]; $this->assertRenderedFutureDatesEqual($view, $intervals); } @@ -154,20 +152,15 @@ public function testFieldDate() { protected function assertRenderedDatesEqual($view, $map, $timezone = NULL) { foreach ($map as $date_format => $expected_result) { $view->field['created']->options['date_format'] = $date_format; - $t_args = [ - '%value' => $expected_result, - '%format' => $date_format, - ]; if (isset($timezone)) { - $t_args['%timezone'] = $timezone; - $message = t('Value %value in %format format for timezone %timezone matches.', $t_args); + $message = "$date_format format for timezone $timezone matches."; $view->field['created']->options['timezone'] = $timezone; } else { - $message = t('Value %value in %format format matches.', $t_args); + $message = "$date_format format matches."; } $actual_result = $view->field['created']->advancedRender($view->result[0]); - $this->assertEquals($expected_result, $actual_result, $message); + $this->assertEquals($expected_result, strip_tags($actual_result), $message); } } @@ -183,13 +176,7 @@ protected function assertRenderedFutureDatesEqual($view, $map) { foreach ($map as $format => $result) { $view->field['destroyed']->options['date_format'] = $format; $view_result = $view->field['destroyed']->advancedRender($view->result[0]); - $t_args = [ - '%value' => $result, - '%format' => $format, - '%actual' => $view_result, - ]; - $message = t('Value %value in %format matches %actual', $t_args); - $this->assertEquals($result, $view_result, $message); + $this->assertEquals($result, strip_tags($view_result), "$format format matches."); } } diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php index 55fe86c0022551a93d52d4aca5096a60698055f4..f59370d62d0f72adc85eddd8c7ec523584158ea8 100644 --- a/core/modules/views/tests/src/Kernel/ModuleTest.php +++ b/core/modules/views/tests/src/Kernel/ModuleTest.php @@ -175,7 +175,7 @@ public function testLoadFunctions() { $expected_opt_groups = []; foreach ($all_views as $view) { foreach ($view->get('display') as $display) { - $expected_opt_groups[$view->id()][$view->id() . ':' . $display['id']] = (string) t('@view : @display', ['@view' => $view->id(), '@display' => $display['id']]); + $expected_opt_groups[$view->id()][$view->id() . ':' . $display['id']] = $view->id() . ' : ' . $display['id']; } } $this->assertEquals($expected_opt_groups, Views::getViewsAsOptions(FALSE, 'all', NULL, TRUE), 'Expected option array for an option group returned.'); @@ -325,8 +325,7 @@ protected function formatViewOptions(array $views = []) { $expected_options = []; foreach ($views as $view) { foreach ($view->get('display') as $display) { - $expected_options[$view->id() . ':' . $display['id']] = (string) t('View: @view - Display: @display', - ['@view' => $view->id(), '@display' => $display['id']]); + $expected_options[$view->id() . ':' . $display['id']] = "View: {$view->id()} - Display: {$display['id']}"; } } diff --git a/core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php b/core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php index a67b7bada52ed18716f3ddeb8fa46193611ef5f9..f658f64e7e90df2647b131cec7bc5c8b3fb20a78 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/BlockDependenciesTest.php @@ -69,7 +69,7 @@ public function testViewsBlock() { * example: * @code * $this->createBlock('system_powered_by_block', array( - * 'label' => t('Hello, world!'), + * 'label' => 'Hello, world!', * )); * @endcode * The following defaults are provided: diff --git a/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php b/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php index 651cb829ec4afa377bc0e2f3841a5c1a64d21d3e..a581f8922cc361458fc2f6deb095062a4cb695ed 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php @@ -49,7 +49,7 @@ public function testExposedFormRender() { $expected_action = $view->display_handler->getUrlInfo()->toString(); $this->assertFieldByXPath('//form/@action', $expected_action, 'The expected value for the action attribute was found.'); // Make sure the description is shown. - $result = $this->xpath('//form//div[contains(@id, :id) and normalize-space(text())=:description]', [':id' => 'edit-type--2--description', ':description' => t('Exposed description')]); + $result = $this->xpath('//form//div[contains(@id, "edit-type--2--description") and normalize-space(text())="Exposed description"]'); $this->assertCount(1, $result, 'Filter description was found.'); } diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php index 3815a9ec678fdf136d623098cafcecd8f6da9992..e20089a77c43d008bae213ef7b0ccc51df675d67 100644 --- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php +++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php @@ -73,8 +73,8 @@ protected function schemaDefinition() { protected function viewsData() { $data = parent::viewsData(); $data['views_test_data']['uid'] = [ - 'title' => t('UID'), - 'help' => t('The test data UID'), + 'title' => 'UID', + 'help' => 'The test data UID', 'relationship' => [ 'id' => 'standard', 'base' => 'users_field_data', @@ -84,7 +84,7 @@ protected function viewsData() { // Create a dummy field with no help text. $data['views_test_data']['no_help'] = $data['views_test_data']['name']; - $data['views_test_data']['no_help']['field']['title'] = t('No help'); + $data['views_test_data']['no_help']['field']['title'] = 'No help'; $data['views_test_data']['no_help']['field']['real field'] = 'name'; unset($data['views_test_data']['no_help']['help']); diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php index 0896f8d2aad335c49795d6694fbe3bc706b6ffa4..fbd979c4e36b073a738da5b4e343d93d57eef1fd 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php @@ -66,7 +66,6 @@ public function testMultiForm() { $form_xpath = '//form[starts-with(@id, "node-page-form")]'; $field_xpath = '//div[contains(@class, "field--name-field-ajax-test")]'; $button_name = $field_name . '_add_more'; - $button_value = t('Add another item'); $button_xpath_suffix = '//input[@name="' . $button_name . '"]'; $field_items_xpath_suffix = '//input[@type="text"]'; @@ -95,7 +94,7 @@ public function testMultiForm() { for ($i = 0; $i < 2; $i++) { $forms = $page->find('xpath', $form_xpath); foreach ($forms as $offset => $form) { - $button = $form->findButton($button_value); + $button = $form->findButton('Add another item'); $this->assertNotNull($button, 'Add Another Item button exists'); $button->press(); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index 9ada56ef45381c342769a385547095e74955ab41..667bae835334355095a54e23aee12c83d975e122 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -510,8 +510,8 @@ public function testSortRange() { */ public function testTableSort() { $header = [ - ['data' => t('ID'), 'specifier' => 'id'], - ['data' => t('Number'), 'specifier' => 'number'], + ['data' => 'ID', 'specifier' => 'id'], + ['data' => 'Number', 'specifier' => 'number'], ]; // Sort key: id diff --git a/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php b/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php index b81395c9d77a20682b6cd51a1ec2b94df832611e..7507c903b11f9dd59f130c4961ebe960a010553a 100644 --- a/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php +++ b/core/tests/Drupal/KernelTests/Core/Messenger/MessengerTest.php @@ -37,7 +37,7 @@ public function testRemoveSingleMessage() { // Set two messages. $this->messenger->addStatus('First message (removed).'); - $this->messenger->addStatus(t('Second message with <em>markup!</em> (not removed).')); + $this->messenger->addStatus('Second message with <em>markup!</em> (not removed).'); $messages = $this->messenger->deleteByType(MessengerInterface::TYPE_STATUS); // Remove the first. unset($messages[0]); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php index 5a8dd1fb42a787e87e12da13fb728eaf1d0e6f77..e394a2d2da198a90021a25bc19674c599b51102b 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php @@ -52,7 +52,7 @@ public function testContext() { } // Test the getContextDefinitions() method. - $user_context_definition = EntityContextDefinition::fromEntityTypeId('user')->setLabel(t('User')); + $user_context_definition = EntityContextDefinition::fromEntityTypeId('user')->setLabel('User'); $this->assertEquals($plugin->getContextDefinitions()['user']->getLabel(), $user_context_definition->getLabel()); // Test the getContextDefinition() method for a valid context.