protected function AbstractConstraintValidatorTest::createContext in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Constraints/AbstractConstraintValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest::createContext()
2 calls to AbstractConstraintValidatorTest::createContext()
- AbstractConstraintValidatorTest::setRoot in vendor/
symfony/ validator/ Tests/ Constraints/ AbstractConstraintValidatorTest.php - AbstractConstraintValidatorTest::setUp in vendor/
symfony/ validator/ Tests/ Constraints/ AbstractConstraintValidatorTest.php
File
- vendor/
symfony/ validator/ Tests/ Constraints/ AbstractConstraintValidatorTest.php, line 97
Class
- AbstractConstraintValidatorTest
- @since 2.5.3
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
protected function createContext() {
$translator = $this
->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
$validator = $this
->getMock('Symfony\\Component\\Validator\\Validator\\ValidatorInterface');
$contextualValidator = $this
->getMock('Symfony\\Component\\Validator\\Validator\\ContextualValidatorInterface');
switch ($this
->getApiVersion()) {
case Validation::API_VERSION_2_5:
$context = new ExecutionContext($validator, $this->root, $translator);
break;
case Validation::API_VERSION_2_4:
case Validation::API_VERSION_2_5_BC:
$context = new LegacyExecutionContext($validator, $this->root, $this
->getMock('Symfony\\Component\\Validator\\MetadataFactoryInterface'), $translator);
break;
default:
throw new \RuntimeException('Invalid API version');
}
$context
->setGroup($this->group);
$context
->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
$context
->setConstraint($this->constraint);
$validator
->expects($this
->any())
->method('inContext')
->with($context)
->will($this
->returnValue($contextualValidator));
return $context;
}