[Validator] Added support for pluralization of the SizeLengthValidator

This commit is contained in:
Martin Hasoň 2012-02-02 13:48:24 +01:00
parent c0715f1235
commit f9a486edde
2 changed files with 6 additions and 6 deletions

View File

@ -54,7 +54,7 @@ class SizeLengthValidator extends ConstraintValidator
$this->context->addViolation($constraint->exactMessage, array( $this->context->addViolation($constraint->exactMessage, array(
'{{ value }}' => $value, '{{ value }}' => $value,
'{{ limit }}' => $constraint->max, '{{ limit }}' => $constraint->max,
)); ), null, (int) $constraint->max);
return false; return false;
} }
@ -63,7 +63,7 @@ class SizeLengthValidator extends ConstraintValidator
$this->context->addViolation($constraint->maxMessage, array( $this->context->addViolation($constraint->maxMessage, array(
'{{ value }}' => $value, '{{ value }}' => $value,
'{{ limit }}' => $constraint->max, '{{ limit }}' => $constraint->max,
)); ), null, (int) $constraint->max);
return false; return false;
} }
@ -72,7 +72,7 @@ class SizeLengthValidator extends ConstraintValidator
$this->context->addViolation($constraint->minMessage, array( $this->context->addViolation($constraint->minMessage, array(
'{{ value }}' => $value, '{{ value }}' => $value,
'{{ limit }}' => $constraint->min, '{{ limit }}' => $constraint->min,
)); ), null, (int) $constraint->min);
return false; return false;
} }

View File

@ -129,7 +129,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
->with('myMessage', array( ->with('myMessage', array(
'{{ value }}' => '1234', '{{ value }}' => '1234',
'{{ limit }}' => 5, '{{ limit }}' => 5,
)); ), null, 5);
$this->assertFalse($this->validator->isValid('1234', $constraint)); $this->assertFalse($this->validator->isValid('1234', $constraint));
} }
@ -147,7 +147,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
->with('myMessage', array( ->with('myMessage', array(
'{{ value }}' => '12345678901', '{{ value }}' => '12345678901',
'{{ limit }}' => 10, '{{ limit }}' => 10,
)); ), null, 10);
$this->assertFalse($this->validator->isValid('12345678901', $constraint)); $this->assertFalse($this->validator->isValid('12345678901', $constraint));
} }
@ -165,7 +165,7 @@ class SizeLengthValidatorTest extends \PHPUnit_Framework_TestCase
->with('myMessage', array( ->with('myMessage', array(
'{{ value }}' => '1234', '{{ value }}' => '1234',
'{{ limit }}' => 5, '{{ limit }}' => 5,
)); ), null, 5);
$this->assertFalse($this->validator->isValid('1234', $constraint)); $this->assertFalse($this->validator->isValid('1234', $constraint));
} }