You are here

public function CountValidatorTest::testTooManyValues in Zircon Profile 8

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

@dataProvider getFiveOrMoreElements

File

vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php, line 113

Class

CountValidatorTest
@author Bernhard Schussek <bschussek@gmail.com>

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testTooManyValues($value) {
  $constraint = new Count(array(
    'max' => 4,
    'maxMessage' => 'myMessage',
  ));
  $this->validator
    ->validate($value, $constraint);
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ count }}', count($value))
    ->setParameter('{{ limit }}', 4)
    ->setInvalidValue($value)
    ->setPlural(4)
    ->setCode(Count::TOO_MANY_ERROR)
    ->assertRaised();
}