diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php index e1b941ab8e..3dd8a83a33 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php @@ -18,6 +18,7 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\Extension\Validator\Constraints\Form; use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator; use Symfony\Component\Form\SubmitButtonBuilder; +use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest; @@ -224,14 +225,12 @@ class FormValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($form, new Form()); - $is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion(); - $this->buildViolation('invalid_message_key') ->setParameter('{{ value }}', 'foo') ->setParameter('{{ foo }}', 'bar') ->setInvalidValue('foo') ->setCode(Form::NOT_SYNCHRONIZED_ERROR) - ->setCause($is2Dot4Api ? null : $form->getTransformationFailure()) + ->setCause($this->context instanceof ExecutionContextInterface ? $form->getTransformationFailure() : null) ->assertRaised(); } @@ -261,14 +260,12 @@ class FormValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($form, new Form()); - $is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion(); - $this->buildViolation('invalid_message_key') ->setParameter('{{ value }}', 'foo') ->setParameter('{{ foo }}', 'bar') ->setInvalidValue('foo') ->setCode(Form::NOT_SYNCHRONIZED_ERROR) - ->setCause($is2Dot4Api ? null : $form->getTransformationFailure()) + ->setCause($this->context instanceof ExecutionContextInterface ? $form->getTransformationFailure() : null) ->assertRaised(); } @@ -298,13 +295,11 @@ class FormValidatorTest extends AbstractConstraintValidatorTest $this->validator->validate($form, new Form()); - $is2Dot4Api = Validation::API_VERSION_2_4 === $this->getApiVersion(); - $this->buildViolation('invalid_message_key') ->setParameter('{{ value }}', 'foo') ->setInvalidValue('foo') ->setCode(Form::NOT_SYNCHRONIZED_ERROR) - ->setCause($is2Dot4Api ? null : $form->getTransformationFailure()) + ->setCause($this->context instanceof ExecutionContextInterface ? $form->getTransformationFailure() : null) ->assertRaised(); }