Negative example

use Symfony\Component\Validator\Constraints\AbstractComparison;
use Symfony\Component\Validator\Constraints\Negative;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;

/** * @author Jan Schädlich <jan.schaedlich@sensiolabs.de> */
class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
{
    protected static function createConstraint(array $options = null): Constraint
    {
        return new Negative();
    }

    public static function provideValidComparisons(): array
    {
        return [
            [-1, 0],
            [-2, 0],
            [-2.5, 0],
            [null, 0],
        ];
    }

    

            [150, [
                new Range(['min' => 10, 'max' => 20]),
                new GreaterThanOrEqual(['value' => 100]),
            ]],
            [7, [
                new LessThan(['value' => 5]),
                new IdenticalTo(['value' => 7]),
            ]],
            [-3, [
                new DivisibleBy(['value' => 4]),
                new Negative(),
            ]],
            ['FOO', [
                new Choice(['choices' => ['bar', 'BAR']]),
                new Regex(['pattern' => '/foo/i']),
            ]],
            ['fr', [
                new Country(),
                new Language(),
            ]],
            [[1, 3, 5][
                new Count(['min' => 5]),
                
Home | Imprint | This part of the site doesn't use cookies.