public function UserLoginTest::testLoginCacheTagsAndDestination in Drupal 9
Same name and namespace in other branches
- 8 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 29
Class
- UserLoginTest
- Ensure that login works as expected.
Namespace
Drupal\Tests\user\FunctionalCode
public function testLoginCacheTagsAndDestination() {
$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');
}