@@ -39,25 +39,26 @@ protected static function parenthesize_plural_expression( $expression ) {
3939
4040 /**
4141 * @ticket 41562
42- * @dataProvider data_locales
4342 * @group external-http
4443 */
45- public function test_regression ( $ lang , $ nplurals , $ expression ) {
44+ public function test_regression (): void {
4645 require_once dirname ( __DIR__ , 2 ) . '/includes/plural-form-function.php ' ;
4746
48- $ parenthesized = self ::parenthesize_plural_expression ( $ expression );
49- $ old_style = tests_make_plural_form_function ( $ nplurals , $ parenthesized );
50- $ plural_forms = new Plural_Forms ( $ expression );
47+ foreach ( self ::data_locales () as list ( $ lang , $ nplurals , $ expression ) ) {
48+ $ parenthesized = self ::parenthesize_plural_expression ( $ expression );
49+ $ old_style = tests_make_plural_form_function ( $ nplurals , $ parenthesized );
50+ $ plural_forms = new Plural_Forms ( $ expression );
5151
52- $ generated_old = array ();
53- $ generated_new = array ();
52+ $ generated_old = array ();
53+ $ generated_new = array ();
5454
55- foreach ( range ( 0 , 200 ) as $ i ) {
56- $ generated_old [] = $ old_style ( $ i );
57- $ generated_new [] = $ plural_forms ->get ( $ i );
58- }
55+ foreach ( range ( 0 , 200 ) as $ i ) {
56+ $ generated_old [] = $ old_style ( $ i );
57+ $ generated_new [] = $ plural_forms ->get ( $ i );
58+ }
5959
60- $ this ->assertSame ( $ generated_old , $ generated_new );
60+ $ this ->assertSame ( $ generated_old , $ generated_new );
61+ }
6162 }
6263
6364 /**
@@ -70,7 +71,15 @@ public function test_locales_file_not_empty() {
7071 $ this ->assertNotEmpty ( $ locales , 'Unable to retrieve GP_Locales file ' );
7172 }
7273
73- public static function data_locales () {
74+ /**
75+ * Gets locale data.
76+ *
77+ * Note: Do not use this method directly as a data provider, or else it may cause an unconditional HTTP request
78+ * during PHPUnit initialization. See <https://core.trac.wordpress.org/ticket/64963>.
79+ *
80+ * @return array<int, array{ 0: string, 1: int, 2: string }>
81+ */
82+ public static function data_locales (): array {
7483 if ( ! class_exists ( 'GP_Locales ' ) ) {
7584 $ filename = download_url ( 'https://raw.githubusercontent.com/GlotPress/GlotPress-WP/develop/locales/locales.php ' );
7685 if ( is_wp_error ( $ filename ) ) {
0 commit comments