Verified Commit dca79fb0 authored by Dave Long's avatar Dave Long
Browse files

Issue #3337295 by Akhil Babu, zniki.ru, rksyravi, quietone, harshitthakore,...

Issue #3337295 by Akhil Babu, zniki.ru, rksyravi, quietone, harshitthakore, Indrapatil, smustgrave, longwave, poker10: Remove remaining uses of t() in assertEquals() calls

(cherry picked from commit d9f34709)
parent 8d2f88bf
Loading
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -271,10 +271,7 @@ public function testValidationOfCommentOfUnpublishedNode() {
    $violations = $node2->validate();
    $this->assertCount(1, $violations);
    $this->assertEquals('entity_reference_comment.0.target_id', $violations[0]->getPropertyPath());
    $this->assertEquals(t('This entity (%type: %name) cannot be referenced.', [
      '%type' => $comment1->getEntityTypeId(),
      '%name' => $comment1->id(),
    ]), $violations[0]->getMessage());
    $this->assertEquals(sprintf('This entity (%s: %s) cannot be referenced.', $comment1->getEntityTypeId(), $comment1->id()), $violations[0]->getMessage());

    $this->drupalSetCurrentUser($comment_admin_user);
    $this->assertEquals(\Drupal::currentUser()->id(), $comment_admin_user->id());
+1 −1
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ public function testSiteWideContact() {
    $this->submitForm($edit, 'Send message');
    $mails = $this->getMails();
    $mail = array_pop($mails);
    $this->assertEquals(t('[@label] @subject', ['@label' => $label, '@subject' => $edit['subject[0][value]']]), $mail['subject']);
    $this->assertEquals(sprintf('[%s] %s', $label, $edit['subject[0][value]']), $mail['subject']);
    $this->assertStringContainsString($field_label, $mail['body']);
    $this->assertStringContainsString($edit[$field_name . '[0][value]'], $mail['body']);

+3 −3
Original line number Diff line number Diff line
@@ -183,10 +183,10 @@ protected function doFieldPropertyConstraintsTests() {
    $this->assertCount(2, $violations, 'Two violations found when using a null and outside the range value.');

    $this->assertEquals($field_name . '.0.value', $violations[0]->getPropertyPath());
    $this->assertEquals(t('%name does not accept the value @value.', ['%name' => $field_name, '@value' => -2]), $violations[0]->getMessage());
    $this->assertEquals(sprintf('%s does not accept the value -2.', $field_name), $violations[0]->getMessage());

    $this->assertEquals($field_name . '.0.value', $violations[1]->getPropertyPath());
    $this->assertEquals(t('This value should be between %min and %max.', ['%min' => 0, '%max' => 32]), $violations[1]->getMessage());
    $this->assertEquals('This value should be between 0 and 32.', $violations[1]->getMessage());

    // Check that a value that is not specifically restricted but outside the
    // range triggers the expected violation.
@@ -194,7 +194,7 @@ protected function doFieldPropertyConstraintsTests() {
    $violations = $entity->validate();
    $this->assertCount(1, $violations, 'Violations found when using value outside the range.');
    $this->assertEquals($field_name . '.0.value', $violations[0]->getPropertyPath());
    $this->assertEquals(t('This value should be between %min and %max.', ['%min' => 0, '%max' => 32]), $violations[0]->getMessage());
    $this->assertEquals('This value should be between 0 and 32.', $violations[0]->getMessage());
  }

  /**
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public function testCardinalityConstraint() {
    // Check that the expected constraint violations are reported.
    $this->assertCount(1, $violations);
    $this->assertEquals('', $violations[0]->getPropertyPath());
    $this->assertEquals(t('%name: this field cannot hold more than @count values.', ['%name' => $this->fieldTestData->field->getLabel(), '@count' => $cardinality]), $violations[0]->getMessage());
    $this->assertEquals(sprintf('%s: this field cannot hold more than %s values.', $this->fieldTestData->field->getLabel(), $cardinality), $violations[0]->getMessage());
  }

  /**
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ public function testFileSave() {
    file_put_contents($uppercase_file_duplicate->getFileUri(), 'hello world');
    $violations = $uppercase_file_duplicate->validate();
    $this->assertCount(1, $violations);
    $this->assertEquals(t('The file %value already exists. Enter a unique file URI.', ['%value' => $uppercase_file_duplicate->getFileUri()]), $violations[0]->getMessage());
    $this->assertEquals(sprintf('The file %s already exists. Enter a unique file URI.', $uppercase_file_duplicate->getFileUri()), $violations[0]->getMessage());
    // Ensure that file URI entity queries are case sensitive.
    $fids = \Drupal::entityQuery('file')
      ->accessCheck(FALSE)
Loading