You are here

public function SitemapContentTest::testPageTitle in Sitemap 8.2

Same name and namespace in other branches
  1. 8 src/Tests/SitemapContentTest.php \Drupal\sitemap\Tests\SitemapContentTest::testPageTitle()
  2. 2.0.x 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
    ->assertSession()
    ->titleEquals('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
    ->assertSession()
    ->titleEquals("{$new_title} | Drupal");
}