Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94990a2

Browse files
committed
minor #11707 [Validator] Test that validateProperty() works if no constraint is defined (xabbuh)
This PR was merged into the 2.5 branch. Discussion ---------- [Validator] Test that validateProperty() works if no constraint is defined | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes (2.3 has to be merged into 2.5 first) | Fixed tickets | #11604, #11614 | License | MIT | Doc PR | Adds a test case for #11604 to avoid regressions. The actual issue has been fixed in Symfony 2.3 with the merge of #11615. Commits ------- a47a884 add test for #11604
2 parents 6ff62cc + a47a884 commit 94990a2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Symfony/Component/Validator/Tests/Validator/AbstractValidatorTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,17 @@ public function testValidatePropertyFailsIfPropertiesNotSupported()
851851
$this->validateProperty('VALUE', 'someProperty');
852852
}
853853

854+
/**
855+
* https://github.com/symfony/symfony/issues/11604
856+
*/
857+
public function testValidatePropertyWithoutConstraints()
858+
{
859+
$entity = new Entity();
860+
$violations = $this->validateProperty($entity, 'lastName');
861+
862+
$this->assertCount(0, $violations, '->validateProperty() returns no violations if no constraints have been configured for the property being validated');
863+
}
864+
854865
public function testValidatePropertyValue()
855866
{
856867
$test = $this;
@@ -970,6 +981,17 @@ public function testValidatePropertyValueFailsIfPropertiesNotSupported()
970981
$this->validatePropertyValue('VALUE', 'someProperty', 'someValue');
971982
}
972983

984+
/**
985+
* https://github.com/symfony/symfony/issues/11604
986+
*/
987+
public function testValidatePropertyValueWithoutConstraints()
988+
{
989+
$entity = new Entity();
990+
$violations = $this->validatePropertyValue($entity, 'lastName', 'foo');
991+
992+
$this->assertCount(0, $violations, '->validatePropertyValue() returns no violations if no constraints have been configured for the property being validated');
993+
}
994+
973995
public function testValidateObjectOnlyOncePerGroup()
974996
{
975997
$entity = new Entity();

0 commit comments

Comments
 (0)