You are here

public function SiteMapContentTest::testSiteMapMessage in Site map 8

Tests site map message.

File

src/Tests/SiteMapContentTest.php, line 35

Class

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

Namespace

Drupal\site_map\Tests

Code

public function testSiteMapMessage() {

  // Assert that site map message is not included in the site map by default.
  $this
    ->drupalGet('/sitemap');
  $elements = $this
    ->cssSelect('.site-map-message');
  $this
    ->assertEqual(count($elements), 0, 'Site map message is not included.');

  // Change site map message.
  $new_message = $this
    ->randomMachineName(16);
  $edit = array(
    'message[value]' => $new_message,
  );
  $this
    ->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));

  // Assert site map message is included in the site map.
  $this
    ->drupalGet('/sitemap');
  $elements = $this
    ->cssSelect(".site-map-message:contains('" . $new_message . "')");
  $this
    ->assertEqual(count($elements), 1, 'Site map message is included.');
}