major update
This commit is contained in:
@@ -24,4 +24,36 @@ class UserPasswordPolicyServiceTest extends TestCase
|
||||
|
||||
$this->assertNotEmpty($errors);
|
||||
}
|
||||
|
||||
public function testValidateRequiresPasswordWhenRequired(): void
|
||||
{
|
||||
$service = new UserPasswordPolicyService();
|
||||
$errors = $service->validate('', '', true, 'test@example.com');
|
||||
|
||||
$this->assertNotEmpty($errors);
|
||||
}
|
||||
|
||||
public function testValidateRejectsMismatch(): void
|
||||
{
|
||||
$service = new UserPasswordPolicyService();
|
||||
$errors = $service->validate('Abcd1234$efg', 'Abcd1234$xxx', true, 'test@example.com');
|
||||
|
||||
$this->assertNotEmpty($errors);
|
||||
}
|
||||
|
||||
public function testValidateAcceptsStrongPassword(): void
|
||||
{
|
||||
$service = new UserPasswordPolicyService();
|
||||
$errors = $service->validate('StrongPass1!', 'StrongPass1!', true, 'test@example.com');
|
||||
|
||||
$this->assertSame([], $errors);
|
||||
}
|
||||
|
||||
public function testValidateRejectsPasswordContainingEmail(): void
|
||||
{
|
||||
$service = new UserPasswordPolicyService();
|
||||
$errors = $service->validate('test@example.comA1!', 'test@example.comA1!', true, 'test@example.com');
|
||||
|
||||
$this->assertNotEmpty($errors);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user