function UserAccountFormPasswordResetTest::setUp

Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php \Drupal\Tests\user\Kernel\UserAccountFormPasswordResetTest::setUp()
  2. 10 core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php \Drupal\Tests\user\Kernel\UserAccountFormPasswordResetTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php, line 32

Class

UserAccountFormPasswordResetTest
Verifies that the password reset behaves as expected with form elements.

Namespace

Drupal\Tests\user\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    // Install default configuration; required for AccountFormController.
    $this->installConfig([
        'user',
    ]);
    $this->installEntitySchema('user');
    // Create an user to login.
    $this->user = User::create([
        'name' => 'test',
    ]);
    $this->user
        ->save();
    // Set current user.
    $this->container
        ->get('current_user')
        ->setAccount($this->user);
    // Install the router table and then rebuild.
    \Drupal::service('router.builder')->rebuild();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.