mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
Move all functionality of old Password class to new Password class
This commit is contained in:
parent
642f048f64
commit
f4dc7e6b21
3 changed files with 73 additions and 316 deletions
|
|
@ -27,9 +27,9 @@ class PasswordTest extends \Codeception\TestCase\Test
|
|||
$this->assertTrue($algo === 'bcrypt' || $algo === 'pbkdf2');
|
||||
}
|
||||
|
||||
public function testGetSelectedAlgorithm()
|
||||
public function testGetDefaultAlgorithm()
|
||||
{
|
||||
$algo = Rhymix\Framework\Password::getSelectedAlgorithm();
|
||||
$algo = Rhymix\Framework\Password::getDefaultAlgorithm();
|
||||
$this->assertTrue($algo === 'bcrypt' || $algo === 'pbkdf2' || $algo === 'md5');
|
||||
}
|
||||
|
||||
|
|
@ -40,6 +40,16 @@ class PasswordTest extends \Codeception\TestCase\Test
|
|||
$this->assertTrue($work_factor <= 31);
|
||||
}
|
||||
|
||||
public function testGetRandomPassword()
|
||||
{
|
||||
$password = Rhymix\Framework\Password::getRandomPassword(16);
|
||||
$this->assertEquals(16, strlen($password));
|
||||
$this->assertRegexp('/[a-z]/', $password);
|
||||
$this->assertRegexp('/[A-Z]/', $password);
|
||||
$this->assertRegexp('/[0-9]/', $password);
|
||||
$this->assertRegexp('/[^a-zA-Z0-9]/', $password);
|
||||
}
|
||||
|
||||
public function testHashPassword()
|
||||
{
|
||||
$password = Rhymix\Framework\Security::getRandom(32);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue