SitemapFrontpageTest.php in Sitemap 2.0.x
File
src/Tests/SitemapFrontpageTest.php
View source
<?php
namespace Drupal\sitemap\Tests;
class SitemapFrontpageTest extends SitemapBrowserTestBase {
use SitemapTestTrait;
public static $modules = [
'sitemap',
];
protected function setUp() {
parent::setUp();
$this->user = $this
->drupalCreateUser([
'administer sitemap',
'access sitemap',
]);
$this
->drupalLogin($this->user);
}
public function testTitle() {
$this
->titleTest('Front page', 'frontpage', '', TRUE);
}
public function testRssFeed() {
$this
->drupalGet('/sitemap');
$this
->assertLinkByHref('/rss.xml');
$elements = $this
->cssSelect(".sitemap-plugin--frontpage img");
$this
->assertEqual(count($elements), 1, 'RSS icon is included.');
$href = mb_strtolower($this
->randomMachineName());
$this
->saveSitemapForm([
'plugins[frontpage][settings][rss]' => '/' . $href,
]);
$this
->drupalGet('/sitemap');
$this
->assertLinkByHref('/' . $href);
$this
->saveSitemapForm([
'plugins[frontpage][settings][rss]' => '',
]);
$this
->drupalGet('/sitemap');
$elements = $this
->cssSelect(".sitemap-plugin--frontpage img");
$this
->assertEqual(count($elements), 0, 'RSS icon is not included.');
}
}