1111
1212namespace Symfony \Component \Intl \Tests ;
1313
14+ use PHPUnit \Framework \Attributes \DataProvider ;
15+ use PHPUnit \Framework \Attributes \Group ;
16+ use PHPUnit \Framework \Attributes \RequiresPhpExtension ;
1417use Symfony \Component \Intl \Countries ;
1518use Symfony \Component \Intl \Exception \MissingResourceException ;
1619use Symfony \Component \Intl \Util \IntlTestHelper ;
1720
18- /**
19- * @group intl-data
20- */
21+ #[Group('intl-data ' )]
2122class CountriesWithUserAssignedTest extends ResourceBundleTestCase
2223{
2324 /*
@@ -795,7 +796,7 @@ public static function tearDownAfterClass(): void
795796 Countries::withUserAssigned (false );
796797 }
797798
798- public function testAllGettersGenerateTheSameDataSetCount (): void
799+ public function testAllGettersGenerateTheSameDataSetCount ()
799800 {
800801 $ expected = \count (self ::COUNTRIES_WITH_USER_ASSIGNED );
801802 $ alpha2Count = \count (Countries::getCountryCodes ());
@@ -810,15 +811,13 @@ public function testAllGettersGenerateTheSameDataSetCount(): void
810811 $ this ->assertEquals ($ expected , $ numericCodesCount , 'Numeric codes count does not match ' );
811812 }
812813
813- public function testGetCountryCodes (): void
814+ public function testGetCountryCodes ()
814815 {
815816 $ this ->assertSame (self ::COUNTRIES_WITH_USER_ASSIGNED , Countries::getCountryCodes ());
816817 }
817818
818- /**
819- * @dataProvider provideLocales
820- */
821- public function testGetNames ($ displayLocale ): void
819+ #[DataProvider('provideLocales ' )]
820+ public function testGetNames ($ displayLocale )
822821 {
823822 if ('en ' !== $ displayLocale ) {
824823 IntlTestHelper::requireFullIntl ($ this );
@@ -833,10 +832,9 @@ public function testGetNames($displayLocale): void
833832
834833 /**
835834 * This test is for backward compatibility; testGetNames already checks `XK` is included.
836- *
837- * @dataProvider provideLocaleAliases
838835 */
839- public function testGetNamesSupportsAliases ($ alias , $ ofLocale ): void
836+ #[DataProvider('provideLocaleAliases ' )]
837+ public function testGetNamesSupportsAliases ($ alias , $ ofLocale )
840838 {
841839 if ('en ' !== $ ofLocale ) {
842840 IntlTestHelper::requireFullIntl ($ this );
@@ -850,9 +848,8 @@ public function testGetNamesSupportsAliases($alias, $ofLocale): void
850848
851849 /**
852850 * This test is for backward compatibility; testGetNames already checks `XK` is included.
853- *
854- * @dataProvider provideLocales
855851 */
852+ #[DataProvider('provideLocales ' )]
856853 public function testGetName ($ displayLocale )
857854 {
858855 if ('en ' !== $ displayLocale ) {
@@ -866,9 +863,7 @@ public function testGetName($displayLocale)
866863 }
867864 }
868865
869- /**
870- * @requires extension intl
871- */
866+ #[RequiresPhpExtension('intl ' )]
872867 public function testLocaleAliasesAreLoaded ()
873868 {
874869 \Locale::setDefault ('zh_TW ' );
@@ -884,40 +879,40 @@ public function testLocaleAliasesAreLoaded()
884879 $ this ->assertNotSame ($ countryNameZh , $ countryNameZhTw , 'zh_TW does not fall back to zh ' );
885880 }
886881
887- public function testGetNameWithInvalidCountryCode (): void
882+ public function testGetNameWithInvalidCountryCode ()
888883 {
889884 $ this ->expectException (MissingResourceException::class);
890885 Countries::getName ('PAL ' ); // PSE is commonly confused with PAL
891886 }
892887
893- public function testExists (): void
888+ public function testExists ()
894889 {
895890 $ this ->assertTrue (Countries::exists ('NL ' ));
896891 $ this ->assertTrue (Countries::exists ('XK ' ));
897892 $ this ->assertFalse (Countries::exists ('ZZ ' ));
898893 }
899894
900- public function testGetAlpha3Codes (): void
895+ public function testGetAlpha3Codes ()
901896 {
902897 $ this ->assertSame (self ::ALPHA2_TO_ALPHA3_WITH_USER_ASSIGNED , Countries::getAlpha3Codes ());
903898 }
904899
905- public function testGetAlpha3Code (): void
900+ public function testGetAlpha3Code ()
906901 {
907902 foreach (self ::COUNTRIES_WITH_USER_ASSIGNED as $ country ) {
908903 $ this ->assertSame (self ::ALPHA2_TO_ALPHA3_WITH_USER_ASSIGNED [$ country ], Countries::getAlpha3Code ($ country ));
909904 }
910905 }
911906
912- public function testGetAlpha2Code (): void
907+ public function testGetAlpha2Code ()
913908 {
914909 foreach (self ::COUNTRIES_WITH_USER_ASSIGNED as $ alpha2Code ) {
915910 $ alpha3Code = self ::ALPHA2_TO_ALPHA3_WITH_USER_ASSIGNED [$ alpha2Code ];
916911 $ this ->assertSame ($ alpha2Code , Countries::getAlpha2Code ($ alpha3Code ));
917912 }
918913 }
919914
920- public function testAlpha3CodeExists (): void
915+ public function testAlpha3CodeExists ()
921916 {
922917 $ this ->assertTrue (Countries::alpha3CodeExists ('ALB ' ));
923918 $ this ->assertTrue (Countries::alpha3CodeExists ('DEU ' ));
@@ -927,10 +922,8 @@ public function testAlpha3CodeExists(): void
927922 $ this ->assertFalse (Countries::alpha3CodeExists ('ZZZ ' ));
928923 }
929924
930- /**
931- * @dataProvider provideLocales
932- */
933- public function testGetAlpha3Name ($ displayLocale ): void
925+ #[DataProvider('provideLocales ' )]
926+ public function testGetAlpha3Name ($ displayLocale )
934927 {
935928 if ('en ' !== $ displayLocale ) {
936929 IntlTestHelper::requireFullIntl ($ this );
@@ -944,16 +937,14 @@ public function testGetAlpha3Name($displayLocale): void
944937 }
945938 }
946939
947- public function testGetAlpha3NameWithInvalidCountryCode (): void
940+ public function testGetAlpha3NameWithInvalidCountryCode ()
948941 {
949942 $ this ->expectException (MissingResourceException::class);
950943
951944 Countries::getAlpha3Name ('ZZZ ' );
952945 }
953946
954- /**
955- * @dataProvider provideLocales
956- */
947+ #[DataProvider('provideLocales ' )]
957948 public function testGetAlpha3Names ($ displayLocale )
958949 {
959950 if ('en ' !== $ displayLocale ) {
@@ -969,19 +960,19 @@ public function testGetAlpha3Names($displayLocale)
969960 $ this ->assertEqualsCanonicalizing (array_values ($ alpha2Names ), array_values ($ names ));
970961 }
971962
972- public function testGetNumericCodes (): void
963+ public function testGetNumericCodes ()
973964 {
974965 $ this ->assertSame (self ::ALPHA2_TO_NUMERIC_WITH_USER_ASSIGNED , Countries::getNumericCodes ());
975966 }
976967
977- public function testGetNumericCode (): void
968+ public function testGetNumericCode ()
978969 {
979970 foreach (self ::COUNTRIES_WITH_USER_ASSIGNED as $ country ) {
980971 $ this ->assertSame (self ::ALPHA2_TO_NUMERIC_WITH_USER_ASSIGNED [$ country ], Countries::getNumericCode ($ country ));
981972 }
982973 }
983974
984- public function testNumericCodeExists (): void
975+ public function testNumericCodeExists ()
985976 {
986977 $ this ->assertTrue (Countries::numericCodeExists ('250 ' ));
987978 $ this ->assertTrue (Countries::numericCodeExists ('008 ' ));
@@ -990,7 +981,7 @@ public function testNumericCodeExists(): void
990981 $ this ->assertFalse (Countries::numericCodeExists ('667 ' ));
991982 }
992983
993- public function testGetAlpha2FromNumeric (): void
984+ public function testGetAlpha2FromNumeric ()
994985 {
995986 $ alpha2Lookup = array_flip (self ::ALPHA2_TO_NUMERIC_WITH_USER_ASSIGNED );
996987
@@ -999,7 +990,7 @@ public function testGetAlpha2FromNumeric(): void
999990 }
1000991 }
1001992
1002- public function testNumericCodesDoNotContainDenyListItems (): void
993+ public function testNumericCodesDoNotContainDenyListItems ()
1003994 {
1004995 $ numericCodes = Countries::getNumericCodes ();
1005996
0 commit comments