You are here

public function SitemapContentTest::testPageTitle in Sitemap 2.0.x

Same name and namespace in other branches
  1. 8.2 src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::testPageTitle()
  2. 8 src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::testPageTitle()

Tests configurable page title.

File

src/Tests/SitemapContentTest.php, line 77

Class

SitemapContentTest
Test configurable content on the Sitemap page.

Namespace

Drupal\sitemap\Tests

Code

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
    ->saveSitemapForm($edit);
  drupal_flush_all_caches();

  // Assert that page title is changed.
  $this
    ->drupalGet('/sitemap');
  $this
    ->assertTitle("{$new_title} | Drupal", 'The title on the sitemap page is "' . "{$new_title} | Drupal" . '".');
}