function PasswordVerifyTest::testLongPassword
Same name in other branches
- 11.x core/modules/phpass/tests/src/Unit/PasswordVerifyTest.php \Drupal\Tests\phpass\Unit\PasswordVerifyTest::testLongPassword()
Verifies that passwords longer than 512 bytes are not hashed.
@covers ::crypt
@dataProvider providerLongPasswords
File
-
core/
modules/ phpass/ tests/ src/ Unit/ PasswordVerifyTest.php, line 124
Class
- PasswordVerifyTest
- Unit tests for password hashing API.
Namespace
Drupal\Tests\phpass\UnitCode
public function testLongPassword($password, $allowed) : void {
// cspell:disable
$bogusHash = '$S$5TOxWPdvJRs0P/xZBdrrPlGgzViOS0drHu3jaIjitesfttrp18bk';
// cspell:enable
$passwordService = new PhpassHashedPassword(new PhpPassword());
if ($allowed) {
$hash = $passwordService->hash($password);
$this->assertNotFalse($hash);
$result = $passwordService->check($password, $hash);
$this->assertTrue($result);
}
else {
$result = $passwordService->check($password, $bogusHash);
$this->assertFalse($result);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.