Verified Commit e4df448e authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3133726 by quietone, manuel garcia, longwave, chaitanyadessai,...

Issue #3133726 by quietone, manuel garcia, longwave, chaitanyadessai, adeshsharma, hardik_patel_12, paulocs, xjm, mohrerao, mrinalini9, mile23, lokapujya, dawehner, duaelfr, geertvd, joelpittet: [meta] Remove usage of t() in tests not testing translation
parent 46a843d6
Loading
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -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();
+5 −5
Original line number Diff line number Diff line
@@ -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'],
    ];

+3 −3
Original line number Diff line number Diff line
@@ -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;
+0 −5
Original line number Diff line number Diff line
@@ -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.');
+3 −3
Original line number Diff line number Diff line
@@ -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');
Loading