diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php index 61b21e753c19040468046277dc8a4a332a43c77d..92e9ebcaf7ece68aa1c7271094291fbd2f795884 100644 --- a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php +++ b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php @@ -7,7 +7,6 @@ use Drupal\comment\Entity\Comment; use Drupal\comment\Entity\CommentType; use Drupal\Core\Session\AnonymousUserSession; -use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\entity_test\Entity\EntityTest; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\user\Entity\Role; @@ -22,8 +21,6 @@ */ class CommentUserNameTest extends ViewsKernelTestBase { - use StringTranslationTrait; - /** * Admin user. * @@ -86,7 +83,7 @@ protected function setUp($import_test_views = TRUE): void { $commentType = CommentType::create([ 'id' => 'entity_test_comment', - 'label' => $this->t('Entity Test Comment'), + 'label' => 'Entity Test Comment', 'target_entity_type_id' => 'entity_test', ]); $commentType->save(); diff --git a/core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php b/core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php index 8fb0d347bac14d915f1897421e6dea578beeddf4..544fe4268ff86e0010c8a4e6f0895b8560a423bb 100644 --- a/core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php +++ b/core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/Test.php @@ -30,8 +30,8 @@ public function getMetadataAttributes() { // change the metadata attributes and makes it easier to test different // variations. $attributes = \Drupal::state()->get('media_source_test_attributes', [ - 'attribute_1' => ['label' => $this->t('Attribute 1'), 'value' => 'Value 1'], - 'attribute_2' => ['label' => $this->t('Attribute 2'), 'value' => 'Value 1'], + 'attribute_1' => ['label' => 'Attribute 1', 'value' => 'Value 1'], + 'attribute_2' => ['label' => 'Attribute 2', 'value' => 'Value 1'], ]); return array_map(function ($item) { return $item['label']; @@ -43,8 +43,8 @@ public function getMetadataAttributes() { */ public function getMetadata(MediaInterface $media, $attribute_name) { $attributes = \Drupal::state()->get('media_source_test_attributes', [ - 'attribute_1' => ['label' => $this->t('Attribute 1'), 'value' => 'Value 1'], - 'attribute_2' => ['label' => $this->t('Attribute 2'), 'value' => 'Value 1'], + 'attribute_1' => ['label' => 'Attribute 1', 'value' => 'Value 1'], + 'attribute_2' => ['label' => 'Attribute 2', 'value' => 'Value 1'], ]); if (in_array($attribute_name, array_keys($attributes))) { @@ -81,7 +81,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta $form['test_config_value'] = [ '#type' => 'textfield', - '#title' => $this->t('Test config value'), + '#title' => 'Test config value', '#default_value' => $this->configuration['test_config_value'], ]; diff --git a/core/modules/migrate/tests/modules/migrate_high_water_test/src/Plugin/migrate/source/HighWaterTest.php b/core/modules/migrate/tests/modules/migrate_high_water_test/src/Plugin/migrate/source/HighWaterTest.php index 4734da04e00686776c16f4bafcfe5d4c4bc3754d..27eecb9edfd88c051c4ebca7ad21f6dc373012e2 100644 --- a/core/modules/migrate/tests/modules/migrate_high_water_test/src/Plugin/migrate/source/HighWaterTest.php +++ b/core/modules/migrate/tests/modules/migrate_high_water_test/src/Plugin/migrate/source/HighWaterTest.php @@ -32,9 +32,9 @@ public function query() { */ public function fields() { $fields = [ - 'id' => $this->t('Id'), - 'title' => $this->t('Title'), - 'changed' => $this->t('Changed'), + 'id' => 'Id', + 'title' => 'Title', + 'changed' => 'Changed', ]; return $fields; diff --git a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php index 648f3b6099e7b6018045b6df0671cb9dc6fe4e69..c3cc5bbc74ee5374a8401f20a1151559abda1401 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php @@ -5,7 +5,6 @@ namespace Drupal\Tests\migrate\Kernel; use Drupal\Component\Render\FormattableMarkup; -use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\filter\Entity\FilterFormat; @@ -26,8 +25,6 @@ */ class MigrateEntityContentValidationTest extends KernelTestBase { - use StringTranslationTrait; - /** * {@inheritdoc} */ @@ -157,8 +154,6 @@ public function test2(): void { ], ]); $this->assertSame(sprintf('1: [user]: name=%s||name=%s||mail=Email field is required.', $username_constraint->illegalMessage, new FormattableMarkup($username_constraint->tooLongMessage, ['%name' => $long_username, '%max' => 60])), $this->messages[0], 'First message should have 3 validation errors.'); - // phpcs:ignore Drupal.Semantics.FunctionT.NotLiteralString - $this->assertSame(sprintf('1: [user]: name=%s||name=%s||mail=Email field is required.', $username_constraint->illegalMessage, $this->t($username_constraint->tooLongMessage, ['%name' => $long_username, '%max' => 60])), $this->messages[0], 'First message should have 3 validation errors.'); $this->assertSame(sprintf('2: [user]: name=%s||mail=Email field is required.', $username_constraint->illegalMessage), $this->messages[1], 'Second message should have 2 validation errors.'); $this->assertSame(sprintf('3: [user]: name=%s||mail=Email field is required.', $username_constraint->illegalMessage), $this->messages[2], 'Third message should have 2 validation errors.'); $this->assertArrayNotHasKey(3, $this->messages, 'Fourth message should not exist.'); diff --git a/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php b/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php index 2825f3b9ee816a59f1b9727fc2445b42703eeff2..e2d5d432958b922a67564d184eea4c6f0998e9e0 100644 --- a/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php +++ b/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php @@ -93,7 +93,7 @@ public function testSettingsLogoOptionsForm(): void { 'logo_provider' => 'custom', 'logo_path' => $logo_file->getFileUri(), ]; - $this->submitForm($edit, $this->t('Save configuration')); + $this->submitForm($edit, 'Save configuration'); // Refresh the page to verify custom logo is placed. $this->drupalGet('/admin/config/user-interface/navigation/settings'); $this->assertSession()->elementExists('css', 'a.admin-toolbar__logo > img'); @@ -104,7 +104,7 @@ public function testSettingsLogoOptionsForm(): void { 'logo_provider' => 'custom', 'logo_path' => 'core/misc/logo/drupal-logo.svg', ]; - $this->submitForm($edit, $this->t('Save configuration')); + $this->submitForm($edit, 'Save configuration'); // Refresh the page to verify custom logo is placed. $this->drupalGet('/admin/config/user-interface/navigation/settings'); $this->assertSession()->elementExists('css', 'a.admin-toolbar__logo > img'); @@ -116,7 +116,7 @@ public function testSettingsLogoOptionsForm(): void { 'logo_provider' => 'custom', 'files[logo_upload]' => $this->fileSystem->realpath($file->uri), ]; - $this->submitForm($edit, $this->t('Save configuration')); + $this->submitForm($edit, 'Save configuration'); $this->assertSession()->statusMessageContains('The image was resized to fit within the navigation logo expected dimensions of 40x40 pixels. The new dimensions of the resized image are 40x27 pixels.'); // Refresh the page to verify custom logo is placed. $this->drupalGet('/admin/config/user-interface/navigation/settings'); diff --git a/core/modules/navigation/tests/src/Unit/TopBarItemManagerTest.php b/core/modules/navigation/tests/src/Unit/TopBarItemManagerTest.php index fb61242b65fce92de5173a091888fb384a9db0a8..e82f0d03f32310bf26fb37e57d44765e44afda95 100644 --- a/core/modules/navigation/tests/src/Unit/TopBarItemManagerTest.php +++ b/core/modules/navigation/tests/src/Unit/TopBarItemManagerTest.php @@ -49,19 +49,19 @@ protected function setUp(): void { // that are purposefully not in alphabetical order. $discovery->getDefinitions()->willReturn([ 'tools' => [ - 'label' => $this->t('Tools'), + 'label' => 'Tools', 'region' => TopBarRegion::Tools, ], 'context' => [ - 'admin_label' => $this->t('Context'), + 'admin_label' => 'Context', 'region' => TopBarRegion::Context, ], 'actions' => [ - 'label' => $this->t('Actions'), + 'label' => 'Actions', 'region' => TopBarRegion::Actions, ], 'more_actions' => [ - 'label' => $this->t('More Actions'), + 'label' => 'More Actions', 'region' => TopBarRegion::Actions, ], ]); diff --git a/core/modules/system/tests/src/Kernel/System/RunTimeRequirementsTest.php b/core/modules/system/tests/src/Kernel/System/RunTimeRequirementsTest.php index 6c5577601166cd4285e26d106c07807b7d0d28a4..af027b48051e08d9dedd367fb3c381e6153c5174 100644 --- a/core/modules/system/tests/src/Kernel/System/RunTimeRequirementsTest.php +++ b/core/modules/system/tests/src/Kernel/System/RunTimeRequirementsTest.php @@ -28,18 +28,18 @@ public function testRuntimeRequirements(): void { // Enable the test module. \Drupal::service('module_installer')->install(['module_runtime_requirements']); $testRequirements = [ - 'title' => $this->t('RuntimeError'), - 'value' => $this->t('None'), - 'description' => $this->t('Runtime Error.'), + 'title' => 'RuntimeError', + 'value' => 'None', + 'description' => 'Runtime Error.', 'severity' => REQUIREMENT_ERROR, ]; $requirements = \Drupal::service('system.manager')->listRequirements()['test.runtime.error']; $this->assertEquals($testRequirements, $requirements); $testRequirementsAlter = [ - 'title' => $this->t('RuntimeWarning'), - 'value' => $this->t('None'), - 'description' => $this->t('Runtime Warning.'), + 'title' => 'RuntimeWarning', + 'value' => 'None', + 'description' => 'Runtime Warning.', 'severity' => REQUIREMENT_WARNING, ]; $requirementsAlter = \Drupal::service('system.manager')->listRequirements()['test.runtime.error.alter']; diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php index a2376affe88a2c165ce536e8ddb51ed154e1e432..b6e96e34d55a78ec6591707848c4572d2a9246a2 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display/DisplayTest.php @@ -55,18 +55,18 @@ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); $categories['display_test'] = [ - 'title' => $this->t('Display test settings'), + 'title' => 'Display test settings', 'column' => 'second', 'build' => [ '#weight' => -100, ], ]; - $test_option = $this->getOption('test_option') ?: $this->t('Empty'); + $test_option = $this->getOption('test_option') ?: 'Empty'; $options['test_option'] = [ 'category' => 'display_test', - 'title' => $this->t('Test option'), + 'title' => 'Test option', 'value' => Unicode::truncate($test_option, 24, FALSE, TRUE), ]; } @@ -79,11 +79,11 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'test_option': - $form['#title'] .= $this->t('Test option'); + $form['#title'] .= 'Test option'; $form['test_option'] = [ - '#title' => $this->t('Test option'), + '#title' => 'Test option', '#type' => 'textfield', - '#description' => $this->t('This is a textfield for test_option.'), + '#description' => 'This is a textfield for test_option.', '#default_value' => $this->getOption('test_option'), ]; break; @@ -99,7 +99,7 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'test_option': if (!trim($form_state->getValue('test_option'))) { - $form_state->setError($form['test_option'], $this->t('You cannot have an empty option.')); + $form_state->setError($form['test_option'], 'You cannot have an empty option.'); } break; } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php index bbf2dbcb61d30521353779ed052e898f4cbfbf1d..0f9f6eef61b569d9f068bbbb9736310e78384af4 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/display_extender/DisplayExtenderTest.php @@ -32,7 +32,7 @@ class DisplayExtenderTest extends DisplayExtenderPluginBase { protected function defineOptions() { $options = parent::defineOptions(); - $options['test_extender_test_option'] = ['default' => $this->t('Empty')]; + $options['test_extender_test_option'] = ['default' => 'Empty']; return $options; } @@ -44,7 +44,7 @@ public function optionsSummary(&$categories, &$options) { parent::optionsSummary($categories, $options); $categories['display_extender_test'] = [ - 'title' => $this->t('Display extender test settings'), + 'title' => 'Display extender test settings', 'column' => 'second', 'build' => [ '#weight' => -100, @@ -53,7 +53,7 @@ public function optionsSummary(&$categories, &$options) { $options['test_extender_test_option'] = [ 'category' => 'display_extender_test', - 'title' => $this->t('Test option'), + 'title' => 'Test option', 'value' => Unicode::truncate($this->options['test_extender_test_option'], 24, FALSE, TRUE), ]; } @@ -64,11 +64,11 @@ public function optionsSummary(&$categories, &$options) { public function buildOptionsForm(&$form, FormStateInterface $form_state) { switch ($form_state->get('section')) { case 'test_extender_test_option': - $form['#title'] .= $this->t('Test option'); + $form['#title'] .= 'Test option'; $form['test_extender_test_option'] = [ - '#title' => $this->t('Test option'), + '#title' => 'Test option', '#type' => 'textfield', - '#description' => $this->t('This is a textfield for test_option.'), + '#description' => 'This is a textfield for test_option.', '#default_value' => $this->options['test_extender_test_option'], ]; } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php index c55c18b2899b51f178bff46881baa8c86e8cd783..028b8b3513d3582f0090f7a8b27fea0db262020e 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/field/FieldFormButtonTest.php @@ -48,7 +48,7 @@ public function viewsForm(&$form, FormStateInterface $form_state) { foreach ($this->view->result as $row_index => $row) { $form[$this->options['id']][$row_index] = [ '#type' => 'submit', - '#value' => $this->t('Test Button'), + '#value' => 'Test Button', '#name' => 'test-button-' . $row_index, '#test_button' => TRUE, '#row_index' => $row_index, @@ -69,13 +69,10 @@ public function viewsFormSubmit(&$form, FormStateInterface $form_state) { $triggering_element = $form_state->getTriggeringElement(); if (!empty($triggering_element['#test_button'])) { $row_index = $triggering_element['#row_index']; - $view_args = !empty($this->view->args) ? implode(', ', $this->view->args) : $this->t('no arguments'); - $this->messenger()->addStatus($this->t('The test button at row @row_index for @view_id (@display) View with args: @args was submitted.', [ - '@display' => $this->view->current_display, - '@view_id' => $this->view->id(), - '@args' => $view_args, - '@row_index' => $row_index, - ])); + $view_args = !empty($this->view->args) ? implode(', ', $this->view->args) : 'no arguments'; + $display = $this->view->current_display; + $view_id = $this->view->id(); + $this->messenger()->addStatus("The test button at row $row_index for $view_id ($display) View with args: $view_args was submitted."); } } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php index 4e1abde7a0ae2dfde3427050046715b220511a64..93bddef66640eb1cb8c58e35ea0e77b34d59651d 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/filter/FilterTest.php @@ -34,7 +34,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['test_enable'] = [ '#type' => 'checkbox', - '#title' => $this->t('Controls whether the filter plugin should be active'), + '#title' => 'Controls whether the filter plugin should be active', '#default_value' => $this->options['test_enable'], ]; } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php index 5729445f39b3bfd85fb0c86d0fa28868c9cf3326..0d1e494c705fa2c17d09e0ad62d82b8cc8c6d706 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/query/QueryTest.php @@ -67,7 +67,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['test_setting'] = [ - '#title' => $this->t('Test setting'), + '#title' => 'Test setting', '#type' => 'textfield', '#default_value' => $this->options['test_setting'], ]; diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php index 07611867a42845fb6cf127d61bc98f64b2adc04d..280b79fe00b284b98456b0c1538a09d52418eb68 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/row/RowTest.php @@ -47,9 +47,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['test_option'] = [ - '#title' => $this->t('Test option'), + '#title' => 'Test option', '#type' => 'textfield', - '#description' => $this->t('This is a textfield for test_option.'), + '#description' => 'This is a textfield for test_option.', '#default_value' => $this->options['test_option'], ]; } diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php index 20f009e7ddba50ca175ca62401ffb0bc05fe8522..5ef00c5172aab4307fdac65aa0fcfa0245d51d76 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php @@ -29,18 +29,18 @@ class MappingTest extends Mapping { protected function defineMapping() { return [ 'title_field' => [ - '#title' => $this->t('Title field'), - '#description' => $this->t('Choose the field with the custom title.'), + '#title' => 'Title field', + '#description' => 'Choose the field with the custom title.', '#toggle' => TRUE, '#required' => TRUE, ], 'name_field' => [ - '#title' => $this->t('Name field'), - '#description' => $this->t('Choose the field with the custom name.'), + '#title' => 'Name field', + '#description' => 'Choose the field with the custom name.', ], 'numeric_field' => [ - '#title' => $this->t('Numeric field'), - '#description' => $this->t('Select one or more numeric fields.'), + '#title' => 'Numeric field', + '#description' => 'Select one or more numeric fields.', '#multiple' => TRUE, '#toggle' => TRUE, '#filter' => 'filterNumericFields', diff --git a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php index 53c48f9fc76fcd3a1bd29054c9ecf53e13e448c2..48d398c9b59001ac77bb08738a4374e8b97db05f 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php +++ b/core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php @@ -53,9 +53,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['test_option'] = [ - '#title' => $this->t('Test option'), + '#title' => 'Test option', '#type' => 'textfield', - '#description' => $this->t('This is a textfield for test_option.'), + '#description' => 'This is a textfield for test_option.', '#default_value' => $this->options['test_option'], ]; } diff --git a/core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php b/core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php index 771c9bad6c48f6d4ab628d311917a0262ef8ac1b..70a5e804af78b88650b67d279e752a765c9d095d 100644 --- a/core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php +++ b/core/tests/Drupal/KernelTests/Components/ComponentRenderTest.php @@ -109,8 +109,8 @@ protected function checkEmbedWithNested(): void { '#type' => 'component', '#component' => 'sdc_test:my-banner', '#props' => [ - 'heading' => $this->t('I am a banner'), - 'ctaText' => $this->t('Click me'), + 'heading' => 'I am a banner', + 'ctaText' => 'Click me', 'ctaHref' => 'https://www.example.org', 'ctaTarget' => '', ], @@ -118,7 +118,7 @@ protected function checkEmbedWithNested(): void { 'banner_body' => [ '#type' => 'html_tag', '#tag' => 'p', - '#value' => $this->t('This is the contents of the banner body.'), + '#value' => 'This is the contents of the banner body.', ], ], ]; @@ -261,19 +261,19 @@ public function checkRenderElementAlters(): void { '#type' => 'component', '#component' => 'sdc_test:my-banner', '#props' => [ - 'heading' => $this->t('I am a banner'), - 'ctaText' => $this->t('Click me'), + 'heading' => 'I am a banner', + 'ctaText' => 'Click me', 'ctaHref' => 'https://www.example.org', 'ctaTarget' => '', ], '#propsAlter' => [ - fn ($props) => [...$props, 'heading' => $this->t('I am another banner')], + fn ($props) => [...$props, 'heading' => 'I am another banner'], ], '#slots' => [ 'banner_body' => [ '#type' => 'html_tag', '#tag' => 'p', - '#value' => $this->t('This is the contents of the banner body.'), + '#value' => 'This is the contents of the banner body.', ], ], '#slotsAlter' => [ @@ -300,8 +300,8 @@ public function checkSlots(): void { '#type' => 'component', '#component' => 'sdc_test:my-banner', '#props' => [ - 'heading' => $this->t('I am a banner'), - 'ctaText' => $this->t('Click me'), + 'heading' => 'I am a banner', + 'ctaText' => 'Click me', 'ctaHref' => 'https://www.example.org', 'ctaTarget' => '', ], @@ -322,8 +322,8 @@ public function checkInvalidSlot(): void { '#type' => 'component', '#component' => 'sdc_test:my-banner', '#props' => [ - 'heading' => $this->t('I am a banner'), - 'ctaText' => $this->t('Click me'), + 'heading' => 'I am a banner', + 'ctaText' => 'Click me', 'ctaHref' => 'https://www.example.org', 'ctaTarget' => '', ], diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php index 0088e81964f0322f0d62441f99a35d0d5eb2fcfe..6437e594ee8b1201d6b7c3b717026974f4bfcb57 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php @@ -15,7 +15,6 @@ use Drupal\Core\Field\FieldException; use Drupal\Core\Field\FieldStorageDefinitionEvents; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\entity_test\EntityTestHelper; use Drupal\entity_test\FieldStorageDefinition; @@ -33,7 +32,6 @@ class EntityDefinitionUpdateTest extends EntityKernelTestBase { use EntityDefinitionTestTrait; - use StringTranslationTrait; /** * The entity definition update manager. @@ -119,13 +117,14 @@ public function testEntityTypeUpdateWithoutData(): void { // reports that an update is needed. $this->updateEntityTypeToRevisionable(); $this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.'); + $entity_type = $this->entityTypeManager->getDefinition('entity_test_update')->getLabel(); $expected = [ 'entity_test_update' => [ - $this->t('The %entity_type entity type needs to be updated.', ['%entity_type' => $this->entityTypeManager->getDefinition('entity_test_update')->getLabel()]), + "The $entity_type entity type needs to be updated.", // The revision key is now defined, so the revision field needs to be // created. - $this->t('The %field_name field needs to be installed.', ['%field_name' => 'Revision ID']), - $this->t('The %field_name field needs to be installed.', ['%field_name' => 'Default revision']), + 'The Revision ID field needs to be installed.', + 'The Default revision field needs to be installed.', ], ]; $this->assertEquals($expected, $this->entityDefinitionUpdateManager->getChangeSummary(), 'EntityDefinitionUpdateManager reports the expected change summary.'); @@ -663,9 +662,10 @@ public function testEntityIndexCreateDeleteWithoutData(): void { // update to the entity type. $this->addEntityIndex(); $this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.'); + $entity_type = $this->entityTypeManager->getDefinition('entity_test_update')->getLabel(); $expected = [ 'entity_test_update' => [ - $this->t('The %entity_type entity type needs to be updated.', ['%entity_type' => $this->entityTypeManager->getDefinition('entity_test_update')->getLabel()]), + "The $entity_type entity type needs to be updated.", ], ]; $this->assertEquals($expected, $this->entityDefinitionUpdateManager->getChangeSummary(), 'EntityDefinitionUpdateManager reports the expected change summary.'); @@ -680,9 +680,10 @@ public function testEntityIndexCreateDeleteWithoutData(): void { // update to the entity type. $this->removeEntityIndex(); $this->assertTrue($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that updates are needed.'); + $entity_type = $this->entityTypeManager->getDefinition('entity_test_update')->getLabel(); $expected = [ 'entity_test_update' => [ - $this->t('The %entity_type entity type needs to be updated.', ['%entity_type' => $this->entityTypeManager->getDefinition('entity_test_update')->getLabel()]), + "The $entity_type entity type needs to be updated.", ], ]; $this->assertEquals($expected, $this->entityDefinitionUpdateManager->getChangeSummary(), 'EntityDefinitionUpdateManager reports the expected change summary.'); @@ -824,7 +825,7 @@ public function testSingleActionCalls(): void { $message = 'A field cannot be installed on a non-existing entity type'; try { $storage_definition = BaseFieldDefinition::create('string') - ->setLabel($this->t('A new revisionable base field')) + ->setLabel('A new revisionable base field') ->setRevisionable(TRUE); $this->entityDefinitionUpdateManager->installFieldStorageDefinition('bar', 'foo', 'entity_test', $storage_definition); $this->fail($message); @@ -841,7 +842,7 @@ public function testSingleActionCalls(): void { // Create a new base field. $this->addRevisionableBaseField(); $storage_definition = BaseFieldDefinition::create('string') - ->setLabel($this->t('A new revisionable base field')) + ->setLabel('A new revisionable base field') ->setRevisionable(TRUE); $this->assertFalse($db_schema->fieldExists('entity_test_update', 'new_base_field'), "New field 'new_base_field' does not exist before applying the update."); $this->entityDefinitionUpdateManager->installFieldStorageDefinition('new_base_field', 'entity_test_update', 'entity_test', $storage_definition); @@ -856,7 +857,7 @@ public function testSingleActionCalls(): void { $storage_definition = BaseFieldDefinition::create('text') ->setName('new_base_field') ->setTargetEntityTypeId('entity_test_update') - ->setLabel($this->t('A new revisionable base field')) + ->setLabel('A new revisionable base field') ->setRevisionable(TRUE); $this->entityDefinitionUpdateManager->updateFieldStorageDefinition($storage_definition); $this->assertFalse($db_schema->fieldExists('entity_test_update', 'new_base_field'), "Previous schema for 'new_base_field' no longer exists."); @@ -1006,7 +1007,7 @@ public function testInitialValue(): void { // Add a base field with an initial value. $this->addBaseField(); $storage_definition = BaseFieldDefinition::create('string') - ->setLabel($this->t('A new base field')) + ->setLabel('A new base field') ->setInitialValue('test value'); $this->assertFalse($db_schema->fieldExists('entity_test_update', 'new_base_field'), "New field 'new_base_field' does not exist before applying the update."); @@ -1029,7 +1030,7 @@ public function testInitialValueFromFieldErrorHandling(): void { try { $this->addBaseField(); $storage_definition = BaseFieldDefinition::create('string') - ->setLabel($this->t('A new base field')) + ->setLabel('A new base field') ->setInitialValueFromField('field_that_does_not_exist'); $this->entityDefinitionUpdateManager->installFieldStorageDefinition('new_base_field', 'entity_test_update', 'entity_test', $storage_definition); $this->fail('Using a non-existent field as initial value does not work.'); @@ -1041,7 +1042,7 @@ public function testInitialValueFromFieldErrorHandling(): void { try { $this->addBaseField(); $storage_definition = BaseFieldDefinition::create('integer') - ->setLabel($this->t('A new base field')) + ->setLabel('A new base field') ->setInitialValueFromField('name'); $this->entityDefinitionUpdateManager->installFieldStorageDefinition('new_base_field', 'entity_test_update', 'entity_test', $storage_definition); $this->fail('Using a field of a different type as initial value does not work.'); @@ -1054,7 +1055,7 @@ public function testInitialValueFromFieldErrorHandling(): void { // Add a base field that will not be stored in the shared tables. $initial_field = BaseFieldDefinition::create('string') ->setName('initial_field') - ->setLabel($this->t('An initial field')) + ->setLabel('An initial field') ->setCardinality(2); $this->state->set('entity_test_update.additional_base_field_definitions', ['initial_field' => $initial_field]); $this->entityDefinitionUpdateManager->installFieldStorageDefinition('initial_field', 'entity_test_update', 'entity_test', $initial_field); @@ -1063,7 +1064,7 @@ public function testInitialValueFromFieldErrorHandling(): void { // as the source of its initial values. $new_base_field = BaseFieldDefinition::create('string') ->setName('new_base_field') - ->setLabel($this->t('A new base field')) + ->setLabel('A new base field') ->setInitialValueFromField('initial_field'); $this->state->set('entity_test_update.additional_base_field_definitions', ['initial_field' => $initial_field, 'new_base_field' => $new_base_field]); $this->entityDefinitionUpdateManager->installFieldStorageDefinition('new_base_field', 'entity_test_update', 'entity_test', $new_base_field); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php index 31c38b4699c04f4f3925231ec8fce52162351bb7..2e6fba63ba60a9646cb70f57d66127bafe763e5a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldableEntityDefinitionUpdateTest.php @@ -7,7 +7,6 @@ use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Site\Settings; -use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait; @@ -21,7 +20,6 @@ class FieldableEntityDefinitionUpdateTest extends EntityKernelTestBase { use EntityDefinitionTestTrait; - use StringTranslationTrait; /** * The entity definition update manager. @@ -109,8 +107,8 @@ protected function setUp(): void { // updated, so add it to the entity type that is being tested in order to // provide test coverage for this special case. $fields['changed'] = BaseFieldDefinition::create('changed') - ->setLabel($this->t('Changed')) - ->setDescription($this->t('The time that the content block was last edited.')) + ->setLabel('Changed') + ->setDescription('The time that the content block was last edited.') ->setTranslatable(TRUE) ->setRevisionable(TRUE); $this->state->set('entity_test_update.additional_base_field_definitions', $fields); diff --git a/core/tests/Drupal/KernelTests/Core/Updater/UpdateRequirementsTest.php b/core/tests/Drupal/KernelTests/Core/Updater/UpdateRequirementsTest.php index 3129361f2a4817536a0c5f6dcdff9d29bc9bbf71..f2f9bd16a04eef69367e4f0b6dba411953427a30 100644 --- a/core/tests/Drupal/KernelTests/Core/Updater/UpdateRequirementsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Updater/UpdateRequirementsTest.php @@ -24,18 +24,18 @@ public function testUpdateRequirements(): void { \Drupal::service('module_installer')->install(['module_update_requirements']); $testRequirements = [ - 'title' => $this->t('UpdateError'), - 'value' => $this->t('None'), - 'description' => $this->t('Update Error.'), + 'title' => 'UpdateError', + 'value' => 'None', + 'description' => 'Update Error.', 'severity' => REQUIREMENT_ERROR, ]; $requirements = update_check_requirements()['test.update.error']; $this->assertEquals($testRequirements, $requirements); $testAlterRequirements = [ - 'title' => $this->t('UpdateWarning'), - 'value' => $this->t('None'), - 'description' => $this->t('Update Warning.'), + 'title' => 'UpdateWarning', + 'value' => 'None', + 'description' => 'Update Warning.', 'severity' => REQUIREMENT_WARNING, ]; $alterRequirements = update_check_requirements()['test.update.error.alter'];