You are here

public function ChoiceValidatorTest::testInvalidChoiceMultiple in Zircon Profile 8.0

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

File

vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php, line 170

Class

ChoiceValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testInvalidChoiceMultiple() {
  $constraint = new Choice(array(
    'choices' => array(
      'foo',
      'bar',
    ),
    'multipleMessage' => 'myMessage',
    'multiple' => true,
  ));
  $this->validator
    ->validate(array(
    'foo',
    'baz',
  ), $constraint);
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ value }}', '"baz"')
    ->setInvalidValue('baz')
    ->setCode(Choice::NO_SUCH_CHOICE_ERROR)
    ->assertRaised();
}