function PasswordVerifyTest::testPasswordNeedsRehash
Tests that needsRehash() is forwarded to corePassword instance.
@legacy-covers ::needsRehash
File
- 
              core/modules/ phpass/ tests/ src/ Unit/ PasswordVerifyTest.php, line 46 
Class
- PasswordVerifyTest
- Unit tests for password hashing API.
Namespace
Drupal\Tests\phpass\UnitCode
public function testPasswordNeedsRehash() : void {
  $sampleHash = $this->randomMachineName();
  $corePassword = $this->prophesize(PasswordInterface::class);
  $corePassword->needsRehash($sampleHash)
    ->willReturn(TRUE);
  $passwordService = new PhpassHashedPassword($corePassword->reveal());
  $result = $passwordService->needsRehash($sampleHash);
  $this->assertTrue($result, 'Calls to needsRehash() are forwarded to core password service.');
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
