/**
* Tests password hashing.
*
* @covers ::hash
* @covers ::getCountLog2
* @covers ::base64Encode
* @covers ::check
* @covers ::generateSalt
* @covers ::needsRehash
*/
public function testPasswordHashing() { $this->
assertSame(PhpassHashedPassword::MIN_HASH_COUNT,
$this->passwordHasher->
getCountLog2($this->hashedPassword
), 'Hashed password has the minimum number of log2 iterations.'
);
$this->
assertNotEquals($this->hashedPassword,
$this->md5HashedPassword, 'Password hashes not the same.'
);
$this->
assertTrue($this->passwordHasher->
check($this->password,
$this->md5HashedPassword
), 'Password check succeeds.'
);
$this->
assertTrue($this->passwordHasher->
check($this->password,
$this->hashedPassword
), 'Password check succeeds.'
);
// Since the log2 setting hasn't changed and the user has a valid password,
// userNeedsNewHash() should return FALSE.
$this->
assertFalse($this->passwordHasher->
needsRehash($this->hashedPassword
), 'Does not need a new hash.'
);
} /**
* Tests password rehashing.
*
* @covers ::__construct
* @covers ::hash
* @covers ::getCountLog2
* @covers ::check
* @covers ::needsRehash
*/