function PasswordHashingTest::setUp

Same name in other branches
  1. 7.x modules/simpletest/tests/password.test \PasswordHashingTest::setUp()
  2. 8.9.x core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php \Drupal\Tests\Core\Password\PasswordHashingTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php, line 60

Class

PasswordHashingTest
Unit tests for password hashing API.

Namespace

Drupal\Tests\Core\Password

Code

protected function setUp() : void {
    parent::setUp();
    $this->password = $this->randomMachineName();
    $this->passwordHasher = new PhpassHashedPassword(1);
    $this->hashedPassword = $this->passwordHasher
        ->hash($this->password);
    $this->md5HashedPassword = 'U' . $this->passwordHasher
        ->hash(md5($this->password));
}

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