You are here

public function ChoiceValidatorTest::testStrictWithMultipleChoices in Plug 7

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php, line 287

Class

ChoiceValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testStrictWithMultipleChoices() {
  $constraint = new Choice(array(
    'choices' => array(
      1,
      2,
      3,
    ),
    'multiple' => true,
    'strict' => true,
    'multipleMessage' => 'myMessage',
  ));
  $this->validator
    ->validate(array(
    2,
    '3',
  ), $constraint);
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ value }}', '"3"')
    ->setInvalidValue('3')
    ->setCode(Choice::NO_SUCH_CHOICE_ERROR)
    ->assertRaised();
}