function LegacyPasswordHashingTest::setUp

Same name and namespace in other branches
  1. 11.x core/modules/phpass/tests/src/Unit/LegacyPasswordHashingTest.php \Drupal\Tests\phpass\Unit\LegacyPasswordHashingTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/phpass/tests/src/Unit/LegacyPasswordHashingTest.php, line 56

Class

LegacyPasswordHashingTest
Unit tests for password hashing API.

Namespace

Drupal\Tests\phpass\Unit

Code

protected function setUp() : void {
  parent::setUp();
  $this->expectDeprecation('Calling Drupal\\Core\\Password\\PhpassHashedPasswordBase::__construct() with numeric $countLog2 as the first parameter is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use PhpassHashedPasswordInterface::__construct() with $corePassword parameter set to an instance of Drupal\\Core\\Password\\PhpPassword instead. See https://www.drupal.org/node/3322420');
  $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.