Add more algorithms to unit test

This commit is contained in:
Kijin Sung 2016-03-13 23:56:04 +09:00
parent 69c5147888
commit de0d49b9f3

View file

@ -69,12 +69,18 @@ class PasswordTest extends \Codeception\TestCase\Test
$this->assertEquals(60, strlen($hash));
$this->assertTrue(Rhymix\Framework\Password::checkPassword($password, $hash, $algos));
$algos = array('pbkdf2');
$algos = array('sha384', 'pbkdf2');
$hash = Rhymix\Framework\Password::hashPassword($password, $algos);
$this->assertRegExp('/^(sha256|sha512):[0-9]+:/', $hash);
$this->assertEquals(60, strlen($hash));
$this->assertTrue(Rhymix\Framework\Password::checkPassword($password, $hash, $algos));
$algos = array('sha1', 'portable');
$hash = Rhymix\Framework\Password::hashPassword($password, $algos);
$this->assertRegExp('/^\$P\$/', $hash);
$this->assertEquals(34, strlen($hash));
$this->assertTrue(Rhymix\Framework\Password::checkPassword($password, $hash, $algos));
foreach (array('drupal', 'joomla', 'kimsqrb', 'mysql_old_password', 'mysql_new_password', 'mssql_pwdencrypt') as $algo)
{
$hash = Rhymix\Framework\Password::hashPassword($password, $algo);