2019-12-29 05:37:39 +13:00
|
|
|
<?php
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
namespace Tests\Unit\Auth\Validator;
|
2019-12-29 05:37:39 +13:00
|
|
|
|
2020-03-25 06:56:32 +13:00
|
|
|
use Appwrite\Auth\Validator\Password;
|
2019-12-29 05:37:39 +13:00
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
2020-12-07 21:51:12 +13:00
|
|
|
class PasswordTest extends TestCase
|
2019-12-29 05:37:39 +13:00
|
|
|
{
|
2022-08-01 22:22:04 +12:00
|
|
|
protected ?Password $object = null;
|
2019-12-29 05:37:39 +13:00
|
|
|
|
2020-10-01 10:48:21 +13:00
|
|
|
public function setUp(): void
|
2019-12-29 05:37:39 +13:00
|
|
|
{
|
|
|
|
$this->object = new Password();
|
|
|
|
}
|
|
|
|
|
2022-08-01 22:22:04 +12:00
|
|
|
public function testValues(): void
|
2019-12-29 05:37:39 +13:00
|
|
|
{
|
2019-12-29 05:44:01 +13:00
|
|
|
$this->assertEquals($this->object->isValid(false), false);
|
|
|
|
$this->assertEquals($this->object->isValid(null), false);
|
|
|
|
$this->assertEquals($this->object->isValid(''), false);
|
2019-12-29 05:37:39 +13:00
|
|
|
$this->assertEquals($this->object->isValid('1'), false);
|
|
|
|
$this->assertEquals($this->object->isValid('12'), false);
|
|
|
|
$this->assertEquals($this->object->isValid('123'), false);
|
|
|
|
$this->assertEquals($this->object->isValid('1234'), false);
|
|
|
|
$this->assertEquals($this->object->isValid('12345'), false);
|
2021-11-26 11:31:18 +13:00
|
|
|
$this->assertEquals($this->object->isValid('123456'), false);
|
|
|
|
$this->assertEquals($this->object->isValid('1234567'), false);
|
2019-12-29 05:37:39 +13:00
|
|
|
$this->assertEquals($this->object->isValid('WUnOZcn0piQMN8Mh31xw4KQPF0gcNGVA'), true);
|
|
|
|
}
|
2020-10-01 10:48:21 +13:00
|
|
|
}
|