1
0
Fork 0
mirror of synced 2024-07-09 08:27:01 +12:00
appwrite/tests/unit/Auth/Validator/PasswordTest.php

32 lines
1.1 KiB
PHP
Raw Normal View History

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
use Appwrite\Auth\Validator\Password;
2019-12-29 05:37:39 +13:00
use PHPUnit\Framework\TestCase;
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
}