From 0aed1298a1477ad8b3457ec86b4a20cef8a1134c Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Mon, 9 Aug 2021 08:57:28 +0100
Subject: [PATCH] Issue #3226008 by longwave, mondrake: Remove simple uses of
 t() in assertEquals() calls

---
 .../src/Kernel/CommentValidationTest.php      |  8 +++----
 .../src/Functional/ContactSitewideTest.php    |  4 ++--
 .../ContentTranslationEnableTest.php          |  6 ++---
 .../tests/src/Functional/DownloadTest.php     |  2 +-
 .../src/Functional/FileManagedTestBase.php    | 22 +++++++++----------
 .../src/Functional/SearchPageTextTest.php     |  5 +----
 .../Views/TaxonomyRelationshipTest.php        |  2 +-
 .../tests/src/Kernel/TermValidationTest.php   |  2 +-
 .../src/Functional/UserAdminListingTest.php   |  2 +-
 .../RegistrationWithUserFieldsTest.php        |  6 ++---
 .../tests/src/Kernel/UserValidationTest.php   |  6 ++---
 .../src/Kernel/Handler/FieldBooleanTest.php   | 16 +++++++-------
 .../Core/Database/UpdateComplexTest.php       |  3 ++-
 .../Core/Entity/EntityTypeConstraintsTest.php |  2 +-
 .../Core/Entity/EntityValidationTest.php      |  6 ++---
 .../Core/Entity/FieldSqlStorageTest.php       |  2 +-
 .../Core/File/StreamWrapperTest.php           |  2 +-
 .../AllowedValuesConstraintValidatorTest.php  |  2 +-
 .../ComplexDataConstraintValidatorTest.php    |  2 +-
 19 files changed, 48 insertions(+), 52 deletions(-)

