You are here

protected function AbstractConstraintValidatorTest::setValue in Plug 7

2 calls to AbstractConstraintValidatorTest::setValue()
ChoiceValidatorTest::testTooFewChoices in lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php
ChoiceValidatorTest::testTooManyChoices in lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php, line 249

Class

AbstractConstraintValidatorTest
@since 2.5.3

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

protected function setValue($value) {
  $this->value = $value;
  switch ($this
    ->getApiVersion()) {
    case Validation::API_VERSION_2_4:
      $this->context = $this
        ->createContext();
      $this->validator
        ->initialize($this->context);
      break;
    case Validation::API_VERSION_2_5:
    case Validation::API_VERSION_2_5_BC:
      $this->context
        ->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
      break;
  }
}