password dictionary test
This commit is contained in:
parent
0760ea90d6
commit
96cf2e6330
1 changed files with 32 additions and 0 deletions
32
tests/unit/Auth/Validator/PasswordDictionaryTest.php
Normal file
32
tests/unit/Auth/Validator/PasswordDictionaryTest.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue