You are here

public function SitemapTaxonomyTermsRssTest::testIncludeRssLinks in Sitemap 8

Same name and namespace in other branches
  1. 8.2 src/Tests/SitemapTaxonomyTermsRssTest.php \Drupal\sitemap\Tests\SitemapTaxonomyTermsRssTest::testIncludeRssLinks()
  2. 2.0.x src/Tests/SitemapTaxonomyTermsRssTest.php \Drupal\sitemap\Tests\SitemapTaxonomyTermsRssTest::testIncludeRssLinks()

Tests included RSS links.

File

src/Tests/SitemapTaxonomyTermsRssTest.php, line 40

Class

SitemapTaxonomyTermsRssTest
Tests the display of RSS links based on sitemap settings.

Namespace

Drupal\sitemap\Tests

Code

public function testIncludeRssLinks() {

  // Assert that RSS links for terms are included in the sitemap.
  $this
    ->drupalGet('/sitemap');
  foreach ($this->terms as $term) {
    $this
      ->assertLinkByHref('/taxonomy/term/' . $term
      ->id() . '/feed');
  }

  // Change module not to include RSS links.
  $edit = [
    'show_rss_links' => 0,
  ];
  $this
    ->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));

  // Assert that RSS links are not included in the sitemap.
  $this
    ->drupalGet('/sitemap');
  foreach ($this->terms as $term) {
    $this
      ->assertNoLinkByHref('/taxonomy/term/' . $term
      ->id() . '/feed');
  }
}