Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/comment/tests/src/Functional/CommentTokenReplaceTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
49 $this->drupalLogin($this->adminUser); | 49 $this->drupalLogin($this->adminUser); |
50 | 50 |
51 // Set comment variables. | 51 // Set comment variables. |
52 $this->setCommentSubject(TRUE); | 52 $this->setCommentSubject(TRUE); |
53 | 53 |
54 // To test hostname token field should be populated. | |
55 \Drupal::configFactory() | |
56 ->getEditable('comment.settings') | |
57 ->set('log_ip_addresses', TRUE) | |
58 ->save(TRUE); | |
59 | |
54 // Create a node and a comment. | 60 // Create a node and a comment. |
55 $node = $this->drupalCreateNode(['type' => 'article', 'title' => '<script>alert("123")</script>']); | 61 $node = $this->drupalCreateNode(['type' => 'article', 'title' => '<script>alert("123")</script>']); |
56 $parent_comment = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE); | 62 $parent_comment = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName(), TRUE); |
57 | 63 |
58 // Post a reply to the comment. | 64 // Post a reply to the comment. |
72 $tests['[comment:mail]'] = $this->adminUser->getEmail(); | 78 $tests['[comment:mail]'] = $this->adminUser->getEmail(); |
73 $tests['[comment:homepage]'] = UrlHelper::filterBadProtocol($comment->getHomepage()); | 79 $tests['[comment:homepage]'] = UrlHelper::filterBadProtocol($comment->getHomepage()); |
74 $tests['[comment:title]'] = Html::escape($comment->getSubject()); | 80 $tests['[comment:title]'] = Html::escape($comment->getSubject()); |
75 $tests['[comment:body]'] = $comment->comment_body->processed; | 81 $tests['[comment:body]'] = $comment->comment_body->processed; |
76 $tests['[comment:langcode]'] = $comment->language()->getId(); | 82 $tests['[comment:langcode]'] = $comment->language()->getId(); |
77 $tests['[comment:url]'] = $comment->url('canonical', $url_options + ['fragment' => 'comment-' . $comment->id()]); | 83 $tests['[comment:url]'] = $comment->toUrl('canonical', $url_options + ['fragment' => 'comment-' . $comment->id()])->toString(); |
78 $tests['[comment:edit-url]'] = $comment->url('edit-form', $url_options); | 84 $tests['[comment:edit-url]'] = $comment->toUrl('edit-form', $url_options)->toString(); |
79 $tests['[comment:created]'] = \Drupal::service('date.formatter')->format($comment->getCreatedTime(), 'medium', ['langcode' => $language_interface->getId()]); | 85 $tests['[comment:created]'] = \Drupal::service('date.formatter')->format($comment->getCreatedTime(), 'medium', ['langcode' => $language_interface->getId()]); |
80 $tests['[comment:created:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($comment->getCreatedTime(), ['langcode' => $language_interface->getId()]); | 86 $tests['[comment:created:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($comment->getCreatedTime(), ['langcode' => $language_interface->getId()]); |
81 $tests['[comment:changed:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($comment->getChangedTimeAcrossTranslations(), ['langcode' => $language_interface->getId()]); | 87 $tests['[comment:changed:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($comment->getChangedTimeAcrossTranslations(), ['langcode' => $language_interface->getId()]); |
82 $tests['[comment:parent:cid]'] = $comment->hasParentComment() ? $comment->getParentComment()->id() : NULL; | 88 $tests['[comment:parent:cid]'] = $comment->hasParentComment() ? $comment->getParentComment()->id() : NULL; |
83 $tests['[comment:parent:title]'] = $parent_comment->getSubject(); | 89 $tests['[comment:parent:title]'] = $parent_comment->getSubject(); |