Skip to content

[Validator] properly set up constraint options #57823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate
{
protected static function createConstraint(?array $options = null): Constraint
{
return new PositiveOrZero();
return new PositiveOrZero($options);
}

/**
Expand Down Expand Up @@ -92,6 +92,11 @@ public function testInvalidValuePath()
$this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
}

public static function provideAllValidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the PositiveOrZero constraint');
}

/**
* @dataProvider provideValidComparisonsToPropertyPath
*/
Expand All @@ -100,6 +105,11 @@ public function testValidComparisonToPropertyPath($comparedValue)
$this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
}

public function testNoViolationOnNullObjectWithPropertyPath()
{
$this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
}

/**
* @dataProvider throwsOnInvalidStringDatesProvider
*/
Expand All @@ -112,4 +122,19 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
{
$this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
}

public static function throwsOnInvalidStringDatesProvider(): array
{
self::markTestSkipped('The "value" option cannot be used in the PositiveOrZero constraint');
}

public static function provideAllInvalidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the Negative constraint');
}

public static function provideComparisonsToNullValueAtPropertyPath(): array
{
self::markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato
{
protected static function createConstraint(?array $options = null): Constraint
{
return new Positive();
return new Positive($options);
}

/**
Expand Down Expand Up @@ -95,6 +95,11 @@ public function testInvalidValuePath()
$this->markTestSkipped('PropertyPath option is not used in Positive constraint');
}

public static function provideAllValidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the Positive constraint');
}

/**
* @dataProvider provideValidComparisonsToPropertyPath
*/
Expand All @@ -115,4 +120,19 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
{
$this->markTestSkipped('PropertyPath option is not used in Positive constraint');
}

public static function throwsOnInvalidStringDatesProvider(): array
{
self::markTestSkipped('The "value" option cannot be used in the Positive constraint');
}

public static function provideAllInvalidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the Positive constraint');
}

public static function provideComparisonsToNullValueAtPropertyPath(): array
{
self::markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO
{
protected static function createConstraint(?array $options = null): Constraint
{
return new NegativeOrZero();
return new NegativeOrZero($options);
}

/**
Expand Down Expand Up @@ -95,6 +95,11 @@ public function testInvalidValuePath()
$this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint');
}

public static function provideAllValidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint');
}

/**
* @dataProvider provideValidComparisonsToPropertyPath
*/
Expand All @@ -103,12 +108,9 @@ public function testValidComparisonToPropertyPath($comparedValue)
$this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint');
}

/**
* @dataProvider throwsOnInvalidStringDatesProvider
*/
public function testThrowsOnInvalidStringDates(AbstractComparison $constraint, $expectedMessage, $value)
public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
{
$this->markTestSkipped('The compared value cannot be an invalid string date because it is hardcoded to 0.');
$this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint');
}

/**
Expand All @@ -119,8 +121,13 @@ public function testCompareWithNullValueAtPropertyAt($dirtyValue, $dirtyValueAsS
$this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint');
}

public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
public static function throwsOnInvalidStringDatesProvider(): array
{
$this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint');
self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint');
}

public static function provideAllInvalidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
{
protected static function createConstraint(?array $options = null): Constraint
{
return new Negative();
return new Negative($options);
}

/**
Expand Down Expand Up @@ -95,6 +95,11 @@ public function testInvalidValuePath()
$this->markTestSkipped('PropertyPath option is not used in Negative constraint');
}

public static function provideAllValidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the Negative constraint');
}

/**
* @dataProvider provideValidComparisonsToPropertyPath
*/
Expand All @@ -103,12 +108,9 @@ public function testValidComparisonToPropertyPath($comparedValue)
$this->markTestSkipped('PropertyPath option is not used in Negative constraint');
}

/**
* @dataProvider throwsOnInvalidStringDatesProvider
*/
public function testThrowsOnInvalidStringDates(AbstractComparison $constraint, $expectedMessage, $value)
public static function throwsOnInvalidStringDatesProvider(): array
{
$this->markTestSkipped('The compared value cannot be an invalid string date because it is hardcoded to 0.');
self::markTestSkipped('The "value" option cannot be used in the Negative constraint');
}

/**
Expand All @@ -123,4 +125,9 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
{
$this->markTestSkipped('PropertyPath option is not used in Negative constraint');
}

public static function provideAllInvalidComparisons(): array
{
self::markTestSkipped('The "value" option cannot be used in the Negative constraint');
}
}