Files
breadcrumb-the-shire/tests/Service/User/UserPasswordPolicyServiceTest.php

28 lines
751 B
PHP
Raw Normal View History

2026-02-23 12:58:19 +01:00
<?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);
}
}