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'); $context = new ExecutionContext($validator, $this->root, $translator); $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; }