You are here

public function PasswordHashingTest::testPasswordNeedsUpdate in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php \Drupal\Tests\Core\Password\PasswordHashingTest::testPasswordNeedsUpdate()
  2. 9 core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php \Drupal\Tests\Core\Password\PasswordHashingTest::testPasswordNeedsUpdate()

Tests a password needs update.

@covers ::needsRehash

File

core/tests/Drupal/Tests/Core/Password/PasswordHashingTest.php, line 84
Contains \Drupal\Tests\Core\Password\PasswordHashingTest.

Class

PasswordHashingTest
Unit tests for password hashing API.

Namespace

Drupal\Tests\Core\Password

Code

public function testPasswordNeedsUpdate() {

  // The md5 password should be flagged as needing an update.
  $this
    ->assertTrue($this->passwordHasher
    ->needsRehash($this->md5HashedPassword), 'Upgraded md5 password hash needs a new hash.');
}