1111
1212namespace Symfony \UX \Icons \Tests \Unit ;
1313
14+ use PHPUnit \Framework \Attributes \DataProvider ;
1415use PHPUnit \Framework \TestCase ;
1516use Symfony \UX \Icons \Icon ;
1617
@@ -23,17 +24,13 @@ public function testConstructor()
2324 $ this ->assertSame ('bar ' , $ icon ->getAttributes ()['foo ' ]);
2425 }
2526
26- /**
27- * @dataProvider provideIdToName
28- */
27+ #[DataProvider('provideIdToName ' )]
2928 public function testIdToName (string $ id , string $ name )
3029 {
3130 $ this ->assertSame ($ name , Icon::idToName ($ id ));
3231 }
3332
34- /**
35- * @dataProvider provideInvalidIds
36- */
33+ #[DataProvider('provideInvalidIds ' )]
3734 public function testIdToNameThrowsException (string $ id )
3835 {
3936 $ this ->expectException (\InvalidArgumentException::class);
@@ -42,17 +39,13 @@ public function testIdToNameThrowsException(string $id)
4239 Icon::idToName ($ id );
4340 }
4441
45- /**
46- * @dataProvider provideNameToId
47- */
42+ #[DataProvider('provideNameToId ' )]
4843 public function testNameToId (string $ name , string $ id )
4944 {
5045 $ this ->assertEquals ($ id , Icon::nameToId ($ name ));
5146 }
5247
53- /**
54- * @dataProvider provideInvalidNames
55- */
48+ #[DataProvider('provideInvalidNames ' )]
5649 public function testNameToIdThrowsException (string $ name )
5750 {
5851 $ this ->expectException (\InvalidArgumentException::class);
@@ -61,41 +54,31 @@ public function testNameToIdThrowsException(string $name)
6154 Icon::nameToId ($ name );
6255 }
6356
64- /**
65- * @dataProvider provideValidIds
66- */
57+ #[DataProvider('provideValidIds ' )]
6758 public function testIsValidIdWithValidIds (string $ id )
6859 {
6960 $ this ->assertTrue (Icon::isValidId ($ id ));
7061 }
7162
72- /**
73- * @dataProvider provideInvalidIds
74- */
63+ #[DataProvider('provideInvalidIds ' )]
7564 public function testIsValidIdWithInvalidIds (string $ id )
7665 {
7766 $ this ->assertFalse (Icon::isValidId ($ id ));
7867 }
7968
80- /**
81- * @dataProvider provideValidNames
82- */
69+ #[DataProvider('provideValidNames ' )]
8370 public function testIsValidNameWithValidNames (string $ name )
8471 {
8572 $ this ->assertTrue (Icon::isValidName ($ name ));
8673 }
8774
88- /**
89- * @dataProvider provideInvalidNames
90- */
75+ #[DataProvider('provideInvalidNames ' )]
9176 public function testIsValidNameWithInvalidNames (string $ name )
9277 {
9378 $ this ->assertFalse (Icon::isValidName ($ name ));
9479 }
9580
96- /**
97- * @dataProvider provideInvalidIds
98- */
81+ #[DataProvider('provideInvalidIds ' )]
9982 public function testInvalidIdToName (string $ id )
10083 {
10184 $ this ->expectException (\InvalidArgumentException::class);
@@ -105,18 +88,14 @@ public function testInvalidIdToName(string $id)
10588 Icon::idToName ($ id );
10689 }
10790
108- /**
109- * @dataProvider provideRenderAttributesTestCases
110- */
91+ #[DataProvider('provideRenderAttributesTestCases ' )]
11192 public function testRenderAttributes (array $ attributes , string $ expected )
11293 {
11394 $ icon = new Icon ('' , $ attributes );
11495 $ this ->assertStringStartsWith ($ expected , $ icon ->toHtml ());
11596 }
11697
117- /**
118- * @dataProvider provideWithAttributesTestCases
119- */
98+ #[DataProvider('provideWithAttributesTestCases ' )]
12099 public function testWithAttributes (array $ attributes , array $ withAttributes , array $ expected )
121100 {
122101 $ icon = new Icon ('foo ' , $ attributes );
0 commit comments