function LegacyPasswordHashingTest::testPasswordNeedsUpdate

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

Tests a password needs update.

@covers ::needsRehash

File

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

Class

LegacyPasswordHashingTest
Unit tests for password hashing API.

Namespace

Drupal\Tests\phpass\Unit

Code

public function testPasswordNeedsUpdate() : void {
    // 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.