X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FFunctional%2FCommentRssTest.php;fp=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FFunctional%2FCommentRssTest.php;h=60708bd4a8b1112506bdfa3755f9ce9db4c2473e;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/comment/tests/src/Functional/CommentRssTest.php b/web/core/modules/comment/tests/src/Functional/CommentRssTest.php new file mode 100644 index 000000000..60708bd4a --- /dev/null +++ b/web/core/modules/comment/tests/src/Functional/CommentRssTest.php @@ -0,0 +1,79 @@ + TRUE, + 'targetEntityType' => 'node', + 'bundle' => 'article', + 'mode' => 'rss', + 'content' => ['links' => ['weight' => 100]], + ])->save(); + } + + /** + * Tests comments as part of an RSS feed. + */ + public function testCommentRss() { + // Find comment in RSS feed. + $this->drupalLogin($this->webUser); + $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName()); + $this->drupalGet('rss.xml'); + + $cache_contexts = [ + 'languages:language_interface', + 'theme', + 'url.site', + 'user.node_grants:view', + 'user.permissions', + 'timezone', + ]; + $this->assertCacheContexts($cache_contexts); + + $cache_context_tags = \Drupal::service('cache_contexts_manager')->convertTokensToKeys($cache_contexts)->getCacheTags(); + $this->assertCacheTags(Cache::mergeTags($cache_context_tags, [ + 'config:views.view.frontpage', + 'node:1', 'node_list', + 'node_view', + 'user:3', + ])); + + $raw = '' . $this->node->url('canonical', ['fragment' => 'comments', 'absolute' => TRUE]) . ''; + $this->assertRaw($raw, 'Comments as part of RSS feed.'); + + // Hide comments from RSS feed and check presence. + $this->node->set('comment', CommentItemInterface::HIDDEN); + $this->node->save(); + $this->drupalGet('rss.xml'); + $this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.'); + } + +}