[Validator] Added support for pluralization of the SizeLengthValidator
This commit is contained in:
parent
c0715f1235
commit
f9a486edde
@ -54,7 +54,7 @@ class SizeLengthValidator extends ConstraintValidator
|
||||
$this->context->addViolation($constraint->exactMessage, array(
|
||||
'{{ value }}' => $value,
|
||||
'{{ limit }}' => $constraint->max,
|
||||
));
|
||||
), null, (int) $constraint->max);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -63,7 +63,7 @@ class SizeLengthValidator extends ConstraintValidator
|
||||
$this->context->addViolation($constraint->maxMessage, array(
|
||||
'{{ value }}' => $value,
|
||||
'{{ limit }}' => $constraint->max,
|
||||
));
|
||||
), null, (int) $constraint->max);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -72,7 +72,7 @@ class SizeLengthValidator extends ConstraintValidator
|
||||
$this->context->addViolation($constraint->minMessage, array(
|
||||
'{{ value }}' => $value,
|
||||
'{{ limit }}' => $constraint->min,
|
||||
));
|
||||
), null, (int) $constraint->min);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->with('myMessage', array(
|
||||
'{{ value }}' => '1234',
|
||||
'{{ limit }}' => 5,
|
||||
));
|
||||
), null, 5);
|
||||
|
||||
$this->assertFalse($this->validator->isValid('1234', $constraint));
|
||||
}
|
||||
@ -147,7 +147,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->with('myMessage', array(
|
||||
'{{ value }}' => '12345678901',
|
||||
'{{ limit }}' => 10,
|
||||
));
|
||||
), null, 10);
|
||||
|
||||
$this->assertFalse($this->validator->isValid('12345678901', $constraint));
|
||||
}
|
||||
@ -165,7 +165,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
->with('myMessage', array(
|
||||
'{{ value }}' => '1234',
|
||||
'{{ limit }}' => 5,
|
||||
));
|
||||
), null, 5);
|
||||
|
||||
$this->assertFalse($this->validator->isValid('1234', $constraint));
|
||||
}
|
||||
|
Reference in New Issue
Block a user