diff --git a/core/modules/comment/src/Tests/CommentTitleTest.php b/core/modules/comment/src/Tests/CommentTitleTest.php
index 30d3935..9d1173b 100644
--- a/core/modules/comment/src/Tests/CommentTitleTest.php
+++ b/core/modules/comment/src/Tests/CommentTitleTest.php
@@ -34,8 +34,7 @@ public function testCommentEmptyTitles() {
     $regex .= $comment->comment_body->value . '(.*?)';
     $regex .= '/s';
     $this->assertPattern($regex, 'Comment is created successfully');
-    // Tests that markup is not generated for the comment without header.
-    $this->assertNoPattern('|<h3[^>]*></h3>|', 'Comment title H3 element not found when title is an empty string.');
+    $this->assertNoText($subject_text, 'No comment title');
   }
 
   /**
diff --git a/core/modules/comment/tests/modules/comment_empty_title_test/comment_empty_title_test.module b/core/modules/comment/tests/modules/comment_empty_title_test/comment_empty_title_test.module
index 1fdbd6d..3fe1616 100644
--- a/core/modules/comment/tests/modules/comment_empty_title_test/comment_empty_title_test.module
+++ b/core/modules/comment/tests/modules/comment_empty_title_test/comment_empty_title_test.module
@@ -9,6 +9,6 @@
 /**
  * Implements hook_preprocess_comment().
  */
-function comment_empty_titles_test_preprocess_comment(&$variables) {
+function comment_empty_title_test_preprocess_comment(&$variables) {
   $variables['title'] = '';
 }
