public function ChoiceValidatorTest::testInvalidChoice

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php, line 151

Class

ChoiceValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testInvalidChoice() {
  $constraint = new Choice(array(
    'choices' => array(
      'foo',
      'bar',
    ),
    'message' => 'myMessage',
  ));
  $this->context
    ->expects($this
    ->once())
    ->method('addViolation')
    ->with('myMessage', array(
    '{{ value }}' => 'baz',
  ), null, null);
  $this->validator
    ->validate('baz', $constraint);
}