public function SitemapRssTest::testIncludeRssLinks in Sitemap 8
Tests included RSS links.
File
- src/
Tests/ SitemapRssTest.php, line 59
Class
- SitemapRssTest
- Tests the display of RSS links based on sitemap settings.
Namespace
Drupal\sitemap\TestsCode
public function testIncludeRssLinks() {
/*$terms = $this->createTerms($this->vocabulary);
$feed = '/taxonomy/term/@term/feed';
$tags = array();
// Get tags from terms.
foreach ($terms as $term) {
$tags[] = $term->label();
}
// Create dummy node.
$title = $this->randomString();
$edit = array(
'title[0][value]' => $title,
$this->fieldTagsName . '[target_id]' => implode(',', $tags),
);
$this->drupalPostForm('node/add/article', $edit, t('Save'));
*/
// Assert that RSS link for front page is included in the sitemap.
$this
->drupalGet('/sitemap');
$this
->assertLinkByHref('/rss.xml');
/*
// Assert that RSS links are included in the sitemap.
foreach ($terms as $term) {
$this->assertLinkByHref('/taxonomy/term/' . $term->id() . '/feed');
}
*/
// Change the settings to place RSS links on the left.
$edit = [
'show_rss_links' => 2,
];
$this
->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
// Assert that the 'sitemap-rss-left' class is found.
$this
->drupalGet('/sitemap');
$this
->assertRaw('sitemap-rss-left', 'Class .sitemap-rss-left found.');
// 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 link for front page is not included in the sitemap.
$this
->drupalGet('/sitemap');
$this
->assertNoLinkByHref('/rss.xml');
/*
// Assert that RSS links are not included in the sitemap.
foreach ($terms as $term) {
$this->assertNoLinkByHref('/taxonomy/term/' . $term->id() . '/feed');
}*/
}