public function SiteMapContentTest::testTitles in Site map 8
Tests titles.
File
- src/
Tests/ SiteMapContentTest.php, line 78
Class
- SiteMapContentTest
- Test case class for site map's content tests.
Namespace
Drupal\site_map\TestsCode
public function testTitles() {
// Assert that titles are included in the site map by default.
$this
->drupalGet('/sitemap');
$elements = $this
->cssSelect('.site-map-box h2');
$this
->assertTrue(count($elements) > 0, 'Titles are included.');
// Configure module to hide titles.
$edit = array(
'show_titles' => FALSE,
);
$this
->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
// Assert that titles are not included in the site map.
$this
->drupalGet('/sitemap');
$elements = $this
->cssSelect('.site-map-box h2');
$this
->assertEqual(count($elements), 0, 'Section titles are not included.');
}