function UserAccountFormPasswordResetTest::setUp

Same name in other branches
  1. 10 core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php \Drupal\Tests\user\Kernel\UserAccountFormPasswordResetTest::setUp()
  2. 11.x 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 33

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->installSchema('system', [
        'sequences',
    ]);
    $this->installEntitySchema('user');
    // Create an user to login.
    $this->user = User::create([
        'name' => 'test',
    ]);
    $this->user
        ->save();
    // Set current user.
    $this->container
        ->set('current_user', $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.