function MenuRouterTest::testAuthUserUserLogin
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::testAuthUserUserLogin()
- 10 core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::testAuthUserUserLogin()
- 11.x core/modules/system/tests/src/Functional/Menu/MenuRouterTest.php \Drupal\Tests\system\Functional\Menu\MenuRouterTest::testAuthUserUserLogin()
Tests authenticated user login redirects.
An authenticated user hitting 'user/login' should be redirected to 'user', and 'user/register' should be redirected to the user edit page.
File
-
core/
modules/ system/ tests/ src/ Functional/ Menu/ MenuRouterTest.php, line 232
Class
- MenuRouterTest
- Tests menu router and default menu link functionality.
Namespace
Drupal\Tests\system\Functional\MenuCode
public function testAuthUserUserLogin() {
$web_user = $this->drupalCreateUser([]);
$this->drupalLogin($web_user);
$this->drupalGet('user/login');
// Check that we got to 'user'.
$this->assertSession()
->addressEquals($this->loggedInUser
->toUrl('canonical'));
// user/register should redirect to user/UID/edit.
$this->drupalGet('user/register');
$this->assertSession()
->addressEquals($this->loggedInUser
->toUrl('edit-form'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.