Mercurial > hg > isophonics-drupal-site
diff core/modules/comment/tests/src/Functional/CommentTokenReplaceTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 7a779792577d |
children |
line wrap: on
line diff
--- a/core/modules/comment/tests/src/Functional/CommentTokenReplaceTest.php Thu Feb 28 13:21:36 2019 +0000 +++ b/core/modules/comment/tests/src/Functional/CommentTokenReplaceTest.php Thu May 09 15:33:08 2019 +0100 @@ -51,6 +51,12 @@ // Set comment variables. $this->setCommentSubject(TRUE); + // To test hostname token field should be populated. + \Drupal::configFactory() + ->getEditable('comment.settings') + ->set('log_ip_addresses', TRUE) + ->save(TRUE); + // Create a node and a comment. $node = $this->drupalCreateNode(['type' => 'article', 'title' => '<script>alert("123")</script>']); $parent_comment = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE); @@ -74,8 +80,8 @@ $tests['[comment:title]'] = Html::escape($comment->getSubject()); $tests['[comment:body]'] = $comment->comment_body->processed; $tests['[comment:langcode]'] = $comment->language()->getId(); - $tests['[comment:url]'] = $comment->url('canonical', $url_options + ['fragment' => 'comment-' . $comment->id()]); - $tests['[comment:edit-url]'] = $comment->url('edit-form', $url_options); + $tests['[comment:url]'] = $comment->toUrl('canonical', $url_options + ['fragment' => 'comment-' . $comment->id()])->toString(); + $tests['[comment:edit-url]'] = $comment->toUrl('edit-form', $url_options)->toString(); $tests['[comment:created]'] = \Drupal::service('date.formatter')->format($comment->getCreatedTime(), 'medium', ['langcode' => $language_interface->getId()]); $tests['[comment:created:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($comment->getCreatedTime(), ['langcode' => $language_interface->getId()]); $tests['[comment:changed:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($comment->getChangedTimeAcrossTranslations(), ['langcode' => $language_interface->getId()]);