public function testEncodePasswordBcrypt() { $this->
setupBcrypt();
$this->passwordHasherCommandTester->
execute([ 'password' => 'password',
'user-class' => 'Custom\Class\Bcrypt\User',
],
['interactive' => false
]);
$output =
$this->passwordHasherCommandTester->
getDisplay();
$this->
assertStringContainsString('Password hashing succeeded',
$output);
$hasher =
new NativePasswordHasher(null, null, 17, \PASSWORD_BCRYPT
);
preg_match('# Password hash\s{1,}([\w+\/$.]+={0,2})\s+#',
$output,
$matches);
$hash =
$matches[1
];
$this->
assertTrue($hasher->
verify($hash, 'password', null
));
} public function testEncodePasswordArgon2i() { if (!
($sodium = SodiumPasswordHasher::
isSupported() && !\
defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13'
)) && !\
defined('PASSWORD_ARGON2I'
)) { $this->
markTestSkipped('Argon2i algorithm not available.'
);
} $this->
setupArgon2i();