Remove remaining unnecessary uses of t() in tests

Created on 20 December 2023, 11 months ago
Updated 30 August 2024, 3 months ago

Problem/Motivation

๐Ÿ“Œ [meta] Remove usage of t() in tests not testing translation Active has removed most uses of t() in tests. A handful of stragglers remain; all cases need checking individually. The following cases should remain:

  • Tests that explicitly test translation
  • Tests that test that other parts of the API correctly receive TranslatableMarkup
  • Tests that use render, form or field API structures that would normally use TranslatableMarkup outside of tests

Steps to reproduce

Proposed resolution

Use find core -type f -iname '*Test.php' | xargs grep '[^a-zA-Z]t(' | grep -v "^.*:\s*//" | grep -v "^.*:\s*\*" | awk -F: '{print $1}' | sort -u to get a list of files to check.

No change needed on these files

  1. core/modules/content_translation/tests/src/Kernel/ContentTranslationHandlerTest.php
  2. core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php
  3. core/modules/language/tests/language_test/src/Entity/NoLanguageEntityTest.php
  4. core/modules/locale/tests/src/Functional/LocaleImportFunctionalTest.php
  5. core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php
  6. core/modules/locale/tests/src/Functional/LocaleUpdateTest.php
  7. core/modules/locale/tests/src/Kernel/LocaleStringIsSafeTest.php
  8. core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php
  9. core/modules/mysql/tests/src/Unit/InstallTasksTest.php
  10. core/modules/node/tests/src/Functional/NodeTypeTranslationTest.php
  11. core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php
  12. core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php
  13. core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php
  14. core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php
  15. core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php
  16. core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php
  17. core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php
  18. core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php
  19. core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php
  20. core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php
  21. core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php
  22. core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationMultipleLanguageNonInteractiveTest.php
  23. core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php
  24. core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php
  25. core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
  26. core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php

Remaining tasks

Review

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Needs review

Version

11.0 ๐Ÿ”ฅ

Component
Otherย  โ†’

