function PasswordHashingTest::testPasswordNeedsUpdate

Same name in other branches
  1. 8.9.x 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

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.');
}

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