You are here

public function SitemapContentTest::testFrontPage in Sitemap 8

Tests front page.

File

src/Tests/SitemapContentTest.php, line 113

Class

SitemapContentTest
Test page content provided via sitemap settings.

Namespace

Drupal\sitemap\Tests

Code

public function testFrontPage() {

  // Assert that front page is included in the sitemap by default.
  $this
    ->drupalGet('/sitemap');
  $elements = $this
    ->cssSelect(".sitemap-box h2:contains('Front page')");
  $this
    ->assertEqual(count($elements), 1, 'Front page is included.');

  // Configure module to hide front page.
  $edit = [
    'show_front' => FALSE,
  ];
  $this
    ->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));

  // Assert that front page is not included in the sitemap.
  $this
    ->drupalGet('/sitemap');
  $elements = $this
    ->cssSelect(".sitemap-box h2:contains('Front page')");
  $this
    ->assertEqual(count($elements), 0, 'Front page is not included.');
}