mirror of
https://github.com/appwrite/appwrite
synced 2026-05-21 07:58:55 +00:00
33 lines
930 B
PHP
33 lines
930 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Tests\Unit\Auth\Validator;
|
||
|
|
|
||
|
|
use Appwrite\Auth\Validator\PasswordDictionary;
|
||
|
|
use PHPUnit\Framework\TestCase;
|
||
|
|
use Utopia\Database\Document;
|
||
|
|
|
||
|
|
class PasswordDictionaryTest extends TestCase
|
||
|
|
{
|
||
|
|
protected ?PasswordDictionary $object = null;
|
||
|
|
|
||
|
|
public function setUp(): void
|
||
|
|
{
|
||
|
|
$this->object = new PasswordDictionary(
|
||
|
|
['password' => true, '123456' => true],
|
||
|
|
new Document([
|
||
|
|
'auths' => [
|
||
|
|
'passwordDictionary' => true
|
||
|
|
]
|
||
|
|
])
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testValues(): void
|
||
|
|
{
|
||
|
|
$this->assertEquals($this->object->isValid('1'), false); // to check parent is being called
|
||
|
|
$this->assertEquals($this->object->isValid('123456'), false);
|
||
|
|
$this->assertEquals($this->object->isValid('password'), false);
|
||
|
|
$this->assertEquals($this->object->isValid('myPasswordIsRight'), true);
|
||
|
|
}
|
||
|
|
}
|