You are here

public function AbstractComparisonValidatorTestCase::testInvalidComparisonToValue in Plug 7

@dataProvider provideAllInvalidComparisons

AsString

String

Parameters

mixed $dirtyValue:

mixed $comparedValue:

string $comparedValueType:

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php, line 126

Class

AbstractComparisonValidatorTestCase
@author Daniel Holmes <daniel@danielholmes.org>

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $comparedValue, $comparedValueString, $comparedValueType) {

  // Conversion of dates to string differs between ICU versions
  // Make sure we have the correct version loaded
  if ($dirtyValue instanceof \DateTime || $dirtyValue instanceof \DateTimeInterface) {
    IntlTestHelper::requireIntl($this);
  }
  $constraint = $this
    ->createConstraint(array(
    'value' => $comparedValue,
  ));
  $constraint->message = 'Constraint Message';
  $this->validator
    ->validate($dirtyValue, $constraint);
  $this
    ->buildViolation('Constraint Message')
    ->setParameter('{{ value }}', $dirtyValueAsString)
    ->setParameter('{{ compared_value }}', $comparedValueString)
    ->setParameter('{{ compared_value_type }}', $comparedValueType)
    ->assertRaised();
}