public function UserAccountLinksTest::testAnonymousLogout in Drupal 9
Ensures that logout url redirects an anonymous user to the front page.
File
- core/
modules/ user/ tests/ src/ Functional/ UserAccountLinksTest.php, line 122
Class
- UserAccountLinksTest
- Tests user-account links.
Namespace
Drupal\Tests\user\FunctionalCode
public function testAnonymousLogout() {
$this
->drupalGet('user/logout');
$this
->assertSession()
->addressEquals('/');
$this
->assertSession()
->statusCodeEquals(200);
// The redirection shouldn't affect other pages.
$this
->drupalGet('admin');
$this
->assertSession()
->addressEquals('/admin');
$this
->assertSession()
->statusCodeEquals(403);
}