diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index e8d91e46be61d26c909b56008e3f1fd0928233ac..60e10436874b81da8233fb4957052bfd130c99f9 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -63327,18 +63327,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Block/BlockBaseTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\Tests\\\\Core\\\\Block\\\\BlockManagerTest\\:\\:formatPlural\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Block/BlockManagerTest.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\Tests\\\\Core\\\\Block\\\\BlockManagerTest\\:\\:getNumberOfPlurals\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/Drupal/Tests/Core/Block/BlockManagerTest.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\Core\\\\Cache\\\\CacheCollectorHelper\\:\\:set\\(\\) has no return type specified\\.$#', diff --git a/core/modules/block/tests/src/Traits/BlockCreationTrait.php b/core/modules/block/tests/src/Traits/BlockCreationTrait.php index 9ed781d3339c5e33e78483031a0ab391220f2e98..69eb472760e6b8434a20f5d644c01bff6ea4c70e 100644 --- a/core/modules/block/tests/src/Traits/BlockCreationTrait.php +++ b/core/modules/block/tests/src/Traits/BlockCreationTrait.php @@ -24,7 +24,7 @@ trait BlockCreationTrait { * example: * @code * $this->drupalPlaceBlock('system_powered_by_block', [ - * 'label' => t('Hello, world!'), + * 'label' => 'Hello, world!', * ]); * @endcode * The following defaults are provided: diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php index daa09f2a9df10add43eff74c0404965e4d74e80a..8e6fd84d4b4caa32e191607382918aba95376673 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php @@ -180,12 +180,11 @@ public function testListing(): void { // Create test block for other user tests. $test_block = $this->createBlockContent($label); - $link_text = t('Add content block'); // Test as a user with view only permissions. $this->drupalLogin($this->baseUser1); $this->drupalGet('admin/content/block'); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->linkNotExists($link_text); + $this->assertSession()->linkNotExists('Add content block'); $this->assertSession()->linkByHrefNotExists('admin/content/block/' . $test_block->id()); $this->assertSession()->linkByHrefNotExists('admin/content/block/' . $test_block->id() . '/delete'); @@ -195,7 +194,7 @@ public function testListing(): void { $this->drupalLogin($this->baseUser2); $this->drupalGet('admin/content/block'); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->linkExists($link_text); + $this->assertSession()->linkExists('Add content block'); $this->assertSession()->linkByHrefExists('admin/content/block/' . $test_block->id()); $this->assertSession()->linkByHrefExists('admin/content/block/' . $test_block->id() . '/delete'); } diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php index 0d624cceb69038eb97a2794fe8a9f3ce4eb575c0..8cdd4ab96824f61d6805534a0396d05e90d48b82 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php @@ -175,12 +175,11 @@ public function testListing(): void { // Create test block for other user tests. $test_block = $this->createBlockContent($label); - $link_text = t('Add content block'); // Test as a user with view only permissions. $this->drupalLogin($this->baseUser1); $this->drupalGet('admin/content/block'); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->linkNotExists($link_text); + $this->assertSession()->linkNotExists('Add content block'); $matches = $this->xpath('//td[1]'); $actual = $matches[0]->getText(); $this->assertEquals($label, $actual, 'Label found for test block.'); @@ -194,7 +193,7 @@ public function testListing(): void { $this->drupalLogin($this->baseUser2); $this->drupalGet('admin/content/block'); $this->assertSession()->statusCodeEquals(200); - $this->assertSession()->linkExists($link_text); + $this->assertSession()->linkExists('Add content block'); $matches = $this->xpath('//td/a'); $actual = $matches[0]->getText(); $this->assertEquals($label, $actual, 'Label found for test block.'); diff --git a/core/modules/block_content/tests/src/Kernel/BlockContentTest.php b/core/modules/block_content/tests/src/Kernel/BlockContentTest.php index e155c86f0f7bd45fa88955f39d50f32eba6fd3a3..bb0186431e9aaf2fe1765d70fe8d7daf582f281d 100644 --- a/core/modules/block_content/tests/src/Kernel/BlockContentTest.php +++ b/core/modules/block_content/tests/src/Kernel/BlockContentTest.php @@ -69,7 +69,7 @@ public function testOperationLinks(): void { // The admin user does have the "administer block" permission. $this->assertEquals([ 'block-edit' => [ - 'title' => $this->t('Edit block'), + 'title' => 'Edit block', 'url' => $block_content->toUrl('edit-form')->setOptions([]), 'weight' => 50, ], diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php index d7a4f443f557226b62f44932f007e9e3bc835108..f2c94ac2c86457256b5d99a36eb1935802eafaaf 100644 --- a/core/modules/comment/tests/src/Functional/CommentTestBase.php +++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php @@ -64,7 +64,7 @@ protected function setUp(): void { // child classes may specify the standard profile. $types = NodeType::loadMultiple(); if (empty($types['article'])) { - $this->drupalCreateContentType(['type' => 'article', 'name' => t('Article')]); + $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']); } // Create two test users. diff --git a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php index 9841e5b223fd4f6eb56b98b9d44156f78c71a648..a1a4e93b13a8ae93c1593dac3591afabdcd3ad5b 100644 --- a/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php +++ b/core/modules/comment/tests/src/Functional/Views/CommentTestBase.php @@ -67,7 +67,7 @@ protected function setUp($import_test_views = TRUE, $modules = ['comment_test_vi $this->account2 = $this->drupalCreateUser(); $this->drupalLogin($this->account); - $this->drupalCreateContentType(['type' => 'page', 'name' => t('Basic page')]); + $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); $this->addDefaultCommentField('node', 'page'); $this->nodeUserPosted = $this->drupalCreateNode(); diff --git a/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php b/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php index 677839e9a616973ba39806de3849e69c810e9ba9..5836616e7c13dda245d24572c2392e1183ce6f20 100644 --- a/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php +++ b/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php @@ -219,7 +219,7 @@ protected function assertIds(array $expected_ids = []): void { public function testExposedFilterWithPager(): void { // Expose the empty and not empty operators in a grouped filter. $this->drupalGet('admin/structure/views/nojs/handler/test_filter_datetime/default/filter/' . $this->fieldName . '_value'); - $this->submitForm([], t('Expose filter')); + $this->submitForm([], 'Expose filter'); $edit = []; $edit['options[operator]'] = '>'; @@ -234,7 +234,7 @@ public function testExposedFilterWithPager(): void { $this->submitForm(['path' => $path], 'Apply'); $this->drupalGet('admin/structure/views/nojs/display/test_filter_datetime/default/pager_options'); $this->submitForm(['pager_options[items_per_page]' => 2], 'Apply'); - $this->submitForm([], t('Save')); + $this->submitForm([], 'Save'); // Assert the page without filters. $this->drupalGet($path); diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php index 09a6af7422f8b189697628e5b66a261e22b85009..70527fbd994b016f0eafe483beae4472e49c7f7b 100644 --- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php +++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php @@ -1459,10 +1459,10 @@ public function doTestFromToSetting(array $expected, string $datetime_type, stri } $this->drupalGet('entity_test/add'); - $this->submitForm($edit, t('Save')); + $this->submitForm($edit, 'Save'); preg_match('|entity_test/manage/(\d+)|', $this->getUrl(), $match); $id = $match[1]; - $this->assertSession()->pageTextContains(t('entity_test @id has been created.', ['@id' => $id])); + $this->assertSession()->pageTextContains(sprintf('entity_test %d has been created.', $id)); // Now set display options. $this->displayOptions = [ diff --git a/core/modules/field/tests/src/Kernel/FieldValidationTest.php b/core/modules/field/tests/src/Kernel/FieldValidationTest.php index 83c6f44351c267feca21ec935718eaa82b182fd2..cf1e90b216805e7c6fca21cd559b9e85fb386ff4 100644 --- a/core/modules/field/tests/src/Kernel/FieldValidationTest.php +++ b/core/modules/field/tests/src/Kernel/FieldValidationTest.php @@ -83,7 +83,7 @@ public function testFieldConstraints(): void { } else { $value = -1; - $expected_violations[$delta . '.value'][] = t('%name does not accept the value -1.', ['%name' => $this->fieldTestData->field->getLabel()]); + $expected_violations[$delta . '.value'][] = $this->fieldTestData->field->getLabel() . ' does not accept the value -1.'; } $entity->{$this->fieldTestData->field_name}[] = $value; } diff --git a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php index 42af744eb408aa9c8fb6c5aeca583208e922e42e..efa121c30fe7223379e5b4298495b44b14b03144 100644 --- a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php +++ b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php @@ -26,7 +26,7 @@ public function getFormId() { */ public function buildForm(array $form, FormStateInterface $form_state) { $form['langcode'] = [ - '#title' => t('Language select'), + '#title' => $this->t('Language select'), '#type' => 'language_select', '#default_value' => language_get_default_langcode('entity_test', 'some_bundle'), ]; diff --git a/core/modules/migrate/tests/modules/migrate_query_batch_test/src/Plugin/migrate/source/QueryBatchTest.php b/core/modules/migrate/tests/modules/migrate_query_batch_test/src/Plugin/migrate/source/QueryBatchTest.php index cc29d67a8c3606e4c38f9b66fd4837740e9f536f..94b00fa328576c91376bad7b0344eff4b3541669 100644 --- a/core/modules/migrate/tests/modules/migrate_query_batch_test/src/Plugin/migrate/source/QueryBatchTest.php +++ b/core/modules/migrate/tests/modules/migrate_query_batch_test/src/Plugin/migrate/source/QueryBatchTest.php @@ -27,8 +27,8 @@ public function query() { */ public function fields() { $fields = [ - 'id' => $this->t('Id'), - 'data' => $this->t('data'), + 'id' => 'Id', + 'data' => 'data', ]; return $fields; } diff --git a/core/modules/migrate/tests/modules/migrate_track_changes_test/src/Plugin/migrate/source/TrackChangesTest.php b/core/modules/migrate/tests/modules/migrate_track_changes_test/src/Plugin/migrate/source/TrackChangesTest.php index cb2119adbab82a547691e98e5965eaa37acbcd2e..d64010796562ff04566ee1b03714c3a99afbc110 100644 --- a/core/modules/migrate/tests/modules/migrate_track_changes_test/src/Plugin/migrate/source/TrackChangesTest.php +++ b/core/modules/migrate/tests/modules/migrate_track_changes_test/src/Plugin/migrate/source/TrackChangesTest.php @@ -34,9 +34,9 @@ public function query() { */ public function fields() { $fields = [ - 'tid' => $this->t('Term id'), - 'name' => $this->t('Name'), - 'description' => $this->t('Description'), + 'tid' => 'Term id', + 'name' => 'Name', + 'description' => 'Description', ]; return $fields; diff --git a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php index bd2db2b8a2044703985bc6b2984de4fbea55e551..3cd99e2a98f1be08d6dd71d8d88cb5e8b939e39d 100644 --- a/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php +++ b/core/modules/migrate/tests/src/Kernel/MigrateEntityContentValidationTest.php @@ -4,6 +4,7 @@ namespace Drupal\Tests\migrate\Kernel; +use Drupal\Component\Render\FormattableMarkup; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; use Drupal\filter\Entity\FilterFormat; @@ -153,7 +154,7 @@ public function test2(): void { ], ]); - $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.'); + $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.'); $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/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php index 7c5407721fa2a87c1f94c06de24f4622d49a4e4e..e51d79b2a57290079628a05b92cfe97bb55d8de0 100644 --- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php +++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php @@ -149,16 +149,16 @@ class TestDrupal6SqlBase extends DrupalSqlBase { */ public function fields() { return [ - 'filename' => $this->t('The path of the primary file for this item.'), - 'name' => $this->t('The name of the item; e.g. node.'), - 'type' => $this->t('The type of the item, either module, theme, or theme_engine.'), - 'owner' => $this->t("A theme's 'parent'. Can be either a theme or an engine."), - 'status' => $this->t('Boolean indicating whether or not this item is enabled.'), - 'throttle' => $this->t('Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.'), - 'bootstrap' => $this->t("Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted)."), - 'schema_version' => $this->t("The module's database schema version number."), - 'weight' => $this->t("The order in which this module's hooks should be invoked."), - 'info' => $this->t("A serialized array containing information from the module's .info file."), + 'filename' => 'The path of the primary file for this item.', + 'name' => 'The name of the item; e.g. node.', + 'type' => 'The type of the item, either module, theme, or theme_engine.', + 'owner' => "A theme's 'parent'. Can be either a theme or an engine.", + 'status' => 'Boolean indicating whether or not this item is enabled.', + 'throttle' => 'Boolean indicating whether this item is disabled when the throttle.module disables throttleable items.', + 'bootstrap' => "Boolean indicating whether this module is loaded during Drupal's early bootstrapping phase (e.g. even before the page cache is consulted).", + 'schema_version' => "The module's database schema version number.", + 'weight' => "The order in which this module's hooks should be invoked.", + 'info' => "A serialized array containing information from the module's .info file.", ]; } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php index bdf110bbc520c96367a669458c44273fc7f5e160..bf43a3ccf6717ac06381cb375c551ecc8e60258c 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php @@ -239,7 +239,7 @@ protected function assertReviewForm(?array $available_paths = NULL, ?array $miss */ protected function assertUpgrade(array $entity_counts) { $session = $this->assertSession(); - $session->pageTextContains(t('Congratulations, you upgraded Drupal!')); + $session->pageTextContains('Congratulations, you upgraded Drupal!'); // Assert the count of entities after the upgrade. First, reset all the // statics after migration to ensure entities are loadable. diff --git a/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php b/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php index 377134f07b6ab70819fa01c1ca9664ebd591283c..aaf1c183de3834af116be95c1d3f37c77b132194 100644 --- a/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php +++ b/core/modules/navigation/tests/src/Functional/NavigationLogoTest.php @@ -77,7 +77,7 @@ public function testSettingsLogoOptionsForm(): void { $edit = [ 'logo_provider' => 'hide', ]; - $this->submitForm($edit, t('Save configuration')); + $this->submitForm($edit, 'Save configuration'); $this->assertSession()->pageTextContains('The configuration options have been saved.'); $this->assertSession()->elementNotExists('css', 'a.admin-toolbar__logo'); diff --git a/core/modules/node/tests/src/Traits/NodeCreationTrait.php b/core/modules/node/tests/src/Traits/NodeCreationTrait.php index 9a7fbc50baf9c0dc0df47fbaf27e2dac4c6979ce..74898811a7d3e1a5e4341cf687125eb85f8ba3ff 100644 --- a/core/modules/node/tests/src/Traits/NodeCreationTrait.php +++ b/core/modules/node/tests/src/Traits/NodeCreationTrait.php @@ -49,7 +49,7 @@ public function getNodeByTitle($title, $reset = FALSE) { * * @code * $this->drupalCreateNode([ - * 'title' => t('Hello, world!'), + * 'title' => 'Hello, world!', * 'type' => 'article', * ]); * @endcode diff --git a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php index b8689525fa52f1b1c7db5cdd405c484cba3ce39b..c3b38e0ad943b445b9f391d477342b93ad2d35fa 100644 --- a/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php +++ b/core/modules/options/tests/src/Functional/OptionsWidgetsTest.php @@ -409,7 +409,7 @@ public function testSelectListRequiredErrorAttribute(): void { // Submit form: select invalid 'none' option. $edit = ['card_1' => '_none']; $this->submitForm($edit, 'Save'); - $this->assertSession()->responseContains(t('This is custom message for required field.')); + $this->assertSession()->responseContains('This is custom message for required field.'); } /** diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php b/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php index 702aa20e3bab443d5c17ce782f86b3227dbeb12b..bd26b00231a7dc5a7982a2e42ccf34fcd3a8b1d3 100644 --- a/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php +++ b/core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php @@ -61,7 +61,7 @@ protected function setUp(): void { // Populate the default shortcut set. $shortcut = Shortcut::create([ 'shortcut_set' => 'default', - 'title' => t('Add content'), + 'title' => 'Add content', 'weight' => -20, 'link' => [ 'uri' => 'internal:/node/add', @@ -71,7 +71,7 @@ protected function setUp(): void { $shortcut = Shortcut::create([ 'shortcut_set' => 'default', - 'title' => t('All content'), + 'title' => 'All content', 'weight' => -19, 'link' => [ 'uri' => 'internal:/admin/content', diff --git a/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php b/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php index a300066cc48c86db22ad8e08732707f588a71cee..decfaaaa6ef0e5e7e50fcda6c4ff1517a646012b 100644 --- a/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php +++ b/core/modules/system/tests/src/Kernel/Form/ProgrammaticTest.php @@ -73,7 +73,7 @@ protected function doSubmitForm($values, $valid_input): void { $errors = $form_state->getErrors(); $valid_form = empty($errors); $input_values = print_r($values, TRUE); - $validation_errors = $valid_form ? t('None') : implode(' ', $errors); + $validation_errors = $valid_form ? 'None' : implode(' ', $errors); $this->assertSame($valid_form, $valid_input, sprintf('Input values: %s<br />Validation handler errors: %s', $input_values, $validation_errors)); // We check submitted values only if we have a valid input. diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php index 52317766abc3bddb9500a5ef64d53178f72b61c0..d33713705835f0887fc859a09dabec8afa1ef5da 100644 --- a/core/modules/user/tests/src/Functional/UserCancelTest.php +++ b/core/modules/user/tests/src/Functional/UserCancelTest.php @@ -733,7 +733,7 @@ public function testUserAnonymizeTranslations(): void { $this->assertEquals($anonymous_user->getDisplayName(), $comment_translation->getAuthorName()); // Confirm that the confirmation message made it through to the end user. - $this->assertSession()->responseContains(t('%name has been deleted.', ['%name' => $account->getAccountName()])); + $this->assertSession()->pageTextContains($account->getAccountName() . ' has been deleted.'); } } diff --git a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php b/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php index b65f135d93d5f3a83e3827f4bde67b89d267d633..5a043c04ba92218b338b4f8e66c9f9e5c05faaa0 100644 --- a/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php +++ b/core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php @@ -89,19 +89,19 @@ protected function setUp(): void { // Base fields for the test entity types. $this->commonBaseFields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of the test entity.')) + ->setLabel('Name') + ->setDescription('The name of the test entity.') ->setTranslatable(TRUE) ->setSetting('max_length', 32); $this->commonBaseFields['created'] = BaseFieldDefinition::create('created') - ->setLabel(t('Authored on')) - ->setDescription(t('Time the entity was created')) + ->setLabel('Authored on') + ->setDescription('Time the entity was created') ->setTranslatable(TRUE); $this->commonBaseFields['user_id'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('User ID')) - ->setDescription(t('The ID of the associated user.')) + ->setLabel('User ID') + ->setDescription('The ID of the associated user.') ->setSetting('target_type', 'user') ->setSetting('handler', 'default') // Default EntityTest entities to have the root user as the owner, to @@ -539,16 +539,16 @@ public function testRevisionTableFields(): void { $base_field_definitions['user_id']->setRevisionable(TRUE); $base_field_definitions['non_rev_field'] = BaseFieldDefinition::create('string') - ->setLabel(t('Non Revisionable Field')) - ->setDescription(t('A non-revisionable test field.')) + ->setLabel('Non Revisionable Field') + ->setDescription('A non-revisionable tes field.') ->setRevisionable(FALSE) ->setTranslatable(TRUE) ->setCardinality(1) ->setReadOnly(TRUE); $base_field_definitions['non_mul_field'] = BaseFieldDefinition::create('string') - ->setLabel(t('Non translatable')) - ->setDescription(t('A non-translatable string field')) + ->setLabel('Non translatable') + ->setDescription('A non-translatable string field') ->setRevisionable(TRUE); $this->setUpEntityType($entity_type, $base_field_definitions); diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php index e0e57ab3f2c68bd163be7f2c152c27061edbaf6f..8df18f1b4291e0d35c9b9117b9aae832f72a77e2 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DatelistElementFormTest.php @@ -83,7 +83,7 @@ public function buildForm(array $form, FormStateInterface $form_state, string $d $form['submit'] = [ '#type' => 'submit', - '#value' => t('Submit'), + '#value' => 'Submit', ]; return $form; diff --git a/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php index 05f101f47cb904193627f0022d3518c7acd2dda5..36a559cd870af5984135ba288ea0f2e06fed05cc 100644 --- a/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Datetime/DatetimeElementFormTest.php @@ -108,7 +108,7 @@ public function buildForm(array $form, FormStateInterface $form_state, string $d $form['submit'] = [ '#type' => 'submit', - '#value' => t('Submit'), + '#value' => 'Submit', ]; return $form; diff --git a/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php index 82a48a5937f6609af2067f53fc8cf547df5227d6..5cd6ac21935b8bc01c5ad2798d6a7c50d49c66ed 100644 --- a/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php +++ b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php @@ -114,7 +114,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { $form['submit'] = [ '#type' => 'submit', - '#value' => t('Submit'), + '#value' => 'Submit', ]; return $form; diff --git a/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php b/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php index fc3338dac815e4d70f87e3a56ad42fdd04d08a02..cd5ad4d6e1e77b04dfb19f55df2596e895ad672a 100644 --- a/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php +++ b/core/tests/Drupal/KernelTests/Core/Field/MapBaseFieldTest.php @@ -47,7 +47,7 @@ protected function setUp(): void { */ public function testUninstallMapItemBaseField(): void { $definitions['data_map'] = BaseFieldDefinition::create('map') - ->setLabel(t('Data')) + ->setLabel('Data') ->setRequired(TRUE); $this->state->set('entity_test_update.additional_base_field_definitions', $definitions); diff --git a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php index 793bbd66bd85ba05f1fb5c885a86cdb3030697e5..46220d45d46dc2de88863365a3338bff62b3bc48 100644 --- a/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php +++ b/core/tests/Drupal/KernelTests/Core/Image/ToolkitGdTest.php @@ -515,11 +515,9 @@ public function testMissingOperation(): void { public function testGetRequirements(): void { $this->assertEquals([ 'version' => [ - 'title' => t('GD library'), + 'title' => 'GD library', 'value' => gd_info()['GD Version'], - 'description' => t("Supported image file formats: %formats.", [ - '%formats' => implode(', ', ['GIF', 'JPEG', 'PNG', 'WEBP']), - ]), + 'description' => sprintf("Supported image file formats: %s.", implode(', ', ['GIF', 'JPEG', 'PNG', 'WEBP'])), ], ], $this->imageFactory->get()->getToolkit()->getRequirements()); } diff --git a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php index 8aa190f880567dde0e64fd188a4a5631fa2baf96..87d901ba80c87d8a97050fc875d6ef9351e226c7 100644 --- a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php @@ -13,7 +13,6 @@ use Drupal\Tests\UnitTestCase; use Psr\Log\LoggerInterface; use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\StringTranslation\StringTranslationTrait; /** * @coversDefaultClass \Drupal\Core\Block\BlockManager @@ -22,8 +21,6 @@ */ class BlockManagerTest extends UnitTestCase { - use StringTranslationTrait; - /** * The block manager under test. * @@ -61,22 +58,22 @@ protected function setUp(): void { // that are purposefully not in alphabetical order. $discovery->getDefinitions()->willReturn([ 'broken' => [ - 'admin_label' => $this->t('Broken/Missing'), - 'category' => $this->t('Block'), + 'admin_label' => 'Broken/Missing', + 'category' => 'Block', 'class' => Broken::class, 'provider' => 'core', ], 'block1' => [ - 'admin_label' => $this->t('Coconut'), - 'category' => $this->t('Group 2'), + 'admin_label' => 'Coconut', + 'category' => 'Group 2', ], 'block2' => [ - 'admin_label' => $this->t('Apple'), - 'category' => $this->t('Group 1'), + 'admin_label' => 'Apple', + 'category' => 'Group 1', ], 'block3' => [ - 'admin_label' => $this->t('Banana'), - 'category' => $this->t('Group 2'), + 'admin_label' => 'Banana', + 'category' => 'Group 2', ], ]); // Force the discovery object onto the block manager.