diff --git a/core/modules/comment/src/Tests/CommentAdminTest.php b/core/modules/comment/src/Tests/CommentAdminTest.php
index 241baad7cd..7c4aae0373 100644
--- a/core/modules/comment/src/Tests/CommentAdminTest.php
+++ b/core/modules/comment/src/Tests/CommentAdminTest.php
@@ -2,7 +2,9 @@
namespace Drupal\comment\Tests;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\Html;
+use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\user\RoleInterface;
use Drupal\comment\Entity\Comment;
@@ -225,4 +227,51 @@ public function testEditComment() {
$this->assertFieldById('edit-mail', $anonymous_comment->getAuthorEmail());
}
+ /**
+ * Tests commented translation deletion admin view.
+ */
+ public function testCommentedTranslationDeletion() {
+ \Drupal::service('module_installer')->install([
+ 'language',
+ 'locale',
+ ]);
+ \Drupal::service('router.builder')->rebuildIfNeeded();
+
+ ConfigurableLanguage::createFromLangcode('ur')->save();
+ // Rebuild the container to update the default language container variable.
+ $this->rebuildContainer();
+ // Ensure that doesn't require contact info.
+ $this->setCommentAnonymous('0');
+ $this->drupalLogin($this->webUser);
+ $count_query = \Drupal::entityTypeManager()
+ ->getStorage('comment')
+ ->getQuery()
+ ->count();
+ $before_count = $count_query->execute();
+ // Post 2 anonymous comments without contact info.
+ $comment1 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+ $comment2 = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
+
+ $comment1->addTranslation('ur', ['subject' => 'ur ' . $comment1->label()])
+ ->save();
+ $comment2->addTranslation('ur', ['subject' => 'ur ' . $comment1->label()])
+ ->save();
+ $this->drupalLogout();
+ $this->drupalLogin($this->adminUser);
+ // Delete multiple comments in one operation.
+ $edit = [
+ 'operation' => 'delete',
+ "comments[{$comment1->id()}]" => 1,
+ "comments[{$comment2->id()}]" => 1,
+ ];
+ $this->drupalPostForm('admin/content/comment', $edit, t('Update'));
+ $this->assertRaw(new FormattableMarkup('@label (Original translation) - The following comment translations will be deleted:', ['@label' => $comment1->label()]));
+ $this->assertRaw(new FormattableMarkup('@label (Original translation) - The following comment translations will be deleted:', ['@label' => $comment2->label()]));
+ $this->assertText('English');
+ $this->assertText('Urdu');
+ $this->drupalPostForm(NULL, [], t('Delete'));
+ $after_count = $count_query->execute();
+ $this->assertEqual($after_count, $before_count, 'No comment or translation found.');
+ }
+
}