You are here

protected function LegacyExecutionContextTest::setUp in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/LegacyExecutionContextTest.php, line 42

Class

LegacyExecutionContextTest
@group legacy

Namespace

Symfony\Component\Validator\Tests

Code

protected function setUp() {
  $this
    ->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
  $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');
}