You are here

public function LegacyExecutionContextTest::testAddViolation in Plug 7

File

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

Class

LegacyExecutionContextTest
@group legacy

Namespace

Symfony\Component\Validator\Tests

Code

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