Commit c4d78579 authored by catch's avatar catch
Browse files

Issue #3226008 by longwave, mondrake: Remove simple uses of t() in assertEquals() calls

parent 18ab5c0a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public function testValidation() {
    $violations = $comment->validate();
    $this->assertCount(1, $violations, 'Violation found when email is invalid');
    $this->assertEquals('mail.0.value', $violations[0]->getPropertyPath());
    $this->assertEquals(t('This value is not a valid email address.'), $violations[0]->getMessage());
    $this->assertEquals('This value is not a valid email address.', $violations[0]->getMessage());

    $comment->set('mail', NULL);
    $comment->set('homepage', 'http://example.com/' . $this->randomMachineName(237));
@@ -122,7 +122,7 @@ public function testValidation() {

    // @todo This message should be improved in
    //   https://www.drupal.org/node/2012690.
    $this->assertEquals(t('This value should be of the correct primitive type.'), $violations[0]->getMessage());
    $this->assertEquals('This value should be of the correct primitive type.', $violations[0]->getMessage());

    $comment->set('homepage', NULL);
    $comment->set('hostname', $this->randomString(129));
@@ -152,7 +152,7 @@ public function testValidation() {
    $violations = $comment->validate();
    $this->assertCount(1, $violations, 'Violation found when name is required, but empty and UID is anonymous.');
    $this->assertEquals('name', $violations[0]->getPropertyPath());
    $this->assertEquals(t('You have to specify a valid author.'), $violations[0]->getMessage());
    $this->assertEquals('You have to specify a valid author.', $violations[0]->getMessage());

    // Test creating a default comment with a given user id works.
    $comment = $this->entityTypeManager->getStorage('comment')->create([
@@ -177,7 +177,7 @@ public function testValidation() {
    $violations = $comment->validate();
    $this->assertCount(1, $violations, 'Violation found when author name and comment author do not match.');
    $this->assertEquals('name', $violations[0]->getPropertyPath());
    $this->assertEquals(t('The specified author name does not match the comment author.'), $violations[0]->getMessage());
    $this->assertEquals('The specified author name does not match the comment author.', $violations[0]->getMessage());
  }

  /**
+2 −2
Original line number Diff line number Diff line
@@ -398,7 +398,7 @@ public function testSiteWideContact() {
    // Message is now by default displayed twice, once for the form element and
    // once for the viewed message.
    $page_text = $this->getSession()->getPage()->getText();
    $this->assertGreaterThan(1, substr_count($page_text, t('Message')));
    $this->assertGreaterThan(1, substr_count($page_text, 'Message'));
    $this->assertSession()->responseContains('class="field field--name-message field--type-string-long field--label-above');
    $this->assertSession()->pageTextContains($edit['message[0][value]']);

@@ -413,7 +413,7 @@ public function testSiteWideContact() {
    $this->submitForm($edit, 'Preview');
    // Message should only be displayed once now.
    $page_text = $this->getSession()->getPage()->getText();
    $this->assertEquals(1, substr_count($page_text, t('Message')));
    $this->assertEquals(1, substr_count($page_text, 'Message'));
    $this->assertSession()->responseContains('class="field field--name-message field--type-string-long field--label-hidden field__item">');
    $this->assertSession()->pageTextContains($edit['message[0][value]']);

+2 −4
Original line number Diff line number Diff line
@@ -41,8 +41,7 @@ public function testEnable() {

    // No pending updates should be available.
    $this->drupalGet('admin/reports/status');
    $requirement_value = $this->cssSelect("details.system-status-report__entry summary:contains('Entity/field definitions') + div");
    $this->assertEquals(t('Up to date'), trim($requirement_value[0]->getText()));
    $this->assertSession()->elementTextEquals('css', "details.system-status-report__entry summary:contains('Entity/field definitions') + div", 'Up to date');

    $this->drupalGet('admin/config/regional/content-language');
    // The node entity type should not be an option because it has no bundles.
@@ -59,8 +58,7 @@ public function testEnable() {

    // No pending updates should be available.
    $this->drupalGet('admin/reports/status');
    $requirement_value = $this->cssSelect("details.system-status-report__entry summary:contains('Entity/field definitions') + div");
    $this->assertEquals(t('Up to date'), trim($requirement_value[0]->getText()));
    $this->assertSession()->elementTextEquals('css', "details.system-status-report__entry summary:contains('Entity/field definitions') + div", 'Up to date');

    // Create a node type and check the content translation settings are now
    // available for nodes.
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ public function testFileCreateUrl() {
      $this->checkUrl('public', '', $basename, $base_path . '/' . $public_directory_path . '/' . $basename_encoded);
      $this->checkUrl('private', '', $basename, $base_path . '/' . $script_path . 'system/files/' . $basename_encoded);
    }
    $this->assertEquals('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', file_create_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), t('Generated URL matches expected URL.'));
    $this->assertEquals('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', file_create_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='));
  }

  /**
+11 −11
Original line number Diff line number Diff line
@@ -95,13 +95,13 @@ public function assertFileHookCalled($hook, $expected_count = 1, $message = NULL
   *   File object to compare.
   */
  public function assertFileUnchanged(FileInterface $before, FileInterface $after) {
    $this->assertEquals($before->id(), $after->id(), t('File id is the same: %file1 == %file2.', ['%file1' => $before->id(), '%file2' => $after->id()]), 'File unchanged');
    $this->assertEquals($before->getOwner()->id(), $after->getOwner()->id(), t('File owner is the same: %file1 == %file2.', ['%file1' => $before->getOwner()->id(), '%file2' => $after->getOwner()->id()]), 'File unchanged');
    $this->assertEquals($before->getFilename(), $after->getFilename(), t('File name is the same: %file1 == %file2.', ['%file1' => $before->getFilename(), '%file2' => $after->getFilename()]), 'File unchanged');
    $this->assertEquals($before->getFileUri(), $after->getFileUri(), t('File path is the same: %file1 == %file2.', ['%file1' => $before->getFileUri(), '%file2' => $after->getFileUri()]), 'File unchanged');
    $this->assertEquals($before->getMimeType(), $after->getMimeType(), t('File MIME type is the same: %file1 == %file2.', ['%file1' => $before->getMimeType(), '%file2' => $after->getMimeType()]), 'File unchanged');
    $this->assertEquals($before->getSize(), $after->getSize(), t('File size is the same: %file1 == %file2.', ['%file1' => $before->getSize(), '%file2' => $after->getSize()]), 'File unchanged');
    $this->assertEquals($before->isPermanent(), $after->isPermanent(), t('File status is the same: %file1 == %file2.', ['%file1' => $before->isPermanent(), '%file2' => $after->isPermanent()]), 'File unchanged');
    $this->assertEquals($before->id(), $after->id());
    $this->assertEquals($before->getOwner()->id(), $after->getOwner()->id());
    $this->assertEquals($before->getFilename(), $after->getFilename());
    $this->assertEquals($before->getFileUri(), $after->getFileUri());
    $this->assertEquals($before->getMimeType(), $after->getMimeType());
    $this->assertEquals($before->getSize(), $after->getSize());
    $this->assertEquals($before->isPermanent(), $after->isPermanent());
  }

  /**
@@ -113,8 +113,8 @@ public function assertFileUnchanged(FileInterface $before, FileInterface $after)
   *   File object to compare.
   */
  public function assertDifferentFile(FileInterface $file1, FileInterface $file2) {
    $this->assertNotEquals($file1->id(), $file2->id(), t('Files have different ids: %file1 != %file2.', ['%file1' => $file1->id(), '%file2' => $file2->id()]));
    $this->assertNotEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have different paths: %file1 != %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]));
    $this->assertNotEquals($file1->id(), $file2->id());
    $this->assertNotEquals($file1->getFileUri(), $file2->getFileUri());
  }

  /**
@@ -126,8 +126,8 @@ public function assertDifferentFile(FileInterface $file1, FileInterface $file2)
   *   File object to compare.
   */
  public function assertSameFile(FileInterface $file1, FileInterface $file2) {
    $this->assertEquals($file1->id(), $file2->id(), t('Files have the same ids: %file1 == %file2.', ['%file1' => $file1->id(), '%file2-fid' => $file2->id()]), 'Same file');
    $this->assertEquals($file1->getFileUri(), $file2->getFileUri(), t('Files have the same path: %file1 == %file2.', ['%file1' => $file1->getFileUri(), '%file2' => $file2->getFileUri()]), 'Same file');
    $this->assertEquals($file1->id(), $file2->id());
    $this->assertEquals($file1->getFileUri(), $file2->getFileUri());
  }

  /**
Loading