function UserAccountLinksTest::testAccountPageTitles
Same name in other branches
- 9 core/modules/user/tests/src/Functional/UserAccountLinksTest.php \Drupal\Tests\user\Functional\UserAccountLinksTest::testAccountPageTitles()
- 8.9.x core/modules/user/tests/src/Functional/UserAccountLinksTest.php \Drupal\Tests\user\Functional\UserAccountLinksTest::testAccountPageTitles()
- 11.x core/modules/user/tests/src/Functional/UserAccountLinksTest.php \Drupal\Tests\user\Functional\UserAccountLinksTest::testAccountPageTitles()
Tests page title is set correctly on user account tabs.
File
-
core/
modules/ user/ tests/ src/ Functional/ UserAccountLinksTest.php, line 96
Class
- UserAccountLinksTest
- Tests user-account links.
Namespace
Drupal\Tests\user\FunctionalCode
public function testAccountPageTitles() : void {
// Default page titles are suffixed with the site name - Drupal.
$title_suffix = ' | Drupal';
$this->drupalGet('user');
$this->assertSession()
->titleEquals('Log in' . $title_suffix);
$this->drupalGet('user/login');
$this->assertSession()
->titleEquals('Log in' . $title_suffix);
$this->drupalGet('user/register');
$this->assertSession()
->titleEquals('Create new account' . $title_suffix);
$this->drupalGet('user/password');
$this->assertSession()
->titleEquals('Reset your password' . $title_suffix);
// Check the page title for registered users is "My Account" in menus.
$this->drupalLogin($this->drupalCreateUser());
// After login, the client is redirected to /user.
$this->assertSession()
->linkExists('My account', 0, "Page title of /user is 'My Account' in menus for registered users");
$this->assertSession()
->linkByHrefExists(\Drupal::urlGenerator()->generate('user.page'), 0);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.