function PhpPasswordTest::setUp

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php \Drupal\Tests\Core\Password\PhpPasswordTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Password/PhpPasswordTest.php, line 37

Class

PhpPasswordTest
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 PhpPassword(PASSWORD_BCRYPT, [
        'cost' => 5,
    ]);
    $this->passwordHash = $this->passwordHasher
        ->hash($this->password);
}

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