From a83a7a78366f8494d924de8ceddd86706d94ca3d Mon Sep 17 00:00:00 2001 From: Lee Rowlands <lee.rowlands@previousnext.com.au> Date: Mon, 15 Nov 2021 12:46:09 +1000 Subject: [PATCH] Issue #3231781 by longwave, mondrake, Feuerwagen, larowlan, TR, nlisgo, xxAlHixx, DuaelFr, GoZ, benjy, no_angel, Mac_Weber: [D9.3 beta - w/c Nov 8, 2021] Remove remaining uses of t() in tests --- .../src/Functional/ItemCacheTagsTest.php | 4 +- .../tests/src/Kernel/ItemWithoutFeedTest.php | 2 +- .../tests/src/Kernel/BlockInterfaceTest.php | 4 +- .../tests/src/Functional/CommentPagerTest.php | 7 +- .../CommentStatusFieldAccessTest.php | 2 +- .../src/Functional/Views/NodeCommentsTest.php | 2 +- .../tests/src/Functional/Views/WizardTest.php | 2 +- .../src/Functional/ConfigEntityListTest.php | 10 +-- .../src/Functional/ContactPersonalTest.php | 12 +-- .../ContentTranslationWorkflowsTest.php | 2 +- .../dblog/tests/src/Functional/DbLogTest.php | 4 +- .../tests/src/Functional/NestedFormTest.php | 2 +- .../Functional/ManageFieldsFunctionalTest.php | 9 +-- .../ManageDisplayTest.php | 2 +- .../tests/src/Kernel/EntityDisplayTest.php | 2 +- .../tests/src/Functional/FilePrivateTest.php | 4 +- .../FileManagedFileElementTest.php | 2 +- .../Functional/FilterHtmlImageSecureTest.php | 6 +- .../forum/tests/src/Functional/ForumTest.php | 13 ++-- .../src/Functional/ForumUninstallTest.php | 2 +- .../src/Functional/ImageFieldDisplayTest.php | 2 +- .../ImageFieldValidateTest.php | 2 +- .../tests/src/Functional/ActionTest.php | 2 +- .../tests/src/Functional/ShortcutTest.php | 2 +- .../ConfigurableLanguageManagerTest.php | 2 +- .../src/Functional/LanguageBreadcrumbTest.php | 2 +- .../Functional/LocaleUpdateInterfaceTest.php | 8 +- .../tests/src/Kernel/MediaSourceTest.php | 2 +- .../MenuLinkContentDeleteFormTest.php | 2 +- .../Functional/MenuLinkContentFormTest.php | 4 +- .../MenuUiContentModerationTest.php | 12 +-- .../src/Unit/source/d6/Drupal6SqlBaseTest.php | 20 ++--- .../src/Functional/SourceProviderTest.php | 10 +-- .../Functional/NodeAccessBaseTableTest.php | 2 +- .../src/Functional/NodeAccessPagerTest.php | 2 +- .../NodeEntityViewModeAlterTest.php | 4 +- .../src/Functional/NodeRSSContentTest.php | 2 +- .../src/Functional/NodeTranslationUITest.php | 2 +- .../Functional/Views/FilterNodeAccessTest.php | 2 +- .../src/Functional/PathTaxonomyTermTest.php | 2 +- .../QuickEditCustomPipelineTest.php | 2 +- .../QuickEditEndPointAccessTest.php | 2 +- .../QuickEditImageControllerTest.php | 8 +- .../LayoutBuilderQuickEditTest.php | 2 +- .../QuickEditFileTest.php | 2 +- .../QuickEditImageTest.php | 2 +- .../QuickEditIntegrationTest.php | 2 +- .../QuickEditLoadingTest.php | 2 +- .../src/Functional/ShortcutCacheTagsTest.php | 2 +- .../Functional/StatisticsTokenReplaceTest.php | 2 +- .../Database/SelectTableSortDefaultTest.php | 16 ++-- .../Form/ElementsTableSelectTest.php | 2 +- .../tests/src/Functional/Form/FormTest.php | 8 +- .../Form/LanguageSelectElementTest.php | 2 +- .../src/Functional/Menu/BreadcrumbTest.php | 34 ++++---- .../Functional/System/SiteMaintenanceTest.php | 18 +++-- .../tests/src/Kernel/Action/ActionTest.php | 2 +- .../src/Kernel/Form/ProgrammaticTest.php | 2 +- .../Functional/VocabularyPermissionsTest.php | 5 +- .../Functional/VocabularyTranslationTest.php | 4 +- .../src/Functional/TrackerNodeAccessTest.php | 6 +- .../tests/src/Functional/UserAdminTest.php | 2 +- .../tests/src/Functional/UserCreateTest.php | 2 +- .../src/Functional/UserPasswordResetTest.php | 2 +- .../src/Functional/UserTokenReplaceTest.php | 2 +- .../RegistrationWithUserFieldsTest.php | 2 +- .../Views/HandlerFieldPermissionTest.php | 8 +- .../src/Functional/Handler/HandlerTest.php | 78 +++++++------------ .../src/Functional/ViewsFormMultipleTest.php | 4 +- .../ExposedFilterAJAXTest.php | 2 +- .../src/Kernel/Handler/FieldBooleanTest.php | 2 +- .../src/Kernel/Handler/FieldDateTest.php | 27 ++----- .../views/tests/src/Kernel/ModuleTest.php | 5 +- .../Kernel/Plugin/BlockDependenciesTest.php | 2 +- .../Kernel/Plugin/ExposedFormRenderTest.php | 2 +- .../tests/src/Functional/HandlerTest.php | 6 +- .../Ajax/MultiFormTest.php | 3 +- .../Core/Entity/ConfigEntityQueryTest.php | 4 +- .../Core/Messenger/MessengerTest.php | 2 +- .../Core/Plugin/ContextPluginTest.php | 2 +- 80 files changed, 201 insertions(+), 260 deletions(-) diff --git a/core/modules/aggregator/tests/src/Functional/ItemCacheTagsTest.php b/core/modules/aggregator/tests/src/Functional/ItemCacheTagsTest.php index c7bce98ff211..93b6e8e48d90 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 f4a5e8f3f34d..8a604eeb701c 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 49772173409c..d47ac18cff82 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 6e3d1b853378..ef4fe3c018fe 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 9a34ac30387b..cddb174fed9e 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 3c68670db755..685fbf220334 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 0103c3d12362..ecabc08b96b1 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 aa58a411ec67..e80cf5b4df31 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 820201eea234..e28c8aae9b15 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 a57864d83556..9360122fb2bd 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 2965cd96f4d2..4b7ef3c2266f 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 4dd8993d5cbe..7621b07e3a33 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 85b056e6575b..1d54d2847135 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 dbd1b0881698..c0ee1aff261e 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 9312e7a27181..84ad60cd3c0b 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 8d82b2fb34bb..c1f4b3d2367d 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 18c197746d66..20dfa742fdcd 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 25d101977b99..3d5e5ee756a0 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 50d5a302c137..4d1e0767eacb 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 440d3b9f94a8..30ea8c1fd07a 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 4e3d31cfa749..551c77aa0eba 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 75d1b058eea0..b0a198312f8d 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 4fcc0e9e2bb7..9450f274ec66 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 6267a483364b..c03a78ab651b 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 6a8dd1571906..d6b71e3a36a5 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 64028cf28c95..a01d65dba157 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 bf19edd0961e..c1a561550d8a 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 cf6a75cae70e..07e764544848 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 87e6c684f2f1..cd7b6aaaeb5f 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 b57bc58d55c7..d4e47cc3a70a 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 02d8d038f3c4..2491150a6f5a 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 4da757565387..87731aadb09d 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 9fa261d2a31c..e6768723eb8a 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 7b6889d9c346..a20379f16822 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 c47c35dda157..9000a1f6617b 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 e1357d705bfa..25a2758717b2 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 1fd49d3eb67b..a7a1ad4e88fc 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 624c70906c83..8934c958d920 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 a7b8b7f37854..30e75d63cb9a 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 1a5cfb93498b..821727d1993a 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 ab0b75c7ae66..e4cc514c241c 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 fcf9de0c0d41..1cb90adf40db 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 7642f6fcf0d0..a1e3932c6d5c 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 2d48df5b66c2..daa5a192c4d9 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 f6a12e36073c..53fad46e43be 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 198ddf52dda4..7ed590965248 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 3669dfa9256e..2ee31915478c 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 86e95b75e67d..18e59f1b46e7 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 b6e924bd3edf..bcafe2c4b23d 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 160650bc6144..879f16cc90bc 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 f38ea7a2fca1..6d20a2e4cb12 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 76be86fcac4a..f20a753b719d 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 47416c0dba35..860ff8dd0077 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 02331c47c7ab..fa623992416d 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 849399fd230b..12461125711a 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 1400fb0561ee..0503da1715ec 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 47d39cdbd240..2dac37555cec 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 c924b55676f2..4cb67b5425e0 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 c96ec87df6ed..1794ecde34cf 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 9bcf06075f5e..4eb7cecce8b9 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 e3921eb0307f..e06fd4cd14c5 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 ae93524c788a..8fedf64f7c07 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 b87998ff83f0..dee27b7054da 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 515a149f4849..31c0db9ed3d2 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 7a3f5ca34c5a..4ea4a29c89c6 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 988a9b88be88..da488b759840 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 1cfe12f8a076..37ff151b28a4 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 47f8015ff5f2..2ac51567d82e 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 49ed139ae0f4..868de09ac6c6 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 8f30fb2db1ad..24873e674f5c 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 5640dbb710ec..e3bc2e71dd4b 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 0b3ddc4f68dd..5ce5e83c8325 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 55fe86c00225..f59370d62d0f 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 a67b7bada52e..f658f64e7e90 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 651cb829ec4a..a581f8922cc3 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 3815a9ec678f..e20089a77c43 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 0896f8d2aad3..fbd979c4e36b 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 9ada56ef4538..667bae835334 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 b81395c9d77a..7507c903b11f 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 5a8dd1fb42a7..e394a2d2da19 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. -- GitLab