public function SitemapContentTest::testTitles in Sitemap 8
Tests titles.
File
- src/
Tests/ SitemapContentTest.php, line 134
Class
- SitemapContentTest
- Test page content provided via sitemap settings.
Namespace
Drupal\sitemap\TestsCode
public function testTitles() {
// Assert that titles are included in the sitemap by default.
$this
->drupalGet('/sitemap');
$elements = $this
->cssSelect('.sitemap-box h2');
$this
->assertTrue(count($elements) > 0, 'Titles are included.');
// Configure module to hide titles.
$edit = [
'show_titles' => FALSE,
];
$this
->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
// Assert that titles are not included in the sitemap.
$this
->drupalGet('/sitemap');
$elements = $this
->cssSelect('.sitemap-box h2');
$this
->assertEqual(count($elements), 0, 'Section titles are not included.');
}