From a47a8848c3a7d1a4c1dc61a975379929d80c6a46 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 8 Aug 2014 10:52:31 +0200 Subject: [PATCH] add test for #11604 Adds a test case for #11604 to avoid regressions. The actual issue has been fixed in Symfony 2.3 with the merge of #11615. --- .../Tests/Validator/AbstractValidatorTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php index 952f5111a7..2236d6cb02 100644 --- a/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php @@ -851,6 +851,17 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase $this->validateProperty('VALUE', 'someProperty'); } + /** + * https://github.com/symfony/symfony/issues/11604 + */ + public function testValidatePropertyWithoutConstraints() + { + $entity = new Entity(); + $violations = $this->validateProperty($entity, 'lastName'); + + $this->assertCount(0, $violations, '->validateProperty() returns no violations if no constraints have been configured for the property being validated'); + } + public function testValidatePropertyValue() { $test = $this; @@ -970,6 +981,17 @@ abstract class AbstractValidatorTest extends \PHPUnit_Framework_TestCase $this->validatePropertyValue('VALUE', 'someProperty', 'someValue'); } + /** + * https://github.com/symfony/symfony/issues/11604 + */ + public function testValidatePropertyValueWithoutConstraints() + { + $entity = new Entity(); + $violations = $this->validatePropertyValue($entity, 'lastName', 'foo'); + + $this->assertCount(0, $violations, '->validatePropertyValue() returns no violations if no constraints have been configured for the property being validated'); + } + public function testValidateObjectOnlyOncePerGroup() { $entity = new Entity();