2626use Symfony \Component \Translation \IdentityTranslator ;
2727use Symfony \Component \Validator \Constraints \Collection ;
2828use Symfony \Component \Validator \Constraints \GroupSequence ;
29+ use Symfony \Component \Validator \Constraints \Length ;
2930use Symfony \Component \Validator \Constraints \NotBlank ;
3031use Symfony \Component \Validator \Constraints \NotNull ;
3132use Symfony \Component \Validator \Constraints \Valid ;
@@ -77,10 +78,11 @@ public function testValidateConstraints()
7778 $ object = new \stdClass ();
7879 $ constraint1 = new NotNull (['groups ' => ['group1 ' , 'group2 ' ]]);
7980 $ constraint2 = new NotBlank (['groups ' => 'group2 ' ]);
81+ $ constraint3 = new Length (['groups ' => 'group2 ' , 'min ' => 3 ]);
8082
8183 $ options = [
8284 'validation_groups ' => ['group1 ' , 'group2 ' ],
83- 'constraints ' => [$ constraint1 , $ constraint2 ],
85+ 'constraints ' => [$ constraint1 , $ constraint2, $ constraint3 ],
8486 ];
8587 $ form = $ this ->getCompoundForm ($ object , $ options );
8688 $ form ->submit ([]);
@@ -89,8 +91,8 @@ public function testValidateConstraints()
8991 $ this ->expectValidateAt (0 , 'data ' , $ object , ['group1 ' , 'group2 ' ]);
9092
9193 // Then custom constraints
92- $ this ->expectValidateValueAt (1 , 'data ' , $ object , $ constraint1 , 'group1 ' );
93- $ this ->expectValidateValueAt (2 , 'data ' , $ object , $ constraint2 , 'group2 ' );
94+ $ this ->expectValidateValueAt (1 , 'data ' , $ object , [ $ constraint1] , 'group1 ' );
95+ $ this ->expectValidateValueAt (2 , 'data ' , $ object , [ $ constraint2, $ constraint3 ] , 'group2 ' );
9496
9597 $ this ->validator ->validate ($ form , new Form ());
9698
@@ -172,8 +174,8 @@ public function testValidateConstraintsOptionEvenIfNoValidConstraint()
172174 $ parent ->add ($ form );
173175 $ parent ->submit ([]);
174176
175- $ this ->expectValidateValueAt (0 , 'data ' , $ object , $ constraint1 , 'group1 ' );
176- $ this ->expectValidateValueAt (1 , 'data ' , $ object , $ constraint2 , 'group2 ' );
177+ $ this ->expectValidateValueAt (0 , 'data ' , $ object , [ $ constraint1] , 'group1 ' );
178+ $ this ->expectValidateValueAt (1 , 'data ' , $ object , [ $ constraint2] , 'group2 ' );
177179
178180 $ this ->validator ->validate ($ form , new Form ());
179181
0 commit comments