You are here

public function SitemapRssTest::testRssFeedForFrontPage in Sitemap 8

Tests RSS feed for front page.

File

src/Tests/SitemapRssTest.php, line 39

Class

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

Namespace

Drupal\sitemap\Tests

Code

public function testRssFeedForFrontPage() {

  // Assert default RSS feed for front page.
  $this
    ->drupalGet('/sitemap');
  $this
    ->assertLinkByHref('/rss.xml');

  // Change RSS feed for front page.
  $href = Unicode::strtolower($this
    ->randomMachineName());
  $edit = [
    'rss_front' => $href,
  ];
  $this
    ->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));

  // Assert that RSS feed for front page has been changed.
  $this
    ->drupalGet('/sitemap');
  $this
    ->assertLinkByHref('/' . $href);
}