instances added god may help
This commit is contained in:
27
tests/Service/User/UserPasswordPolicyServiceTest.php
Normal file
27
tests/Service/User/UserPasswordPolicyServiceTest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace MintyPHP\Tests\Service\User;
|
||||
|
||||
use MintyPHP\Service\User\UserPasswordPolicyService;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class UserPasswordPolicyServiceTest extends TestCase
|
||||
{
|
||||
public function testMinLengthMatchesHints(): void
|
||||
{
|
||||
$service = new UserPasswordPolicyService();
|
||||
$this->assertSame(12, $service->minLength());
|
||||
|
||||
$hints = $service->hints();
|
||||
$this->assertNotEmpty($hints);
|
||||
$this->assertSame('min', (string) ($hints[0]['rule'] ?? ''));
|
||||
}
|
||||
|
||||
public function testValidateRejectsWeakPassword(): void
|
||||
{
|
||||
$service = new UserPasswordPolicyService();
|
||||
$errors = $service->validate('abc', 'abc', true, 'foo@example.com');
|
||||
|
||||
$this->assertNotEmpty($errors);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user