You are here

protected function UserAccountFormPasswordResetTest::setUp in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/user/tests/src/Kernel/UserAccountFormPasswordResetTest.php \Drupal\Tests\user\Kernel\UserAccountFormPasswordResetTest::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();
}