You are here

public function SiteMapContentTest::testPageTitle in Site map 8

Tests page title.

File

src/Tests/SiteMapContentTest.php, line 15

Class

SiteMapContentTest
Test case class for site map's content tests.

Namespace

Drupal\site_map\Tests

Code

public function testPageTitle() {

  // Assert default page title.
  $this
    ->drupalGet('/sitemap');
  $this
    ->assertTitle('Site map | Drupal', 'The title on the site map page is "Site map | Drupal".');

  // Change page title.
  $new_title = $this
    ->randomMachineName();
  $edit = array(
    '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 site map page is "' . "{$new_title} | Drupal" . '".');
}