Last updated about 2 hours ago

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @longwave
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

    As far as I can tell all remaining cases are one of the three cases in the issue summary where we explicitly want to leave translation in use.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Can the phpcs be fixed?

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

    Done.

  • Assigned to longwave
  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Ran the script from the meta

    find core -type f -iname '*Test.php' | xargs grep '[^a-zA-Z]t(' > remove_t_list.txt

    Think I found a few more

    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'admin_label' => $this->t('Broken/Missing'),
    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'category' => $this->t('Block'),
    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'admin_label' => $this->t('Coconut'),
    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'category' => $this->t('Group 2'),
    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'admin_label' => $this->t('Apple'),
    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'category' => $this->t('Group 1'),
    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'admin_label' => $this->t('Banana'),
    core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php:        'category' => $this->t('Group 2'),
    core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php:    $message = t('This value should be %limit or more.', ['%limit' => 5]);
    core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php:    $message = t('This value is too short. It should have %limit characters or more.', ['%limit' => 10]);
    core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php:      '#value' => t('Submit'),
    core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php:      '#value' => t('Submit'),
    core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php:    $this->assertEquals(t('The referenced entity (%type: %id) does not exist.', ['%type' => $this->referencedEntityType, '%id' => 9999]), $violations[0]->getMessage());
    core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php:    $this->assertEquals(t('This entity (%type: %id) cannot be referenced.', ['%type' => $this->referencedEntityType, '%id' => $referenced_entity->id()]), $violations[0]->getMessage());
    
    
    
    core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php:    $this->assertEquals(t('There are no test entity entities matching "%value".', ['%value' => 'single - non-existent label']), $form_state->getErrors()['single']);
    core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php:    $this->assertEquals(t('The referenced entity (%type: %id) does not exist.', ['%type' => 'entity_test', '%id' => 42]), $form_state->getErrors()['single']);
    core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php:    $this->assertEquals(t('There are no test entity entities matching "%value".', ['%value' => 'single - non-existent label']), $form_state->getErrors()['single_no_validate']);
    core/tests/Drupal/KernelTests/Core/Entity/BundleConstraintValidatorTest.php:    $this->assertEquals(t('The entity must be of bundle %bundle.', ['%bundle' => implode(', ', (array) $bundle)]), $violation->getMessage(), 'The message for invalid value is correct.');
    core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php:    $this->assertEquals(t('The referenced entity (%type: %id) does not exist.', ['%type' => 'user', '%id' => $entity->id()]), $violation->getMessage(), 'The message for invalid value is correct.');
    core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php:    $this->assertEquals(t('This entity (%type: %id) cannot be referenced.', [
    core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php:    $this->assertEquals(t('This entity (%type: %id) cannot be referenced.', [
    core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php:    $this->assertEquals(t('This entity (%type: %id) cannot be referenced.', [
    core/tests/Drupal/KernelTests/Core/Entity/ValidReferenceConstraintValidatorTest.php:    $this->assertEquals(t('The referenced entity (%type: %id) does not exist.', [
    core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php:    $this->assertEquals(t('%name: The integer must be larger or equal to %min.', ['%name' => 'ID', '%min' => 0]), $violations[0]->getMessage());
    core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php:    $this->assertEquals(t('%name: may not be longer than @max characters.', ['%name' => 'UUID', '@max' => 128]), $violations[0]->getMessage());
    core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php:    $this->assertEquals(t('This value is too long. It should have %limit characters or less.', ['%limit' => '12']), $violations[0]->getMessage());
    core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php:    $this->assertEquals(t('%name: may not be longer than @max characters.', ['%name' => 'Name', '@max' => 64]), $violations[0]->getMessage());
    core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php:    $this->assertEquals(t('The referenced entity (%type: %id) does not exist.', ['%type' => 'user', '%id' => 9999]), $violations[0]->getMessage());
    core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php:    $this->assertEquals(t('The entity must be of type %type.', ['%type' => $entity_type]), $violation->getMessage(), 'The message for invalid value is correct.');
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:      '#value' => t('Submit'),
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:    $this->assertEquals(['required_validate' => t('@name field is required.', ['@name' => 'required_validate'])], $errors);
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:      'required_validate' => t('This path does not exist or you do not have permission to link to %path.', ['%path' => 'user/74']),
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:      'required_validate_route' => t('This path does not exist or you do not have permission to link to %path.', ['%path' => 'user/74']),
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:      'required_validate_url' => t('This path does not exist or you do not have permission to link to %path.', ['%path' => 'user/74']),
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:      'required_non_validate' => t('@name field is required.', ['@name' => 'required_non_validate']),
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:      'optional_validate' => t('This path does not exist or you do not have permission to link to %path.', ['%path' => 'user/74']),
    core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php:      'optional_validate_route' => t('This path does not exist or you do not have permission to link to %path.', ['%path' => 'user/74']),
    core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php:    // Test passing a safe string to t().
    core/tests/Drupal/KernelTests/Core/Url/LinkGenerationTest.php:    // Test passing an unsafe string to t().
    core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php:        'title' => t('GD library'),
    core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php:        'description' => t("Supported image file formats: %formats.", [
    core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php:   * Tests t() functionality.
    core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php:    $text = t('Simple text');
    core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php:    $text = t('Escaped text: @value', ['@value' => '<script>']);
    core/tests/Drupal/KernelTests/Core/Common/XssUnitTest.php:    $text = t('Placeholder text: %value', ['%value' => '<script>']);
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_reference_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_reference_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/tests/Drupal/KernelTests/Core/Validation/UniqueValuesConstraintValidatorTest.php:    $this->assertEquals(t('A unique field entity with unique_field_test %value already exists.', [
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'filename' => $this->t('The path of the primary file for this item.'),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'name' => $this->t('The name of the item; e.g. node.'),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'type' => $this->t('The type of the item, either module, theme, or theme_engine.'),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'owner' => $this->t("A theme's 'parent'. Can be either a theme or an engine."),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'status' => $this->t('Boolean indicating whether or not this item is enabled.'),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'throttle' => $this->t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      '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)."),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'schema_version' => $this->t("The module's database schema version number."),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'weight' => $this->t("The order in which this module's hooks should be invoked."),
    core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php:      'info' => $this->t("A serialized array containing information from the module's .info file."),
    core/modules/shortcut/tests/src/Functional/ShortcutLinksTest.php:   *   t(). If left blank, a default message will be displayed.
    core/modules/contact/tests/src/Functional/ContactSitewideTest.php:    $this->assertEquals(t('[@label] @subject', ['@label' => $label, '@subject' => $edit['subject[0][value]']]), $mail['subject']);
    core/modules/locale/tests/src/Kernel/LocaleStringIsSafeTest.php:      // Pass the original string to the t() function to get it marked as safe.
    core/modules/locale/tests/src/Kernel/LocaleStringIsSafeTest.php:      $safe_string = t($original_string);
    core/modules/locale/tests/src/Kernel/LocaleStringIsSafeTest.php:      // t() function always marks the string as safe so it won't be escaped,
    core/modules/file/tests/src/Functional/FileManagedFileElementTest.php:    // via a t() call before.
    core/modules/file/tests/src/Kernel/SaveTest.php:    $this->assertEquals(t('The file %value already exists. Enter a unique file URI.', ['%value' => $uppercase_file_duplicate->getFileUri()]), $violations[0]->getMessage());
    core/modules/comment/tests/src/Kernel/CommentValidationTest.php:    $this->assertEquals(t('This entity (%type: %name) cannot be referenced.', [
    core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php:    // because t() is called on there.
    core/modules/toolbar/tests/src/Functional/ToolbarAdminMenuTest.php:    t($name, [], ['langcode' => $langcode]);
    core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php:      '#title' => t('Language select'),
    core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php:    // into database when seen by t(). Without doing this, our target string
    core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php:    // Now the t()'ed string is in db so switch the language back to default.
    core/modules/user/tests/src/Functional/Views/BulkFormTest.php:    $this->assertEquals(t('Field %field set in %filter is not usable for this filter type. Combined field filter only works for simple fields.', ['%field' => 'User: Bulk update', '%filter' => 'Global: Combine fields filter']), reset($errors['default']));
    core/modules/user/tests/src/Kernel/UserValidationTest.php:    $this->assertEquals(t('The username %name is too long: it must be %max characters or less.', ['%name' => $name, '%max' => 60]), $violations[0]->getMessage());
    core/modules/user/tests/src/Kernel/UserValidationTest.php:    $this->assertEquals(t('The username %name is already taken.', ['%name' => 'existing']), $violations[0]->getMessage());
    core/modules/user/tests/src/Kernel/UserValidationTest.php:    $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());
    core/modules/user/tests/src/Kernel/UserValidationTest.php:    $this->assertEquals(t('The email address %mail is already taken.', ['%mail' => 'existing@example.com']), $violations[0]->getMessage());
    core/modules/user/tests/src/Kernel/UserValidationTest.php:    $this->assertEquals(t('@name field is required.', ['@name' => $user->getFieldDefinition('mail')->getLabel()]), $violations[0]->getMessage());
    core/modules/user/tests/src/Kernel/UserValidationTest.php:    $this->assertEquals(t('The referenced entity (%entity_type: %name) does not exist.', ['%entity_type' => 'user_role', '%name' => 'unknown_role']), $violations[0]->getMessage());
    core/modules/user/tests/src/Kernel/UserValidationTest.php:    $this->assertEquals(t('%name: may not be longer than @max characters.', ['%name' => $field_label, '@max' => $length]), $violations[$expected_index]->getMessage());
    core/modules/field/tests/src/Kernel/FieldCrudTest.php:    $this->assertEquals(t('%name does not accept the value @value.', ['%name' => $field_name, '@value' => -2]), $violations[0]->getMessage());
    core/modules/field/tests/src/Kernel/FieldCrudTest.php:    $this->assertEquals(t('This value should be between %min and %max.', ['%min' => 0, '%max' => 32]), $violations[1]->getMessage());
    core/modules/field/tests/src/Kernel/FieldCrudTest.php:    $this->assertEquals(t('This value should be between %min and %max.', ['%min' => 0, '%max' => 32]), $violations[0]->getMessage());
    core/modules/field/tests/src/Kernel/FieldValidationTest.php:    $this->assertEquals(t('%name: this field cannot hold more than @count values.', ['%name' => $this->fieldTestData->field->getLabel(), '@count' => $cardinality]), $violations[0]->getMessage());
    core/modules/forum/tests/src/Unit/Breadcrumb/ForumBreadcrumbBuilderBaseTest.php:    // Add a translation manager for t().
    core/modules/forum/tests/src/Unit/Breadcrumb/ForumListingBreadcrumbBuilderTest.php:    // Add a translation manager for t().
    core/modules/forum/tests/src/Unit/Breadcrumb/ForumNodeBreadcrumbBuilderTest.php:    // Add a translation manager for t().
    core/modules/forum/tests/src/Kernel/ForumValidationTest.php:    $this->assertEquals(t('The item %forum is a forum container, not a forum. Select one of the forums below instead.', ['%forum' => $container->label()]), $violations[0]->getMessage());
    core/modules/action/tests/action_form_ajax_test/src/Plugin/Action/ActionAjaxTest.php:      '#title' => $this->t('Are we having a party?'),
    core/modules/action/tests/action_form_ajax_test/src/Plugin/Action/ActionAjaxTest.php:        '#title' => $this->t('Party time'),
    core/modules/migrate/tests/modules/migrate_high_water_test/src/Plugin/migrate/source/HighWaterTest.php:      'id' => $this->t('Id'),
    core/modules/migrate/tests/modules/migrate_high_water_test/src/Plugin/migrate/source/HighWaterTest.php:      'title' => $this->t('Title'),
    core/modules/migrate/tests/modules/migrate_high_water_test/src/Plugin/migrate/source/HighWaterTest.php:      'changed' => $this->t('Changed'),
    core/modules/migrate/tests/modules/migrate_track_changes_test/src/Plugin/migrate/source/TrackChangesTest.php:      'tid' => $this->t('Term id'),
    core/modules/migrate/tests/modules/migrate_track_changes_test/src/Plugin/migrate/source/TrackChangesTest.php:      'name' => $this->t('Name'),
    core/modules/migrate/tests/modules/migrate_track_changes_test/src/Plugin/migrate/source/TrackChangesTest.php:      'description' => $this->t('Description'),
    core/modules/migrate/tests/modules/migrate_query_batch_test/src/Plugin/migrate/source/QueryBatchTest.php:      'id' => $this->t('Id'),
    core/modules/migrate/tests/modules/migrate_query_batch_test/src/Plugin/migrate/source/QueryBatchTest.php:      'data' => $this->t('data'),
    core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php:    $this->assertSame(sprintf('1: [user]: name=%s||name=%s||mail=Email field is required.', $username_constraint->illegalMessage, t($username_constraint->tooLongMessage, ['%name' => $long_username, '%max' => 60])), $this->messages[0], 'First message should have 3 validation errors.');
    core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php:    $this->assertEquals(t('%name: may not be longer than @max characters.', ['%name' => $field_label, '@max' => 255]), $violations[0]->getMessage());
    core/modules/mysql/tests/src/Unit/InstallTasksTest.php:      protected function t($string, array $args = [], array $options = []) {
    core/modules/mysql/tests/src/Unit/InstallTasksTest.php:      protected function t($string, array $args = [], array $options = []) {
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:        'heading' => $this->t('I am a banner'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:        'ctaText' => $this->t('Click me'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:          '#value' => $this->t('This is the contents of the banner body.'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:        'heading' => $this->t('I am a banner'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:        'ctaText' => $this->t('Click me'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:        fn ($props) => [...$props, 'heading' => $this->t('I am another banner')],
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:          '#value' => $this->t('This is the contents of the banner body.'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:          'heading' => $this->t('I am a banner'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:          'ctaText' => $this->t('Click me'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:        'heading' => $this->t('I am a banner'),
    core/modules/sdc/tests/src/Kernel/ComponentRenderTest.php:        'ctaText' => $this->t('Click me'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php:        '#title' => $this->t('Title field'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php:        '#description' => $this->t('Choose the field with the custom title.'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php:        '#title' => $this->t('Name field'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php:        '#description' => $this->t('Choose the field with the custom name.'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php:        '#title' => $this->t('Numeric field'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php:        '#description' => $this->t('Select one or more numeric fields.'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php:      '#title' => $this->t('Test option'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php:      '#description' => $this->t('This is a textfield for test_option.'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php:        '#value' => $this->t('Test Button'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php:      $view_args = !empty($this->view->args) ? implode(', ', $this->view->args) : $this->t('no arguments');
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php:      $this->messenger()->addStatus($this->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php:      '#title' => $this->t('Test option'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php:      '#description' => $this->t('This is a textfield for test_option.'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php:      'title' => $this->t('Display test settings'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php:    $test_option = $this->getOption('test_option') ?: $this->t('Empty');
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php:      'title' => $this->t('Test option'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php:        $form['#title'] .= $this->t('Test option');
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php:          '#title' => $this->t('Test option'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php:          '#description' => $this->t('This is a textfield for test_option.'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php:          $form_state->setError($form['test_option'], $this->t('You cannot have an empty option.'));
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php:      '#title' => $this->t('Controls whether the filter plugin should be active'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php:      '#title' => $this->t('Test setting'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php:    $options['test_extender_test_option'] = ['default' => $this->t('Empty')];
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php:      'title' => $this->t('Display extender test settings'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php:      'title' => $this->t('Test option'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php:        $form['#title'] .= $this->t('Test option');
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php:          '#title' => $this->t('Test option'),
    core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php:          '#description' => $this->t('This is a textfield for test_option.'),
    core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php:   *   variables in the message text, not t(). If left blank, a default message
    core/modules/views/tests/src/Kernel/Handler/FieldKernelTest.php:   *   variables in the message text, not t(). If left blank, a default message
    core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php:      'baz' => $this->t('qux'),
    core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php:    $this->assertEquals(t('Field %field set in %filter is not set in display %display.', ['%field' => 'dummy', '%filter' => 'Global: Combine fields filter', '%display' => 'Default']), reset($errors['default']));
    core/modules/views/tests/src/Kernel/Handler/FilterCombineTest.php:    $this->assertEquals(t('%display: %filter can only be used on displays that use fields. Set the style or row format for that display to one using fields to use the combine field filter.', ['%filter' => 'Global: Combine fields filter', '%display' => 'Default']), reset($errors['default']));
    core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php:      'attribute_1' => ['label' => $this->t('Attribute 1'), 'value' => 'Value 1'],
    core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php:      'attribute_2' => ['label' => $this->t('Attribute 2'), 'value' => 'Value 1'],
    core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php:      'attribute_1' => ['label' => $this->t('Attribute 1'), 'value' => 'Value 1'],
    core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php:      'attribute_2' => ['label' => $this->t('Attribute 2'), 'value' => 'Value 1'],
    core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php:      '#title' => $this->t('Test config value'),
    

    Removed any related to translations, setLabel, or setDescription.

    Lets let @longwave to confirm these before anyone works on them

  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

    Fixed BlockManagerTest. The list in #7 seems out of date as a number of them were fixed already by the last assertEquals() issue and no longer appear in 11.x.

    For the remainder, as far as I can tell all of them are testing some form of API that might be able to accept translatable strings - form API, migrate API, typed data, etc. - so I think these are valid tests.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Seems to have phpcs issue.

    Rerunning the check now.

  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    The number if down to 170

    Attaching a txt so based on #8 will agree leaving on titles, description on forms makes sense.

  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Nikolay Shapovalov โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    11 months ago
    Total: 199s
    #67224
  • Pipeline finished with Failed
    11 months ago
    Total: 164s
    #67230
  • ๐Ÿ‡ท๐Ÿ‡บRussia zniki.ru

    Updated list using command to include line number on current MR changes:

    find core -type f -iname '*Test.php' | xargs grep '[^a-zA-Z]t(' -n > remove_t_list.txt
    
  • First commit to issue fork.
  • Status changed to Needs review 5 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    Time to review this to see if only the instances that need to be fixed are fixed and that others haven't crept in.

  • Status changed to Needs work 5 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Applied MR and ran the same find command

    Not sure the views_test_data and all the kernel tests are related to translations.

  • Pipeline finished with Success
    4 months ago
    Total: 565s
    #237089
  • Pipeline finished with Success
    4 months ago
    Total: 538s
    #237143
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    So, after working on this for a bit I realized that I was making out of scope changes and there were existing ones as well. I have reverted the changes that were adding StringTranslationTrait. Those changes still need to be done so I'll make an issue for those in a bit.

  • Pipeline finished with Success
    4 months ago
    Total: 472s
    #237268
  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    I think this is complete now.

  • Pipeline finished with Success
    3 months ago
    Total: 387s
    #262501
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    Add core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php to the list of files not to be changed.

  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Also believe this is complete now!

  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

    Added a few questions, not sure of the answers.

  • Issue was unassigned.
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK
  • Status changed to Needs work 3 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Sounds like this does need more work.

    Interesting comments @longwave do we avoid best practice to avoid unnecessary calls in tests?

  • Pipeline finished with Failed
    3 months ago
    Total: 2092s
    #268780
  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Believe feedback has been addressed.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom catch

    MR has merge conflicts.

  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone

    Rebase and there was a conflict in the baseline.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Rebase seems good.

Production build 0.71.5 2024