2018-04-29 22:53:46 +02:00
|
|
|
<?php
|
|
|
|
|
2018-12-27 14:14:10 +01:00
|
|
|
class GeneratePasswordTest extends \PHPUnit\Framework\TestCase {
|
2018-05-02 13:54:17 +02:00
|
|
|
public function testBasic() {
|
2018-04-29 22:53:46 +02:00
|
|
|
$one = generate_password();
|
|
|
|
|
|
|
|
$two = generate_password();
|
|
|
|
|
|
|
|
$this->assertNotEquals($one, $two);
|
|
|
|
$this->assertNotEmpty($one);
|
|
|
|
$this->assertNotEmpty($two);
|
2018-05-02 22:10:06 +02:00
|
|
|
$this->assertEquals(12, strlen($one));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testLength() {
|
|
|
|
$one = generate_password(1);
|
|
|
|
|
|
|
|
$ten = generate_password(10);
|
|
|
|
|
|
|
|
$this->assertNotEquals($one, $ten);
|
|
|
|
$this->assertNotEmpty($one);
|
|
|
|
$this->assertNotEmpty($ten);
|
|
|
|
$this->assertEquals(10, strlen($ten));
|
|
|
|
$this->assertEquals(1, strlen($one));
|
2018-04-29 22:53:46 +02:00
|
|
|
}
|
|
|
|
}
|