diff --git a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
index 1a75dfcfaf52..39b842400dae 100644
--- a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
+++ b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
@@ -109,7 +109,7 @@ public function testValidation() {
     $violations = $comment->validate();
     $this->assertCount(1, $violations, 'Violation found when email is invalid');
     $this->assertEquals('mail.0.value', $violations[0]->getPropertyPath());
-    $this->assertEquals(t('This value is not a valid email address.'), $violations[0]->getMessage());
+    $this->assertEquals('This value is not a valid email address.', $violations[0]->getMessage());
 
     $comment->set('mail', NULL);
     $comment->set('homepage', 'http://example.com/' . $this->randomMachineName(237));
@@ -122,7 +122,7 @@ public function testValidation() {
 
     // @todo This message should be improved in
     //   https://www.drupal.org/node/2012690.
-    $this->assertEquals(t('This value should be of the correct primitive type.'), $violations[0]->getMessage());
+    $this->assertEquals('This value should be of the correct primitive type.', $violations[0]->getMessage());
 
     $comment->set('homepage', NULL);
     $comment->set('hostname', $this->randomString(129));
@@ -152,7 +152,7 @@ public function testValidation() {
     $violations = $comment->validate();
     $this->assertCount(1, $violations, 'Violation found when name is required, but empty and UID is anonymous.');
     $this->assertEquals('name', $violations[0]->getPropertyPath());
-    $this->assertEquals(t('You have to specify a valid author.'), $violations[0]->getMessage());
+    $this->assertEquals('You have to specify a valid author.', $violations[0]->getMessage());
 
     // Test creating a default comment with a given user id works.
     $comment = $this->entityTypeManager->getStorage('comment')->create([
@@ -177,7 +177,7 @@ public function testValidation() {
     $violations = $comment->validate();
     $this->assertCount(1, $violations, 'Violation found when author name and comment author do not match.');
     $this->assertEquals('name', $violations[0]->getPropertyPath());
-    $this->assertEquals(t('The specified author name does not match the comment author.'), $violations[0]->getMessage());
+    $this->assertEquals('The specified author name does not match the comment author.', $violations[0]->getMessage());
   }
 
   /**
diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
index 7b98647bfa19..1ed46eb4cfc5 100644
--- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
+++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
@@ -393,7 +393,7 @@ public function testSiteWideContact() {
     // Message is now by default displayed twice, once for the form element and
     // once for the viewed message.
     $page_text = $this->getSession()->getPage()->getText();
-    $this->assertGreaterThan(1, substr_count($page_text, t('Message')));
+    $this->assertGreaterThan(1, substr_count($page_text, 'Message'));
     $this->assertSession()->responseContains('class="field field--name-message field--type-string-long field--label-above');
     $this->assertSession()->pageTextContains($edit['message[0][value]']);
 
@@ -408,7 +408,7 @@ public function testSiteWideContact() {
     $this->submitForm($edit, 'Preview');
     // Message should only be displayed once now.
     $page_text = $this->getSession()->getPage()->getText();
-    $this->assertEquals(1, substr_count($page_text, t('Message')));
+    $this->assertEquals(1, substr_count($page_text, 'Message'));
     $this->assertSession()->responseContains('class="field field--name-message field--type-string-long field--label-hidden field__item">');
     $this->assertSession()->pageTextContains($edit['message[0][value]']);
 
diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
index 800da5ec9f5b..4bcd1f8914a9 100644
--- a/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
+++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationEnableTest.php
@@ -41,8 +41,7 @@ public function testEnable() {
 
     // No pending updates should be available.
     $this->drupalGet('admin/reports/status');
-    $requirement_value = $this->cssSelect("details.system-status-report__entry summary:contains('Entity/field definitions') + div");
-    $this->assertEquals(t('Up to date'), trim($requirement_value[0]->getText()));
+    $this->assertSession()->elementTextEquals('css', "details.system-status-report__entry summary:contains('Entity/field definitions') + div", 'Up to date');
 
     $this->drupalGet('admin/config/regional/content-language');
     // The node entity type should not be an option because it has no bundles.
@@ -59,8 +58,7 @@ public function testEnable() {
 
     // No pending updates should be available.
     $this->drupalGet('admin/reports/status');
-    $requirement_value = $this->cssSelect("details.system-status-report__entry summary:contains('Entity/field definitions') + div");
-    $this->assertEquals(t('Up to date'), trim($requirement_value[0]->getText()));
+    $this->assertSession()->elementTextEquals('css', "details.system-status-report__entry summary:contains('Entity/field definitions') + div", 'Up to date');
 
     // Create a node type and check the content translation settings are now
     // available for nodes.
diff --git a/core/modules/file/tests/src/Functional/DownloadTest.php b/core/modules/file/tests/src/Functional/DownloadTest.php
index 1792e1d203eb..b56afa1cec0e 100644
--- a/core/modules/file/tests/src/Functional/DownloadTest.php
+++ b/core/modules/file/tests/src/Functional/DownloadTest.php
@@ -147,7 +147,7 @@ public function testFileCreateUrl() {
       $this->checkUrl('public', '', $basename, $base_path . '/' . $public_directory_path . '/' . $basename_encoded);
       $this->checkUrl('private', '', $basename, $base_path . '/' . $script_path . 'system/files/' . $basename_encoded);
     }
-    $this->assertEquals('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', $this->fileUrlGenerator->generateString('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', FALSE), t('Generated URL matches expected URL.'));
+    $this->assertEquals('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', $this->fileUrlGenerator->generateString('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', FALSE));
   }
 
   /**
diff --git a/core/modules/file/tests/src/Functional/FileManagedTestBase.php b/core/modules/file/tests/src/Functional/FileManagedTestBase.php
index 572af0bfe41c..f9b14434c565 100644
--- a/core/modules/file/tests/src/Functional/FileManagedTestBase.php
+++ b/core/modules/file/tests/src/Functional/FileManagedTestBase.php
@@ -95,13 +95,13 @@ public function assertFileHookCalled($hook, $expected_count = 1, $message = NULL
    *   File object to compare.
    */
   public function assertFileUnchanged(FileInterface $before, FileInterface $after) {
-    $this->assertEquals($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', ['%file1' => $before->id(), '%file2' => $after->id()]), 'File unchanged');
-    $this->assertEquals($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', ['%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id()]), 'File unchanged');
-    $this->assertEquals($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', ['%file1' => $before->getFilename(), '%file2' => $after->getFilename()]), 'File unchanged');
-    $this->assertEquals($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', ['%file1' => $before->getFileUri(), '%file2' => $after->getFileUri()]), 'File unchanged');
-    $this->assertEquals($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', ['%file1' => $before->getMimeType(), '%file2' => $after->getMimeType()]), 'File unchanged');
-    $this->assertEquals($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', ['%file1' => $before->getSize(), '%file2' => $after->getSize()]), 'File unchanged');
-    $this->assertEquals($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', ['%file1' => $before->isPermanent(), '%file2' => $after->isPermanent()]), 'File unchanged');
+    $this->assertEquals($before->id(), $after->id());
+    $this->assertEquals($before->getOwner()->id(), $after->getOwner()->id());
+    $this->assertEquals($before->getFilename(), $after->getFilename());
+    $this->assertEquals($before->getFileUri(), $after->getFileUri());
+    $this->assertEquals($before->getMimeType(), $after->getMimeType());
+    $this->assertEquals($before->getSize(), $after->getSize());
+    $this->assertEquals($before->isPermanent(), $after->isPermanent());
   }
 
   /**
@@ -113,8 +113,8 @@ public function assertFileUnchanged(FileInterface $before, FileInterface $after)
    *   File object to compare.
    */
   public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
-    $this->assertNotEquals($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', ['%file1' => $file1->id(), '%file2' => $file2->id()]));
-    $this->assertNotEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]));
+    $this->assertNotEquals($file1->id(), $file2->id());
+    $this->assertNotEquals($file1->getFileUri(), $file2->getFileUri());
   }
 
   /**
@@ -126,8 +126,8 @@ public function assertDifferentFile(FileInterface $file1, FileInterface $file2)
    *   File object to compare.
    */
   public function assertSameFile(FileInterface $file1, FileInterface $file2) {
-    $this->assertEquals($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', ['%file1' => $file1->id(), '%file2-fid' => $file2->id()]), 'Same file');
-    $this->assertEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]), 'Same file');
+    $this->assertEquals($file1->id(), $file2->id());
+    $this->assertEquals($file1->getFileUri(), $file2->getFileUri());
   }
 
   /**
diff --git a/core/modules/search/tests/src/Functional/SearchPageTextTest.php b/core/modules/search/tests/src/Functional/SearchPageTextTest.php
index bb6d61865f89..4e4a64b14f9a 100644
--- a/core/modules/search/tests/src/Functional/SearchPageTextTest.php
+++ b/core/modules/search/tests/src/Functional/SearchPageTextTest.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\Tests\search\Functional;
 
-use Drupal\Component\Utility\Html;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Tests\BrowserTestBase;
 
@@ -82,7 +81,6 @@ public function testSearchText() {
     $this->submitForm($edit, 'Search');
     $this->assertSession()->pageTextContains('search yielded no results');
     $this->assertSession()->pageTextContains('Search');
-    $title_source = 'Search for @keywords | Drupal';
     $this->assertSession()->titleEquals('Search for ' . Unicode::truncate($search_terms, 60, TRUE, TRUE) . ' | Drupal');
     $this->assertSession()->pageTextNotContains('Node');
     $this->assertSession()->pageTextNotContains('Node');
@@ -105,8 +103,7 @@ public function testSearchText() {
     $edit['keys'] = $search_terms;
     $this->drupalGet('search/node');
     $this->submitForm($edit, 'Search');
-    $actual_title = $this->xpath('//title')[0]->getText();
-    $this->assertEquals(Html::decodeEntities(t($title_source, ['@keywords' => Unicode::truncate($search_terms, 60, TRUE, TRUE)])), $actual_title, 'Search page title is correct');
+    $this->assertSession()->titleEquals('Search for ' . Unicode::truncate($search_terms, 60, TRUE, TRUE) . ' | Drupal');
 
     $edit['keys'] = $this->searchingUser->getAccountName();
     $this->drupalGet('search/user');
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php
index a3cedc4d5773..d034e57cd21d 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyRelationshipTest.php
@@ -79,7 +79,7 @@ public function testTaxonomyRelationships() {
     // Check the parent relationship data.
     $this->assertEquals('taxonomy_term_field_data', $views_data['parent_target_id']['relationship']['base']);
     $this->assertEquals('tid', $views_data['parent_target_id']['relationship']['base field']);
-    $this->assertEquals(t('Parent'), $views_data['parent_target_id']['relationship']['label']);
+    $this->assertEquals('Parent', $views_data['parent_target_id']['relationship']['label']);
     $this->assertEquals('standard', $views_data['parent_target_id']['relationship']['id']);
     // Check the parent filter and argument data.
     $this->assertEquals('numeric', $views_data['parent_target_id']['filter']['id']);
diff --git a/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php b/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php
index ffd586003720..3d15da19c12b 100644
--- a/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php
@@ -53,7 +53,7 @@ public function testValidation() {
     $violations = $term->validate();
     $this->assertCount(1, $violations, 'Violation found when name is NULL.');
     $this->assertEquals('name', $violations[0]->getPropertyPath());
-    $this->assertEquals(t('This value should not be null.'), $violations[0]->getMessage());
+    $this->assertEquals('This value should not be null.', $violations[0]->getMessage());
     $term->set('name', 'test');
 
     $term->set('parent', 9999);
diff --git a/core/modules/user/tests/src/Functional/UserAdminListingTest.php b/core/modules/user/tests/src/Functional/UserAdminListingTest.php
index 049250251edf..757495e8f660 100644
--- a/core/modules/user/tests/src/Functional/UserAdminListingTest.php
+++ b/core/modules/user/tests/src/Functional/UserAdminListingTest.php
@@ -91,7 +91,7 @@ public function testUserListing() {
 
     $this->assertEmpty(array_keys(array_diff_key($result_accounts, $accounts)), 'Ensure all accounts are listed.');
     foreach ($result_accounts as $name => $values) {
-      $this->assertEquals($accounts[$name]->status->value, $values['status'] == t('active'), 'Ensure the status is displayed properly.');
+      $this->assertEquals($accounts[$name]->status->value, $values['status'] == 'active');
     }
 
     $expected_roles = ['custom_role_1', 'custom_role_2'];
diff --git a/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php b/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php
index ddc58b2c471e..988a9b88be88 100644
--- a/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php
+++ b/core/modules/user/tests/src/FunctionalJavascript/RegistrationWithUserFieldsTest.php
@@ -135,9 +135,9 @@ public function testRegistrationWithUserFields() {
       ->getStorage('user')
       ->loadByProperties(['name' => $name, 'mail' => $name . '@example.com']);
     $new_user = reset($accounts);
-    $this->assertEquals($value, $new_user->test_user_field[0]->value, t('The field value was correctly saved.'));
-    $this->assertEquals($value . '1', $new_user->test_user_field[1]->value, t('The field value was correctly saved.'));
-    $this->assertEquals($value . '2', $new_user->test_user_field[2]->value, t('The field value was correctly saved.'));
+    $this->assertEquals($value, $new_user->test_user_field[0]->value);
+    $this->assertEquals($value . '1', $new_user->test_user_field[1]->value);
+    $this->assertEquals($value . '2', $new_user->test_user_field[2]->value);
   }
 
 }
diff --git a/core/modules/user/tests/src/Kernel/UserValidationTest.php b/core/modules/user/tests/src/Kernel/UserValidationTest.php
index d9044d90ca47..7f4b1de234ba 100644
--- a/core/modules/user/tests/src/Kernel/UserValidationTest.php
+++ b/core/modules/user/tests/src/Kernel/UserValidationTest.php
@@ -114,7 +114,7 @@ public function testValidation() {
     $violations = $user->validate();
     $this->assertCount(1, $violations, 'Violation found when email is invalid');
     $this->assertEquals('mail.0.value', $violations[0]->getPropertyPath());
-    $this->assertEquals(t('This value is not a valid email address.'), $violations[0]->getMessage());
+    $this->assertEquals('This value is not a valid email address.', $violations[0]->getMessage());
 
     $mail = $this->randomMachineName(Email::EMAIL_MAX_LENGTH - 11) . '@example.com';
     $user->set('mail', $mail);
@@ -127,7 +127,7 @@ public function testValidation() {
     $this->assertEquals('mail.0.value', $violations[0]->getPropertyPath());
     $this->assertEquals(t('%name: the email address can not be longer than @max characters.', ['%name' => $user->get('mail')->getFieldDefinition()->getLabel(), '@max' => Email::EMAIL_MAX_LENGTH]), $violations[0]->getMessage());
     $this->assertEquals('mail.0.value', $violations[1]->getPropertyPath());
-    $this->assertEquals(t('This value is not a valid email address.'), $violations[1]->getMessage());
+    $this->assertEquals('This value is not a valid email address.', $violations[1]->getMessage());
 
     // Provoke an email collision with an existing user.
     $user->set('mail', 'existing@example.com');
@@ -219,7 +219,7 @@ protected function assertAllowedValuesViolation(EntityInterface $entity, $field_
     $violations = $entity->validate();
     $this->assertCount(1, $violations, "Allowed values violation for $field_name found.");
     $this->assertEquals($field_name === 'langcode' ? "{$field_name}.0" : "{$field_name}.0.value", $violations[0]->getPropertyPath());
-    $this->assertEquals(t('The value you selected is not a valid choice.'), $violations[0]->getMessage());
+    $this->assertEquals('The value you selected is not a valid choice.', $violations[0]->getMessage());
   }
 
 }
diff --git a/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php b/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php
index e7994300cc4a..5640dbb710ec 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FieldBooleanTest.php
@@ -49,20 +49,20 @@ public function testFieldBoolean() {
     $this->executeView($view);
 
     // This is john, which has no age, there are no custom formats defined, yet.
-    $this->assertEquals(t('No'), $view->field['age']->advancedRender($view->result[0]));
-    $this->assertEquals(t('Yes'), $view->field['age']->advancedRender($view->result[1]));
+    $this->assertEquals('No', $view->field['age']->advancedRender($view->result[0]));
+    $this->assertEquals('Yes', $view->field['age']->advancedRender($view->result[1]));
 
     // Reverse the output.
     $view->field['age']->options['not'] = TRUE;
-    $this->assertEquals(t('Yes'), $view->field['age']->advancedRender($view->result[0]));
-    $this->assertEquals(t('No'), $view->field['age']->advancedRender($view->result[1]));
+    $this->assertEquals('Yes', $view->field['age']->advancedRender($view->result[0]));
+    $this->assertEquals('No', $view->field['age']->advancedRender($view->result[1]));
 
     unset($view->field['age']->options['not']);
 
     // Use another output format.
     $view->field['age']->options['type'] = 'true-false';
-    $this->assertEquals(t('False'), $view->field['age']->advancedRender($view->result[0]));
-    $this->assertEquals(t('True'), $view->field['age']->advancedRender($view->result[1]));
+    $this->assertEquals('False', $view->field['age']->advancedRender($view->result[0]));
+    $this->assertEquals('True', $view->field['age']->advancedRender($view->result[1]));
 
     // test awesome unicode.
     $view->field['age']->options['type'] = 'unicode-yes-no';
@@ -72,8 +72,8 @@ public function testFieldBoolean() {
     // Set a custom output format.
     $view->field['age']->formats['test'] = [t('Test-True'), t('Test-False')];
     $view->field['age']->options['type'] = 'test';
-    $this->assertEquals(t('Test-False'), $view->field['age']->advancedRender($view->result[0]));
-    $this->assertEquals(t('Test-True'), $view->field['age']->advancedRender($view->result[1]));
+    $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/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php
index 40b96e7ece13..f5fcb1d37d09 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/UpdateComplexTest.php
@@ -137,7 +137,8 @@ public function testSubSelectUpdate() {
     $after_age = $this->connection->query('SELECT [age] FROM {test} WHERE [name] = :name', [':name' => 'Ringo'])->fetchField();
     $expected_age = $select->execute()->fetchField();
     $this->assertEquals($expected_age, $after_age);
-    $this->assertEquals(1, $num_updated, t('Expected 1 row to be updated in subselect update query.'));
+    // Expect 1 row to be updated.
+    $this->assertEquals(1, $num_updated);
   }
 
 }
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php
index 093e78cc7447..1d0aa063fae4 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php
@@ -67,7 +67,7 @@ public function testConstraintValidation() {
     $entity->changed->value = REQUEST_TIME - 86400;
     $violations = $entity->validate();
     $this->assertEquals(1, $violations->count(), 'Validation failed.');
-    $this->assertEquals(t('The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.'), $violations[0]->getMessage());
+    $this->assertEquals('The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.', $violations[0]->getMessage());
   }
 
 }
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php
index f9ea94b61c8d..09298d4673f4 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php
@@ -150,13 +150,13 @@ protected function checkValidation($entity_type) {
     // This should fail on AllowedValues and Length constraints.
     $this->assertEquals(2, $violations->count(), 'Validation failed.');
     $this->assertEquals(t('This value is too long. It should have %limit characters or less.', ['%limit' => '12']), $violations[0]->getMessage());
-    $this->assertEquals(t('The value you selected is not a valid choice.'), $violations[1]->getMessage());
+    $this->assertEquals('The value you selected is not a valid choice.', $violations[1]->getMessage());
 
     $test_entity = clone $entity;
     $test_entity->type->value = NULL;
     $violations = $test_entity->validate();
     $this->assertEquals(1, $violations->count(), 'Validation failed.');
-    $this->assertEquals(t('This value should not be null.'), $violations[0]->getMessage());
+    $this->assertEquals('This value should not be null.', $violations[0]->getMessage());
 
     $test_entity = clone $entity;
     $test_entity->name->value = $this->randomString(33);
@@ -180,7 +180,7 @@ protected function checkValidation($entity_type) {
     $test_entity->field_test_text->format = $this->randomString(33);
     $violations = $test_entity->validate();
     $this->assertEquals(1, $violations->count(), 'Validation failed.');
-    $this->assertEquals(t('The value you selected is not a valid choice.'), $violations[0]->getMessage());
+    $this->assertEquals('The value you selected is not a valid choice.', $violations[0]->getMessage());
 
     // Make sure the information provided by a violation is correct.
     $violation = $violations[0];
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
index c8c770ef3a1a..47039429f1f1 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
@@ -437,7 +437,7 @@ public function testFieldUpdateIndexesWithData() {
 
     // Verify that the tables were not dropped in the process.
     $entity = $this->container->get('entity_type.manager')->getStorage($entity_type)->load(1);
-    $this->assertEquals('field data', $entity->{$field_name}->value, t("Index changes performed without dropping the tables"));
+    $this->assertEquals('field data', $entity->{$field_name}->value);
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
index 6aa2bdbec8d1..70a7d176282e 100644
--- a/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/StreamWrapperTest.php
@@ -84,7 +84,7 @@ public function testUriFunctions() {
 
     // Test file_uri_target().
     $this->assertEquals('foo/bar.txt', $stream_wrapper_manager::getTarget('public://foo/bar.txt'), 'Got a valid stream target from public://foo/bar.txt.');
-    $this->assertEquals('image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', $stream_wrapper_manager::getTarget('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), t('Got a valid stream target from a data URI.'));
+    $this->assertEquals('image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', $stream_wrapper_manager::getTarget('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='));
     $this->assertFalse($stream_wrapper_manager::getTarget('foo/bar.txt'), 'foo/bar.txt is not a valid stream.');
     $this->assertSame($stream_wrapper_manager::getTarget('public://'), '');
     $this->assertSame($stream_wrapper_manager::getTarget('data:'), '');
diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php
index ede765f6a4a6..b4c76848fb3f 100644
--- a/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php
@@ -47,7 +47,7 @@ public function testValidation() {
 
     // Make sure the information provided by a violation is correct.
     $violation = $violations[0];
-    $this->assertEquals(t('The value you selected is not a valid choice.'), $violation->getMessage(), 'The message for invalid value is correct.');
+    $this->assertEquals('The value you selected is not a valid choice.', $violation->getMessage(), 'The message for invalid value is correct.');
     $this->assertEquals($typed_data, $violation->getRoot(), 'Violation root is correct.');
     $this->assertEquals(4, $violation->getInvalidValue(), 'The invalid value is set correctly in the violation.');
 
diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php
index 161d22d827f1..405503888668 100644
--- a/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/ComplexDataConstraintValidatorTest.php
@@ -53,7 +53,7 @@ public function testValidation() {
 
     // Make sure the information provided by a violation is correct.
     $violation = $violations[0];
-    $this->assertEquals(t('The value you selected is not a valid choice.'), $violation->getMessage(), 'The message for invalid value is correct.');
+    $this->assertEquals('The value you selected is not a valid choice.', $violation->getMessage(), 'The message for invalid value is correct.');
     $this->assertEquals($typed_data, $violation->getRoot(), 'Violation root is correct.');
     $this->assertEquals(4, $violation->getInvalidValue(), 'The invalid value is set correctly in the violation.');
 
-- 
GitLab