From f9a486edde3ec208b7ab18171b91c2fac0c7b82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haso=C5=88?= Date: Thu, 2 Feb 2012 13:48:24 +0100 Subject: [PATCH] [Validator] Added support for pluralization of the SizeLengthValidator --- .../Component/Validator/Constraints/SizeLengthValidator.php | 6 +++--- .../Validator/Constraints/SizeLengthValidatorTest.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Validator/Constraints/SizeLengthValidator.php b/src/Symfony/Component/Validator/Constraints/SizeLengthValidator.php index 86de9b4d9e..100d728dc2 100644 --- a/src/Symfony/Component/Validator/Constraints/SizeLengthValidator.php +++ b/src/Symfony/Component/Validator/Constraints/SizeLengthValidator.php @@ -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; } diff --git a/tests/Symfony/Tests/Component/Validator/Constraints/SizeLengthValidatorTest.php b/tests/Symfony/Tests/Component/Validator/Constraints/SizeLengthValidatorTest.php index 610bf91766..624f77dde8 100644 --- a/tests/Symfony/Tests/Component/Validator/Constraints/SizeLengthValidatorTest.php +++ b/tests/Symfony/Tests/Component/Validator/Constraints/SizeLengthValidatorTest.php @@ -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)); }