66use BabDev \MoneyBundle \Validator \Constraints \AbstractMoneyComparisonValidator ;
77use Money \Money ;
88use Money \Number ;
9+ use PHPUnit \Framework \Attributes \DataProvider ;
910use Symfony \Component \Validator \Exception \ConstraintDefinitionException ;
1011use Symfony \Component \Validator \Exception \InvalidArgumentException ;
1112use Symfony \Component \Validator \Test \ConstraintValidatorTestCase ;
@@ -77,9 +78,8 @@ public static function provideInvalidConstraintOptions(): \Generator
7778
7879 /**
7980 * @param array<string, mixed>|null $options
80- *
81- * @dataProvider provideInvalidConstraintOptions
8281 */
82+ #[DataProvider('provideInvalidConstraintOptions ' )]
8383 public function testThrowsConstraintExceptionIfNoValueOrPropertyPath (?array $ options ): void
8484 {
8585 $ this ->expectException (ConstraintDefinitionException::class);
@@ -97,19 +97,15 @@ public function testThrowsConstraintExceptionIfBothValueAndPropertyPath(): void
9797 ]);
9898 }
9999
100- /**
101- * @dataProvider provideValidComparisons
102- */
100+ #[DataProvider('provideValidComparisons ' )]
103101 public function testValidComparisonToValue (Money |float |int |string |null $ dirtyValue , Money |float |int |string |null $ comparisonValue ): void
104102 {
105103 $ this ->validator ->validate ($ dirtyValue , $ this ->createConstraint (['value ' => $ comparisonValue ]));
106104
107105 $ this ->assertNoViolation ();
108106 }
109107
110- /**
111- * @dataProvider provideValidComparisonsToPropertyPath
112- */
108+ #[DataProvider('provideValidComparisonsToPropertyPath ' )]
113109 public function testValidComparisonToPropertyPath (Money |float |int |string |null $ comparedValue ): void
114110 {
115111 $ this ->setObject ($ this ->createValueObject (Money::USD (500 )));
@@ -164,9 +160,7 @@ public function testInvalidValueAsBadlyFormattedFloat(): void
164160 $ this ->validator ->validate (500 , $ this ->createConstraint (['value ' => 500.4925 ]));
165161 }
166162
167- /**
168- * @dataProvider provideInvalidComparisons
169- */
163+ #[DataProvider('provideInvalidComparisons ' )]
170164 public function testInvalidComparisonToValue (Money |float |int |string |null $ dirtyValue , string $ dirtyValueAsString , Money |float |int |string |null $ comparedValue , string $ comparedValueString , string $ comparedValueType ): void
171165 {
172166 $ constraint = $ this ->createConstraint (['value ' => $ comparedValue ]);
@@ -202,9 +196,7 @@ public function testInvalidComparisonToPropertyPathAddsPathAsParameter(): void
202196 ->assertRaised ();
203197 }
204198
205- /**
206- * @dataProvider provideComparisonsToNullValueAtPropertyPath
207- */
199+ #[DataProvider('provideComparisonsToNullValueAtPropertyPath ' )]
208200 public function testCompareWithNullValueAtPropertyAt (Money |float |int |string |null $ dirtyValue , string $ dirtyValueAsString , bool $ isValid ): void
209201 {
210202 $ constraint = $ this ->createConstraint (['propertyPath ' => 'value ' ]);
0 commit comments