public function LengthValidatorTest::testInvalidValuesExact

@dataProvider getNotFourCharacters

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php, line 204

Class

LengthValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testInvalidValuesExact($value, $mbOnly = false) {
  if ($mbOnly && !function_exists('mb_strlen')) {
    $this
      ->markTestSkipped('mb_strlen does not exist');
  }
  $constraint = new Length(array(
    'min' => 4,
    'max' => 4,
    'exactMessage' => 'myMessage',
  ));
  $this->context
    ->expects($this
    ->once())
    ->method('addViolation')
    ->with('myMessage', $this
    ->identicalTo(array(
    '{{ value }}' => (string) $value,
    '{{ limit }}' => 4,
  )), $this
    ->identicalTo($value), 4);
  $this->validator
    ->validate($value, $constraint);
}