From e64a0204af9fd012a191b6ec647701f7c97390fe Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 24 Jul 2024 16:01:59 +0200 Subject: [PATCH] properly set up constraint options --- ...idatorWithPositiveOrZeroConstraintTest.php | 27 ++++++++++++++++++- ...hanValidatorWithPositiveConstraintTest.php | 22 ++++++++++++++- ...idatorWithNegativeOrZeroConstraintTest.php | 23 ++++++++++------ ...hanValidatorWithNegativeConstraintTest.php | 19 ++++++++----- 4 files changed, 75 insertions(+), 16 deletions(-) diff --git a/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php b/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php index e019c99e..fed0595e 100644 --- a/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php +++ b/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php @@ -23,7 +23,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate { protected static function createConstraint(?array $options = null): Constraint { - return new PositiveOrZero(); + return new PositiveOrZero($options); } /** @@ -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 */ @@ -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 */ @@ -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'); + } } diff --git a/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php b/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php index 967d87c5..c2327682 100644 --- a/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php +++ b/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php @@ -23,7 +23,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato { protected static function createConstraint(?array $options = null): Constraint { - return new Positive(); + return new Positive($options); } /** @@ -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 */ @@ -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'); + } } diff --git a/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php b/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php index 05d36a81..0702d384 100644 --- a/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php +++ b/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php @@ -23,7 +23,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO { protected static function createConstraint(?array $options = null): Constraint { - return new NegativeOrZero(); + return new NegativeOrZero($options); } /** @@ -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 */ @@ -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'); } /** @@ -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'); } } diff --git a/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php b/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php index f56b48ad..7f969f97 100644 --- a/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php +++ b/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php @@ -23,7 +23,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest { protected static function createConstraint(?array $options = null): Constraint { - return new Negative(); + return new Negative($options); } /** @@ -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 */ @@ -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'); } /** @@ -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'); + } }