public function SitemapTaxonomyTermsRssTest::testIncludeRssLinks in Sitemap 8.2
Same name and namespace in other branches
- 8 src/Tests/SitemapTaxonomyTermsRssTest.php \Drupal\sitemap\Tests\SitemapTaxonomyTermsRssTest::testIncludeRssLinks()
- 2.0.x src/Tests/SitemapTaxonomyTermsRssTest.php \Drupal\sitemap\Tests\SitemapTaxonomyTermsRssTest::testIncludeRssLinks()
Tests included RSS links.
File
- src/
Tests/ SitemapTaxonomyTermsRssTest.php, line 27
Class
- SitemapTaxonomyTermsRssTest
- Tests the display of RSS links based on sitemap settings.
Namespace
Drupal\sitemap\TestsCode
public function testIncludeRssLinks() {
// The vocabulary is already configured to display in parent ::setUp().
$vocab = $this->vocabulary;
$vid = $vocab
->id();
// Create terms.
$this->terms = $this
->createTerms($vocab);
// Assert that RSS links for terms are not included in the sitemap.
$this
->drupalGet('/sitemap');
foreach ($this->terms as $term) {
$this
->assertSession()
->linkByHrefNotExists('/taxonomy/term/' . $term
->id() . '/feed');
}
// Include an RSS link for all terms.
$this
->saveSitemapForm([
"plugins[vocabulary:{$vid}][settings][enable_rss]" => TRUE,
]);
// Assert that RSS links are included in the sitemap.
$this
->drupalGet('/sitemap');
foreach ($this->terms as $term) {
$this
->assertSession()
->linkByHrefExists('/taxonomy/term/' . $term
->id() . '/feed');
}
// Change RSS feed depth to 0.
$this
->saveSitemapForm([
"plugins[vocabulary:{$vid}][settings][rss_depth]" => 0,
]);
// Assert that RSS links are not included in the sitemap.
$this
->drupalGet('sitemap');
foreach ($this->terms as $term) {
$this
->assertSession()
->linkByHrefNotExists('/taxonomy/term/' . $term
->id() . '/feed');
}
}