8000 properly set up constraint options · symfony/symfony@a3e0dc9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a3e0dc9

Browse files
committed
properly set up constraint options
1 parent 4a176ce commit a3e0dc9

4 files changed

+75
-16
lines changed

src/Symfony/Component/Validator/Tests/Constraints/GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest.php

+26-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GreaterThanOrEqualValidatorWithPositiveOrZeroConstraintTest extends Greate
2323
{
2424
protected static function createConstraint(?array $options = null): Constraint
2525
{
26-
return new PositiveOrZero();
26+
return new PositiveOrZero($options);
2727
}
2828

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

95+
public static function provideAllValidComparisons(): array
96+
{
97+
self::markTestSkipped('The "value" option cannot be used in the PositiveOrZero constraint');
98+
}
99+
95100
/**
96101
* @dataProvider provideValidComparisonsToPropertyPath
97102
*/
@@ -100,6 +105,11 @@ public function testValidComparisonToPropertyPath($comparedValue)
100105
$this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
101106
}
102107

108+
public function testNoViolationOnNullObjectWithPropertyPath()
109+
{
110+
$this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
111+
}
112+
103113
/**
104114
* @dataProvider throwsOnInvalidStringDatesProvider
105115
*/
@@ -112,4 +122,19 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
112122
{
113123
$this->markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
114124
}
125+
126+
public static function throwsOnInvalidStringDatesProvider(): array
127+
{
128+
self::markTestSkipped('The "value" option cannot be used in the PositiveOrZero constraint');
129+
}
130+
131+
public static function provideAllInvalidComparisons(): array
132+
{
133+
self::markTestSkipped('The "value" option cannot be used in the Negative constraint');
134+
}
135+
136+
public static function provideComparisonsToNullValueAtPropertyPath(): array
137+
{
138+
self::markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
139+
}
115140
}

src/Symfony/Component/Validator/Tests/Constraints/GreaterThanValidatorWithPositiveConstraintTest.php

+21-1
< 9E88 /tr>
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GreaterThanValidatorWithPositiveConstraintTest extends GreaterThanValidato
2323
{
2424
protected static function createConstraint(?array $options = null): Constraint
2525
{
26-
return new Positive();
26+
return new Positive($options);
2727
}
2828

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

98+
public static function provideAllValidComparisons(): array
99+
{
100+
self::markTestSkipped('The "value" option cannot be used in the Positive constraint');
101+
}
102+
98103
/**
99104
* @dataProvider provideValidComparisonsToPropertyPath
100105
*/
@@ -115,4 +120,19 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
115120
{
116121
$this->markTestSkipped('PropertyPath option is not used in Positive constraint');
117122
}
123+
124+
public static function throwsOnInvalidStringDatesProvider(): array
125+
{
126+
self::markTestSkipped('The "value" option cannot be used in the Positive constraint');
127+
}
128+
129+
public static function provideAllInvalidComparisons(): array
130+
{
131+
self::markTestSkipped('The "value" option cannot be used in the Positive constraint');
132+
}
133+
134+
public static function provideComparisonsToNullValueAtPropertyPath(): array
135+
{
136+
self::markTestSkipped('PropertyPath option is not used in PositiveOrZero constraint');
137+
}
118138
}

src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php

+15-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends LessThanO
2323
{
2424
protected static function createConstraint(?array $options = null): Constraint
2525
{
26-
return new NegativeOrZero();
26+
return new NegativeOrZero($options);
2727
}
2828

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

98+
public static function provideAllValidComparisons(): array
99+
{
100+
self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint');
101+
}
102+
98103
/**
99104
* @dataProvider provideValidComparisonsToPropertyPath
100105
*/
@@ -103,12 +108,9 @@ public function testValidComparisonToPropertyPath($comparedValue)
103108
$this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint');
104109
}
105110

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

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

122-
public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
124+
public static function throwsOnInvalidStringDatesProvider(): array
123125
{
124-
$this->markTestSkipped('PropertyPath option is not used in NegativeOrZero constraint');
126+
self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint');
127+
}
128+
129+
public static function provideAllInvalidComparisons(): array
130+
{
131+
self::markTestSkipped('The "value" option cannot be used in the NegativeOrZero constraint');
125132
}
126133
}

src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php

+13-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LessThanValidatorWithNegativeConstraintTest extends LessThanValidatorTest
2323
{
2424
protected static function createConstraint(?array $options = null): Constraint
2525
{
26-
return new Negative();
26+
return new Negative($options);
2727
}
2828

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

98+
public static function provideAllValidComparisons(): array
99+
{
100+
self::markTestSkipped('The "value" option cannot be used in the Negative constraint');
101+
}
102+
98103
/**
99104
* @dataProvider provideValidComparisonsToPropertyPath
100105
*/
@@ -103,12 +108,9 @@ public function testValidComparisonToPropertyPath($comparedValue)
103108
$this->markTestSkipped('PropertyPath option is not used in Negative constraint');
104109
}
105110

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

114116
/**
@@ -123,4 +125,9 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter()
123125
{
124126
$this->markTestSkipped('PropertyPath option is not used in Negative constraint');
125127
}
128+
129+
public static function provideAllInvalidComparisons(): array
130+
{
131+
self::markTestSkipped('The "value" option cannot be used in the Negative constraint');
132+
}
126133
}

0 commit comments

Comments
 (0)
0