You are here

public function SiteMapContentTest::testFrontPage in Site map 8

Tests front page.

File

src/Tests/SiteMapContentTest.php, line 57

Class

SiteMapContentTest
Test case class for site map's content tests.

Namespace

Drupal\site_map\Tests

Code

public function testFrontPage() {

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

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

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