You are here

public function MenuRouterTest::testAuthUserUserLogin in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/system/src/Tests/Menu/MenuRouterTest.php \Drupal\system\Tests\Menu\MenuRouterTest::testAuthUserUserLogin()

Test that an authenticated user hitting 'user/login' gets redirected to 'user' and 'user/register' gets redirected to the user edit page.

File

core/modules/system/src/Tests/Menu/MenuRouterTest.php, line 231
Contains \Drupal\system\Tests\Menu\MenuRouterTest.

Class

MenuRouterTest
Tests menu router and default menu link functionality.

Namespace

Drupal\system\Tests\Menu

Code

public function testAuthUserUserLogin() {
  $web_user = $this
    ->drupalCreateUser(array());
  $this
    ->drupalLogin($web_user);
  $this
    ->drupalGet('user/login');

  // Check that we got to 'user'.
  $this
    ->assertUrl($this->loggedInUser
    ->url('canonical', [
    'absolute' => TRUE,
  ]));

  // user/register should redirect to user/UID/edit.
  $this
    ->drupalGet('user/register');
  $this
    ->assertUrl($this->loggedInUser
    ->url('edit-form', [
    'absolute' => TRUE,
  ]));
}