1111
1212namespace Symfony \Component \VarDumper \Tests \Caster ;
1313
14+ use PHPUnit \Framework \Attributes \DataProvider ;
1415use PHPUnit \Framework \TestCase ;
1516use Symfony \Component \VarDumper \Caster \Caster ;
1617use Symfony \Component \VarDumper \Caster \DateCaster ;
@@ -37,9 +38,7 @@ protected function tearDown(): void
3738 date_default_timezone_set ($ this ->previousTimezone );
3839 }
3940
40- /**
41- * @dataProvider provideDateTimes
42- */
41+ #[DataProvider('provideDateTimes ' )]
4342 public function testDumpDateTime ($ time , $ timezone , $ xDate , $ xTimestamp )
4443 {
4544 $ date = new \DateTime ($ time , new \DateTimeZone ($ timezone ));
@@ -53,9 +52,7 @@ public function testDumpDateTime($time, $timezone, $xDate, $xTimestamp)
5352 $ this ->assertDumpEquals ($ xDump , $ date );
5453 }
5554
56- /**
57- * @dataProvider provideDateTimes
58- */
55+ #[DataProvider('provideDateTimes ' )]
5956 public function testDumpDateTimeImmutable ($ time , $ timezone , $ xDate , $ xTimestamp )
6057 {
6158 $ date = new \DateTimeImmutable ($ time , new \DateTimeZone ($ timezone ));
@@ -69,9 +66,7 @@ public function testDumpDateTimeImmutable($time, $timezone, $xDate, $xTimestamp)
6966 $ this ->assertDumpEquals ($ xDump , $ date );
7067 }
7168
72- /**
73- * @dataProvider provideDateTimes
74- */
69+ #[DataProvider('provideDateTimes ' )]
7570 public function testCastDateTime ($ time , $ timezone , $ xDate , $ xTimestamp , $ xInfos )
7671 {
7772 $ stub = new Stub ();
@@ -118,9 +113,7 @@ public static function provideDateTimes()
118113 ];
119114 }
120115
121- /**
122- * @dataProvider provideNoTimezoneDateTimes
123- */
116+ #[DataProvider('provideNoTimezoneDateTimes ' )]
124117 public function testCastDateTimeNoTimezone ($ time , $ xDate , $ xInfos )
125118 {
126119 date_default_timezone_set ('UTC ' );
@@ -200,9 +193,7 @@ public function testCastDateTimeWithAdditionalChildProperty()
200193 $ this ->assertDumpMatchesFormat ($ xDump , $ dateCast ["\0~ \0date " ]);
201194 }
202195
203- /**
204- * @dataProvider provideIntervals
205- */
196+ #[DataProvider('provideIntervals ' )]
206197 public function testDumpInterval ($ intervalSpec , $ ms , $ invert , $ expected )
207198 {
208199 $ interval = $ this ->createInterval ($ intervalSpec , $ ms , $ invert );
@@ -216,9 +207,7 @@ public function testDumpInterval($intervalSpec, $ms, $invert, $expected)
216207 $ this ->assertDumpMatchesFormat ($ xDump , $ interval );
217208 }
218209
219- /**
220- * @dataProvider provideIntervals
221- */
210+ #[DataProvider('provideIntervals ' )]
222211 public function testDumpIntervalExcludingVerbosity ($ intervalSpec , $ ms , $ invert , $ expected )
223212 {
224213 $ interval = $ this ->createInterval ($ intervalSpec , $ ms , $ invert );
@@ -232,9 +221,7 @@ public function testDumpIntervalExcludingVerbosity($intervalSpec, $ms, $invert,
232221 $ this ->assertDumpEquals ($ xDump , $ interval , Caster::EXCLUDE_VERBOSE );
233222 }
234223
235- /**
236- * @dataProvider provideIntervals
237- */
224+ #[DataProvider('provideIntervals ' )]
238225 public function testCastInterval ($ intervalSpec , $ ms , $ invert , $ xInterval , $ xSeconds )
239226 {
240227 $ interval = $ this ->createInterval ($ intervalSpec , $ ms , $ invert );
@@ -303,9 +290,7 @@ public static function provideIntervals()
303290 ];
304291 }
305292
306- /**
307- * @dataProvider provideTimeZones
308- */
293+ #[DataProvider('provideTimeZones ' )]
309294 public function testDumpTimeZone ($ timezone , $ expected )
310295 {
311296 $ timezone = new \DateTimeZone ($ timezone );
@@ -319,9 +304,7 @@ public function testDumpTimeZone($timezone, $expected)
319304 $ this ->assertDumpMatchesFormat ($ xDump , $ timezone );
320305 }
321306
322- /**
323- * @dataProvider provideTimeZones
324- */
307+ #[DataProvider('provideTimeZones ' )]
325308 public function testDumpTimeZoneExcludingVerbosity ($ timezone , $ expected )
326309 {
327310 $ timezone = new \DateTimeZone ($ timezone );
@@ -335,9 +318,7 @@ public function testDumpTimeZoneExcludingVerbosity($timezone, $expected)
335318 $ this ->assertDumpMatchesFormat ($ xDump , $ timezone , Caster::EXCLUDE_VERBOSE );
336319 }
337320
338- /**
339- * @dataProvider provideTimeZones
340- */
321+ #[DataProvider('provideTimeZones ' )]
341322 public function testCastTimeZone ($ timezone , $ xTimezone , $ xRegion )
342323 {
343324 $ timezone = new \DateTimeZone ($ timezone );
@@ -396,9 +377,7 @@ public static function provideTimeZones()
396377 ];
397378 }
398379
399- /**
400- * @dataProvider providePeriods
401- */
380+ #[DataProvider('providePeriods ' )]
402381 public function testDumpPeriod ($ start , $ interval , $ end , $ options , $ expected )
403382 {
404383 $ p = new \DatePeriod (new \DateTimeImmutable ($ start ), new \DateInterval ($ interval ), \is_int ($ end ) ? $ end : new \DateTime ($ end ), $ options );
@@ -412,9 +391,7 @@ public function testDumpPeriod($start, $interval, $end, $options, $expected)
412391 $ this ->assertDumpMatchesFormat ($ xDump , $ p );
413392 }
414393
415- /**
416- * @dataProvider providePeriods
417- */
394+ #[DataProvider('providePeriods ' )]
418395 public function testCastPeriod ($ start , $ interval , $ end , $ options , $ xPeriod , $ xDates )
419396 {
420397 $ p = new \DatePeriod (new \DateTimeImmutable ($ start , new \DateTimeZone ('UTC ' )), new \DateInterval ($ interval ), \is_int ($ end ) ? $ end : new \DateTimeImmutable ($ end , new \DateTimeZone ('UTC ' )), $ options );
0 commit comments