Chris@0: TRUE, Chris@0: 'targetEntityType' => 'node', Chris@0: 'bundle' => 'article', Chris@0: 'mode' => 'rss', Chris@0: 'content' => ['links' => ['weight' => 100]], Chris@0: ])->save(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests comments as part of an RSS feed. Chris@0: */ Chris@0: public function testCommentRss() { Chris@0: // Find comment in RSS feed. Chris@0: $this->drupalLogin($this->webUser); Chris@0: $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName()); Chris@0: $this->drupalGet('rss.xml'); Chris@0: Chris@0: $cache_contexts = [ Chris@0: 'languages:language_interface', Chris@0: 'theme', Chris@0: 'url.site', Chris@0: 'user.node_grants:view', Chris@0: 'user.permissions', Chris@0: 'timezone', Chris@0: ]; Chris@0: $this->assertCacheContexts($cache_contexts); Chris@0: Chris@0: $cache_context_tags = \Drupal::service('cache_contexts_manager')->convertTokensToKeys($cache_contexts)->getCacheTags(); Chris@0: $this->assertCacheTags(Cache::mergeTags($cache_context_tags, [ Chris@0: 'config:views.view.frontpage', Chris@0: 'node:1', 'node_list', Chris@0: 'node_view', Chris@0: 'user:3', Chris@0: ])); Chris@0: Chris@18: $raw = '' . $this->node->toUrl('canonical', ['fragment' => 'comments', 'absolute' => TRUE])->toString() . ''; Chris@0: $this->assertRaw($raw, 'Comments as part of RSS feed.'); Chris@0: Chris@0: // Hide comments from RSS feed and check presence. Chris@0: $this->node->set('comment', CommentItemInterface::HIDDEN); Chris@0: $this->node->save(); Chris@0: $this->drupalGet('rss.xml'); Chris@0: $this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.'); Chris@0: } Chris@0: Chris@0: }