function UserLoginTest::testLoginCacheTagsAndDestination
Same name in other branches
- 9 core/modules/user/tests/src/Functional/UserLoginTest.php \Drupal\Tests\user\Functional\UserLoginTest::testLoginCacheTagsAndDestination()
- 8.9.x core/modules/user/tests/src/Functional/UserLoginTest.php \Drupal\Tests\user\Functional\UserLoginTest::testLoginCacheTagsAndDestination()
- 11.x core/modules/user/tests/src/Functional/UserLoginTest.php \Drupal\Tests\user\Functional\UserLoginTest::testLoginCacheTagsAndDestination()
Tests login with destination.
File
-
core/
modules/ user/ tests/ src/ Functional/ UserLoginTest.php, line 37
Class
- UserLoginTest
- Ensure that login works as expected.
Namespace
Drupal\Tests\user\FunctionalCode
public function testLoginCacheTagsAndDestination() : void {
$this->drupalGet('user/login');
// The user login form says "Enter your <site name> username.", hence it
// depends on config:system.site, and its cache tags should be present.
$this->assertSession()
->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site');
$user = $this->drupalCreateUser([]);
$this->drupalGet('user/login', [
'query' => [
'destination' => 'foo',
],
]);
$edit = [
'name' => $user->getAccountName(),
'pass' => $user->passRaw,
];
$this->submitForm($edit, 'Log in');
$this->assertSession()
->addressEquals('foo');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.