|
18 | 18 | use Symfony\Component\Form\Extension\Validator\Constraints\Form;
|
19 | 19 | use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
|
20 | 20 | use Symfony\Component\Form\SubmitButtonBuilder;
|
| 21 | +use Symfony\Component\Validator\Context\ExecutionContextInterface; |
21 | 22 | use Symfony\Component\Validator\Constraints\NotNull;
|
22 | 23 | use Symfony\Component\Validator\Constraints\NotBlank;
|
23 | 24 | use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
|
@@ -224,14 +225,12 @@ function () { throw new TransformationFailedException(); }
|
224 | 225 |
|
225 | 226 | $this->validator->validate($form, new Form());
|
226 | 227 |
|
227 |
| - $is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion(); |
228 |
| - |
229 | 228 | $this->buildViolation('invalid_message_key')
|
230 | 229 | ->setParameter('{{ value }}', 'foo')
|
231 | 230 | ->setParameter('{{ foo }}', 'bar')
|
232 | 231 | ->setInvalidValue('foo')
|
233 | 232 | ->setCode(Form::NOT_SYNCHRONIZED_ERROR)
|
234 |
| - ->setCause($is2Dot4Api ? null : $form->getTransformationFailure()) |
| 233 | + ->setCause($this->context instanceof ExecutionContextInterface ? $form->getTransformationFailure() : null) |
235 | 234 | ->assertRaised();
|
236 | 235 | }
|
237 | 236 |
|
@@ -261,14 +260,12 @@ function () { throw new TransformationFailedException(); }
|
261 | 260 |
|
262 | 261 | $this->validator->validate($form, new Form());
|
263 | 262 |
|
264 |
| - $is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion(); |
265 |
| - |
266 | 263 | $this->buildViolation('invalid_message_key')
|
267 | 264 | ->setParameter('{{ value }}', 'foo')
|
268 | 265 | ->setParameter('{{ foo }}', 'bar')
|
269 | 266 | ->setInvalidValue('foo')
|
270 | 267 | ->setCode(Form::NOT_SYNCHRONIZED_ERROR)
|
271 |
| - ->setCause($is2Dot4Api ? null : $form->getTransformationFailure()) |
| 268 | + ->setCause($this->context instanceof ExecutionContextInterface ? $form->getTransformationFailure() : null) |
272 | 269 | ->assertRaised();
|
273 | 270 | }
|
274 | 271 |
|
@@ -298,13 +295,11 @@ function () { throw new TransformationFailedException(); }
|
298 | 295 |
|
299 | 296 | $this->validator->validate($form, new Form());
|
300 | 297 |
|
301 |
| - $is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion(); |
302 |
| - |
303 | 298 | $this->buildViolation('invalid_message_key')
|
304 | 299 | ->setParameter('{{ value }}', 'foo')
|
305 | 300 | ->setInvalidValue('foo')
|
306 | 301 | ->setCode(Form::NOT_SYNCHRONIZED_ERROR)
|
307 |
| - ->setCause($is2Dot4Api ? null : $form->getTransformationFailure()) |
| 302 | + ->setCause($this->context instanceof ExecutionContextInterface ? $form->getTransformationFailure() : null) |
308 | 303 | ->assertRaised();
|
309 | 304 | }
|
310 | 305 |
|
|
0 commit comments