protected function ExecutionContextTest::setUp

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/ExecutionContextTest.php, line 34

Class

ExecutionContextTest

Namespace

Symfony\Component\Validator\Tests

Code

protected function setUp() {
  $this->visitor = $this
    ->getMockBuilder('Symfony\\Component\\Validator\\ValidationVisitor')
    ->disableOriginalConstructor()
    ->getMock();
  $this->violations = new ConstraintViolationList();
  $this->metadata = $this
    ->getMock('Symfony\\Component\\Validator\\MetadataInterface');
  $this->metadataFactory = $this
    ->getMock('Symfony\\Component\\Validator\\MetadataFactoryInterface');
  $this->globalContext = $this
    ->getMock('Symfony\\Component\\Validator\\GlobalExecutionContextInterface');
  $this->globalContext
    ->expects($this
    ->any())
    ->method('getRoot')
    ->will($this
    ->returnValue('Root'));
  $this->globalContext
    ->expects($this
    ->any())
    ->method('getViolations')
    ->will($this
    ->returnValue($this->violations));
  $this->globalContext
    ->expects($this
    ->any())
    ->method('getVisitor')
    ->will($this
    ->returnValue($this->visitor));
  $this->globalContext
    ->expects($this
    ->any())
    ->method('getMetadataFactory')
    ->will($this
    ->returnValue($this->metadataFactory));
  $this->translator = $this
    ->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
  $this->context = new ExecutionContext($this->globalContext, $this->translator, self::TRANS_DOMAIN, $this->metadata, 'currentValue', 'Group', 'foo.bar');
}