diff -u b/core/modules/comment/src/Tests/CommentFieldsTest.php b/core/modules/comment/src/Tests/CommentFieldsTest.php --- b/core/modules/comment/src/Tests/CommentFieldsTest.php +++ b/core/modules/comment/src/Tests/CommentFieldsTest.php @@ -8,6 +8,7 @@ namespace Drupal\comment\Tests; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; +use Drupal\Core\Url; use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; use Drupal\comment\Entity\CommentType; @@ -115,7 +116,8 @@ $links = \Drupal::service('comment.link_builder')->buildCommentedEntityLinks($node, $context); $link_info = $links['comment__comment2']['#attached']['drupalSettings']['comment']['newCommentsLinks']['node']['comment2']['2']; $this->assertIdentical($link_info['new_comment_count'], 1); - $this->assertIdentical($link_info['first_new_comment_link'], '/node/2#new'); + $url = Url::fromUri('internal:/node/2', ['fragment' => 'new'])->toString(); + $this->assertIdentical($link_info['first_new_comment_link'], $url); } /**