diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php index a9001e8d4058386dd880ddf81582655dd3154c4a..c9c6eb0cd8f0fb42efeb4c41a7f7ba4d968d1c5f 100644 --- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @@ -101,7 +101,8 @@ public function testCommentInterface() { // Test changing the comment author to "Anonymous". $comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), ['uid' => '']); - $this->assertTrue($comment->getAuthorName() == t('Anonymous') && $comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.'); + $this->assertTrue($comment->getAuthorName() == 'Anonymous', 'Comment author successfully changed to anonymous.'); + $this->assertTrue($comment->getOwnerId() == 0, 'Comment author successfully changed to anonymous.'); // Test changing the comment author to an unverified user. $random_name = $this->randomMachineName(); diff --git a/core/modules/field/tests/src/Functional/FormTest.php b/core/modules/field/tests/src/Functional/FormTest.php index 37aa822ed47220b72f3992beeed99d0631f9ab49..e443ccabcb82f7875d922d4369e2813badd0e40f 100644 --- a/core/modules/field/tests/src/Functional/FormTest.php +++ b/core/modules/field/tests/src/Functional/FormTest.php @@ -272,7 +272,7 @@ public function testFieldFormUnlimited() { // Check if aria-describedby attribute is placed on multiple value widgets. $elements = $this->xpath('//table[@id="field-unlimited-values" and @aria-describedby="edit-field-unlimited--description"]'); - $this->assertTrue(isset($elements[0]), t('aria-describedby attribute is properly placed on multiple value widgets.')); + $this->assertTrue(isset($elements[0]), 'aria-describedby attribute is properly placed on multiple value widgets.'); // Press 'add more' button -> 2 widgets. $this->drupalPostForm(NULL, [], t('Add another item')); diff --git a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php index 25848e7882d093aa42bce82e4d682edd03d00459..025f07a5b4281f1388e1cf98cf0bd57cd4b1bbaa 100644 --- a/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php +++ b/core/modules/language/tests/src/Functional/LanguageSwitchingTest.php @@ -276,12 +276,12 @@ public function testLanguageBodyClass() { // Check if the default (English) admin/config page has the right class. $this->drupalGet('admin/config'); $class = $this->xpath('//body[contains(@class, :class)]', [':class' => $searched_class]); - $this->assertTrue(isset($class[0]), t('The path-admin class appears on default language.')); + $this->assertTrue(isset($class[0]), 'The path-admin class appears on default language.'); // Check if the French admin/config page has the right class. $this->drupalGet('fr/admin/config'); $class = $this->xpath('//body[contains(@class, :class)]', [':class' => $searched_class]); - $this->assertTrue(isset($class[0]), t('The path-admin class same as on default language.')); + $this->assertTrue(isset($class[0]), 'The path-admin class same as on default language.'); // The testing profile sets the user/login page as the frontpage. That // redirects authenticated users to their profile page, so check with an @@ -316,17 +316,17 @@ protected function doTestLanguageLinkActiveClassAuthenticated() { // Language code 'none' link should be active. $langcode = 'none'; $links = $this->xpath('//a[@id = :id and @data-drupal-link-system-path = :path]', [':id' => 'no_lang_link', ':path' => $path]); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.'); // Language code 'en' link should be active. $langcode = 'en'; $links = $this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]', [':id' => 'en_link', ':lang' => 'en', ':path' => $path]); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.'); // Language code 'fr' link should not be active. $langcode = 'fr'; $links = $this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]', [':id' => 'fr_link', ':lang' => 'fr', ':path' => $path]); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to NOT mark it as active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode has the correct attributes that will allow the drupal.active-link library to NOT mark it as active.'); // Verify that drupalSettings contains the correct values. $settings = $this->getDrupalSettings(); @@ -341,17 +341,17 @@ protected function doTestLanguageLinkActiveClassAuthenticated() { // Language code 'none' link should be active. $langcode = 'none'; $links = $this->xpath('//a[@id = :id and @data-drupal-link-system-path = :path]', [':id' => 'no_lang_link', ':path' => $path]); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.'); // Language code 'en' link should not be active. $langcode = 'en'; $links = $this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]', [':id' => 'en_link', ':lang' => 'en', ':path' => $path]); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to NOT mark it as active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode has the correct attributes that will allow the drupal.active-link library to NOT mark it as active.'); // Language code 'fr' link should be active. $langcode = 'fr'; $links = $this->xpath('//a[@id = :id and @hreflang = :lang and @data-drupal-link-system-path = :path]', [':id' => 'fr_link', ':lang' => 'fr', ':path' => $path]); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode has the correct attributes that will allow the drupal.active-link library to mark it as active.'); // Verify that drupalSettings contains the correct values. $settings = $this->getDrupalSettings(); @@ -377,17 +377,17 @@ protected function doTestLanguageLinkActiveClassAnonymous() { // Language code 'none' link should be active. $langcode = 'none'; $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', [':id' => 'no_lang_link', ':class' => 'is-active']); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode is marked active.'); // Language code 'en' link should be active. $langcode = 'en'; $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', [':id' => 'en_link', ':class' => 'is-active']); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode is marked active.'); // Language code 'fr' link should not be active. $langcode = 'fr'; $links = $this->xpath('//a[@id = :id and not(contains(@class, :class))]', [':id' => 'fr_link', ':class' => 'is-active']); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is NOT marked active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode is NOT marked active.'); // Test links generated by the link generator on a French page. $current_language = 'French'; @@ -396,17 +396,17 @@ protected function doTestLanguageLinkActiveClassAnonymous() { // Language code 'none' link should be active. $langcode = 'none'; $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', [':id' => 'no_lang_link', ':class' => 'is-active']); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode is marked active.'); // Language code 'en' link should not be active. $langcode = 'en'; $links = $this->xpath('//a[@id = :id and not(contains(@class, :class))]', [':id' => 'en_link', ':class' => 'is-active']); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is NOT marked active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode is NOT marked active.'); // Language code 'fr' link should be active. $langcode = 'fr'; $links = $this->xpath('//a[@id = :id and contains(@class, :class)]', [':id' => 'fr_link', ':class' => 'is-active']); - $this->assertTrue(isset($links[0]), t('A link generated by :function to the current :language page with langcode :langcode is marked active.', [':function' => $function_name, ':language' => $current_language, ':langcode' => $langcode])); + $this->assertTrue(isset($links[0]), 'A link generated by $function_name to the current $current_language page with langcode $langcode is marked active.'); } /** diff --git a/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php b/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php index c15efe51546a145ed721e2bb3a6b86f76e37ae79..90eafbc35487801f23400b419b2fd686b2ae2a2f 100644 --- a/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php +++ b/core/modules/search/tests/src/Functional/SearchNodeUpdateAndDeletionTest.php @@ -118,7 +118,7 @@ public function testSearchIndexUpdateOnNodeDeletion() { ->condition('word', 'dragons') ->execute() ->fetchField(); - $this->assertFalse($search_index_dataset, t('Node info successfully removed from search_index')); + $this->assertFalse($search_index_dataset, 'Node info successfully removed from search_index'); // Search again to verify the node doesn't appear anymore. $this->drupalPostForm('search/node', $edit, t('Search')); diff --git a/core/modules/system/tests/src/Functional/Form/ElementsLabelsTest.php b/core/modules/system/tests/src/Functional/Form/ElementsLabelsTest.php index ea9cc48ba24947139fa9682497bcbba207b47c95..5a5c16aee70cd7fb66a3b52ace87cc6f7a3483aa 100644 --- a/core/modules/system/tests/src/Functional/Form/ElementsLabelsTest.php +++ b/core/modules/system/tests/src/Functional/Form/ElementsLabelsTest.php @@ -123,13 +123,13 @@ public function testFormDescriptions() { $field_id = 'edit-form-textfield-test-description-after'; $description_id = $field_id . '--description'; $elements = $this->xpath('//input[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]/following-sibling::div[@id="' . $description_id . '"]'); - $this->assertTrue(isset($elements[0]), t('Properly places the #description element after the form item.')); + $this->assertTrue(isset($elements[0]), 'Properly places the #description element after the form item.'); // Check #description placement with #description_display='before'. $field_id = 'edit-form-textfield-test-description-before'; $description_id = $field_id . '--description'; $elements = $this->xpath('//input[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]/preceding-sibling::div[@id="' . $description_id . '"]'); - $this->assertTrue(isset($elements[0]), t('Properly places the #description element before the form item.')); + $this->assertTrue(isset($elements[0]), 'Properly places the #description element before the form item.'); // Check if the class is 'visually-hidden' on the form element description // for the option with #description_display='invisible' and also check that @@ -137,7 +137,7 @@ public function testFormDescriptions() { $field_id = 'edit-form-textfield-test-description-invisible'; $description_id = $field_id . '--description'; $elements = $this->xpath('//input[@id="' . $field_id . '" and @aria-describedby="' . $description_id . '"]/following-sibling::div[contains(@class, "visually-hidden")]'); - $this->assertTrue(isset($elements[0]), t('Properly renders the #description element visually-hidden.')); + $this->assertTrue(isset($elements[0]), 'Properly renders the #description element visually-hidden.'); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php index 0ad3dd9c98feb932df222ba8ca7678fd9a694eac..73ef33d732d95f9561f4c616f5717573c69538b9 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -379,7 +379,7 @@ public function testFieldUpdateFailure() { ]; $schema = Database::getConnection()->schema(); foreach ($tables as $table_name) { - $this->assertTrue($schema->tableExists($table_name), t('Table %table exists.', ['%table' => $table_name])); + $this->assertTrue($schema->tableExists($table_name), 'Table $table_name exists.'); } } @@ -405,8 +405,8 @@ public function testFieldUpdateIndexesWithData() { // Verify the indexes we will create do not exist yet. foreach ($tables as $table) { - $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), t("No index named value exists in @table", ['@table' => $table])); - $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), t("No index named value_format exists in @table", ['@table' => $table])); + $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), 'No index named value exists in $table'); + $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), 'No index named value_format exists in $table'); } // Add data so the table cannot be dropped. @@ -424,15 +424,15 @@ public function testFieldUpdateIndexesWithData() { $field_storage->setIndexes(['value' => [['value', 255]]]); $field_storage->save(); foreach ($tables as $table) { - $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value created in @table", ['@table' => $table])); + $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), "Index on value created in @table", ['@table' => $table]); } // Add a different index, removing the existing custom one. $field_storage->setIndexes(['value_format' => [['value', 127], ['format', 127]]]); $field_storage->save(); foreach ($tables as $table) { - $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), t("Index on value_format created in @table", ['@table' => $table])); - $this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value removed in @table", ['@table' => $table])); + $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), "Index on value_format created in @table", ['@table' => $table]); + $this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), "Index on value removed in @table", ['@table' => $table]); } // Verify that the tables were not dropped in the process. diff --git a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php index 020d6134e4d9543cd07681651abda312d4d419a8..6e715deb0acda2fc7745c931761e89f2e62f3f8b 100644 --- a/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php +++ b/core/tests/Drupal/KernelTests/Core/File/DirectoryTest.php @@ -37,7 +37,7 @@ public function testFileCheckLocalDirectoryHandling() { $child_path = $parent_path . DIRECTORY_SEPARATOR . $child; /** @var \Drupal\Core\File\FileSystemInterface $file_system */ $file_system = \Drupal::service('file_system'); - $this->assertTrue($file_system->mkdir($child_path, 0775, TRUE), t('No error reported when creating new local directories.'), 'File'); + $this->assertTrue($file_system->mkdir($child_path, 0775, TRUE), 'No error reported when creating new local directories.'); // Ensure new directories also exist. $this->assertDirectoryExists($parent_path);