public function AbstractComparisonValidatorTestCase::testInvalidComparisonToValue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php \Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase::testInvalidComparisonToValue()
@dataProvider provideAllInvalidComparisons
AsString
String
Parameters
mixed $dirtyValue:
mixed $comparedValue:
string $comparedValueType:
File
- vendor/
symfony/ validator/ Tests/ Constraints/ AbstractComparisonValidatorTestCase.php, line 126
Class
- AbstractComparisonValidatorTestCase
- @author Daniel Holmes <daniel@danielholmes.org>
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
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);
if (PHP_VERSION_ID < 50304 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
$this
->markTestSkipped('Intl supports formatting DateTime objects since 5.3.4');
}
}
$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();
}