public function SitemapContentTest::testSitemapMessage in Sitemap 8
Same name and namespace in other branches
- 8.2 src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::testSitemapMessage()
- 2.0.x src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::testSitemapMessage()
Tests sitemap message.
File
- src/
Tests/ SitemapContentTest.php, line 91
Class
- SitemapContentTest
- Test page content provided via sitemap settings.
Namespace
Drupal\sitemap\TestsCode
public function testSitemapMessage() {
// Assert that sitemap message is not included in the sitemap by default.
$this
->drupalGet('/sitemap');
$elements = $this
->cssSelect('.sitemap-message');
$this
->assertEqual(count($elements), 0, 'Sitemap message is not included.');
// Change sitemap message.
$new_message = $this
->randomMachineName(16);
$edit = [
'message[value]' => $new_message,
];
$this
->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
// Assert sitemap message is included in the sitemap.
$this
->drupalGet('/sitemap');
$elements = $this
->cssSelect(".sitemap-message:contains('" . $new_message . "')");
$this
->assertEqual(count($elements), 1, 'Sitemap message is included.');
}