PasswordStrengthValidator example

namespace Symfony\Component\Validator\Tests\Constraints;

use Symfony\Component\Validator\Constraints\PasswordStrength;
use Symfony\Component\Validator\Constraints\PasswordStrengthValidator;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

class PasswordStrengthValidatorTest extends ConstraintValidatorTestCase
{
    protected function createValidator(): PasswordStrengthValidator
    {
        return new PasswordStrengthValidator();
    }

    /** * @dataProvider getValidValues */
    public function testValidValues(string $value, int $expectedStrength)
    {
        $this->validator->validate($valuenew PasswordStrength(minScore: $expectedStrength));

        $this->assertNoViolation();

        
Home | Imprint | This part of the site doesn't use cookies.