public function SitemapContentTest::testPageTitle in Sitemap 8
Same name and namespace in other branches
- 8.2 src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::testPageTitle()
- 2.0.x src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::testPageTitle()
Tests page title.
File
- src/
Tests/ SitemapContentTest.php, line 71
Class
- SitemapContentTest
- Test page content provided via sitemap settings.
Namespace
Drupal\sitemap\TestsCode
public function testPageTitle() {
// Assert default page title.
$this
->drupalGet('/sitemap');
$this
->assertTitle('Sitemap | Drupal', 'The title on the sitemap page is "Sitemap | Drupal".');
// Change page title.
$new_title = $this
->randomMachineName();
$edit = [
'page_title' => $new_title,
];
$this
->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
// Assert that page title is changed.
$this
->drupalGet('/sitemap');
$this
->assertTitle("{$new_title} | Drupal", 'The title on the sitemap page is "' . "{$new_title} | Drupal" . '".');
}