You are here

public function LegacyExecutionContextTest::testAddViolationUsesPreconfiguredValueIfNotPassed in Plug 7

File

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

Class

LegacyExecutionContextTest
@group legacy

Namespace

Symfony\Component\Validator\Tests

Code

public function testAddViolationUsesPreconfiguredValueIfNotPassed() {
  $this->translator
    ->expects($this
    ->once())
    ->method('trans')
    ->with('Error', array())
    ->will($this
    ->returnValue('Translated error'));
  $this->context
    ->addViolation('Error');
  $this
    ->assertEquals(new ConstraintViolationList(array(
    new ConstraintViolation('Translated error', 'Error', array(), 'Root', 'foo.bar', 'currentValue'),
  )), $this->context
    ->getViolations());
}