public function ChoiceValidatorTest::testTooManyChoices

File

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

Class

ChoiceValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testTooManyChoices() {
  $constraint = new Choice(array(
    'choices' => array(
      'foo',
      'bar',
      'moo',
      'maa',
    ),
    'multiple' => true,
    'max' => 2,
    'maxMessage' => 'myMessage',
  ));
  $this->context
    ->expects($this
    ->once())
    ->method('addViolation')
    ->with('myMessage', array(
    '{{ limit }}' => 2,
  ), null, 2);
  $this->validator
    ->validate(array(
    'foo',
    'bar',
    'moo',
  ), $constraint);
}