function PasswordHashingLegacyTest::testDeprecation

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Password/PasswordHashingLegacyTest.php \Drupal\Tests\Core\Password\PasswordHashingLegacyTest::testDeprecation()

@covers \Drupal\Core\Password\PhpassHashedPassword

File

core/tests/Drupal/Tests/Core/Password/PasswordHashingLegacyTest.php, line 21

Class

PasswordHashingLegacyTest
Unit tests for deprecated password hashing API.

Namespace

Drupal\Tests\Core\Password

Code

public function testDeprecation() {
    $this->expectDeprecation('\\Drupal\\Core\\Password\\PhpassHashedPassword is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. The password compatibility service has been moved to the phpass module. Use \\Drupal\\phpass\\Password\\PhpassHashedPassword instead. See https://www.drupal.org/node/3322420');
    $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');
    $passwordService = new PhpassHashedPassword(4);
    $this->assertInstanceOf(PhpassHashedPassword::class, $passwordService);
}

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