You are here

public function ChoiceValidatorTest::testStrictWithMultipleChoices in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\ChoiceValidatorTest::testStrictWithMultipleChoices()

File

vendor/symfony/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();
}