Make WordPress Core

Changeset 53866


Ignore:
Timestamp:
08/08/2022 11:39:06 PM (4 years ago)
Author:
azaozz
Message:

Build/Test Tools: Add @covers tags to the l10n and i18n tests.

Props pbearne, jrf, hellofromTonya, patopaiar, ironprogrammer, antonvlasenko, SergeyBiryukov, costdev.
See #39265.

Location:
trunk/tests/phpunit/tests
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/l10n.php

    r53543 r53866  
    1818        /**
    1919         * @ticket 35961
     20         *
     21         * @covers ::_n_noop
    2022         */
    2123        public function test_n_noop() {
    … …  
    3133        /**
    3234         * @ticket 35961
     35         *
     36         * @covers ::_nx_noop
    3337         */
    3438        public function test_nx_noop() {
    … …  
    4549        /**
    4650         * @ticket 35073
     51         *
     52         * @covers ::before_last_bar
    4753         */
    4854        public function test_before_last_bar() {
    … …  
    5460        /**
    5561         * @ticket 35950
     62         *
     63         * @covers ::get_available_languages
    5664         */
    5765        public function test_get_available_languages() {
    … …  
    6876        /**
    6977         * @ticket 35284
     78         *
     79         * @covers ::wp_get_installed_translations
    7080         */
    7181        public function test_wp_get_installed_translations_for_core() {
    … …  
    90100        /**
    91101         * @ticket 35294
     102         *
     103         * @covers ::wp_dropdown_languages
    92104         */
    93105        public function test_wp_dropdown_languages() {
    … …  
    112124        /**
    113125         * @ticket 38632
     126         *
     127         * @covers ::wp_dropdown_languages
    114128         */
    115129        public function test_wp_dropdown_languages_site_default() {
    … …  
    136150        /**
    137151         * @ticket 44494
     152         *
     153         * @covers ::wp_dropdown_languages
    138154         */
    139155        public function test_wp_dropdown_languages_exclude_en_us() {
    … …  
    154170        /**
    155171         * @ticket 38632
     172         *
     173         * @covers ::wp_dropdown_languages
    156174         */
    157175        public function test_wp_dropdown_languages_en_US_selected() {
    … …  
    176194        /**
    177195         * Add site default language to ja_JP in dropdown
     196         *
     197         * @covers ::wp_dropdown_languages
    178198         */
    179199        public function test_wp_dropdown_languages_site_default_ja_JP() {
    … …  
    200220        /**
    201221         * Select dropdown language from de_DE to ja_JP
     222         *
     223         * @covers ::wp_dropdown_languages
    202224         */
    203225        public function test_wp_dropdown_languages_ja_JP_selected() {
    … …  
    247269        /**
    248270         * @ticket 35284
     271         *
     272         * @covers ::wp_get_pomo_file_data
    249273         */
    250274        public function test_wp_get_pomo_file_data() {
    … …  
    273297        /**
    274298         * @ticket 44541
     299         *
     300         * @covers ::the_excerpt
    275301         */
    276302        public function test_length_of_excerpt_should_be_counted_by_words() {
    … …  
    297323        /**
    298324         * @ticket 44541
     325         *
     326         * @covers ::the_excerpt
    299327         */
    300328        public function test_length_of_excerpt_should_be_counted_by_chars() {
    … …  
    321349        /**
    322350         * @ticket 44541
     351         *
     352         * @covers ::the_excerpt
    323353         */
    324354        public function test_length_of_excerpt_should_be_counted_by_chars_in_japanese() {
    … …  
    345375        /**
    346376         * @ticket 44541
     377         *
     378         * @covers ::the_excerpt_rss
    347379         */
    348380        public function test_length_of_excerpt_rss_should_be_counted_by_words() {
    … …  
    369401        /**
    370402         * @ticket 44541
     403         *
     404         * @covers ::the_excerpt_rss
    371405         */
    372406        public function test_length_of_excerpt_rss_should_be_counted_by_chars() {
    … …  
    394428        /**
    395429         * @ticket 44541
     430         *
     431         * @covers ::wp_dashboard_recent_drafts
    396432         */
    397433        public function test_length_of_draft_should_be_counted_by_words() {
    … …  
    418454        /**
    419455         * @ticket 44541
     456         *
     457         * @covers ::wp_dashboard_recent_drafts
    420458         */
    421459        public function test_length_of_draft_should_be_counted_by_chars() {
    … …  
    442480        /**
    443481         * @ticket 44541
     482         *
     483         * @covers ::wp_dashboard_recent_drafts
    444484         */
    445485        public function test_length_of_draft_should_be_counted_by_chars_in_japanese() {
    … …  
    466506        /**
    467507         * @ticket 44541
     508         *
     509         * @covers ::get_comment_excerpt
    468510         */
    469511        public function test_length_of_comment_excerpt_should_be_counted_by_words() {
    … …  
    484526        /**
    485527         * @ticket 44541
     528         *
     529         * @covers ::get_comment_excerpt
    486530         */
    487531        public function test_length_of_comment_excerpt_should_be_counted_by_chars() {
    … …  
    502546        /**
    503547         * @ticket 44541
     548         *
     549         * @covers ::get_comment_excerpt
    504550         */
    505551        public function test_length_of_comment_excerpt_should_be_counted_by_chars_in_Japanese() {
  • trunk/tests/phpunit/tests/l10n/getLocale.php

    r51415 r53866  
    44 * @group l10n
    55 * @group i18n
     6 *
     7 * @covers ::get_locale
    68 */
    79class Tests_L10n_GetLocale extends WP_UnitTestCase {
  • trunk/tests/phpunit/tests/l10n/getUserLocale.php

    r51568 r53866  
    44 * @group l10n
    55 * @group i18n
     6 *
     7 * @covers ::get_user_locale
    68 */
    79class Tests_L10n_GetUserLocale extends WP_UnitTestCase {
  • trunk/tests/phpunit/tests/l10n/loadScriptTextdomain.php

    r51657 r53866  
    44 * @group l10n
    55 * @group i18n
     6 *
     7 * @covers ::load_script_textdomain
    68 */
    79class Tests_L10n_LoadScriptTextdomain extends WP_UnitTestCase {
  • trunk/tests/phpunit/tests/l10n/loadTextdomain.php

    r52010 r53866  
    3333        }
    3434
     35        /**
     36         * @covers ::is_textdomain_loaded
     37         */
    3538        public function test_is_textdomain_loaded() {
    3639                $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
    3740        }
    3841
     42        /**
     43         * @covers ::unload_textdomain
     44         */
    3945        public function test_unload_textdomain() {
    4046                $this->assertFalse( unload_textdomain( 'wp-tests-domain' ) );
    4147        }
    4248
     49        /**
     50         * @covers ::unload_textdomain
     51         */
    4352        public function test_load_textdomain() {
    4453                $loaded = load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/pomo/simple.mo' );
    … …  
    4958        }
    5059
     60        /**
     61         * @covers ::unload_textdomain
     62         */
    5163        public function test_is_textdomain_loaded_after_loading() {
    5264                load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/pomo/simple.mo' );
    … …  
    5971        }
    6072
     73        /**
     74         * @covers ::unload_textdomain
     75         */
    6176        public function test_unload_textdomain_after_loading() {
    6277                load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/pomo/simple.mo' );
    … …  
    6580        }
    6681
     82        /**
     83         * @covers ::is_textdomain_loaded
     84         */
    6785        public function test_is_textdomain_loaded_after_unloading() {
    6886                load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/pomo/simple.mo' );
    … …  
    7593        /**
    7694         * @ticket 21319
     95         *
     96         * @covers ::load_textdomain
    7797         */
    7898        public function test_load_textdomain_non_existent_file() {
    … …  
    82102        /**
    83103         * @ticket 21319
     104         *
     105         * @covers ::is_textdomain_loaded
    84106         */
    85107        public function test_is_textdomain_loaded_non_existent_file() {
    … …  
    91113        /**
    92114         * @ticket 21319
     115         *
     116         * @covers ::get_translations_for_domain
    93117         */
    94118        public function test_get_translations_for_domain_non_existent_file() {
    … …  
    100124        /**
    101125         * @ticket 21319
     126         *
     127         * @covers ::unload_textdomain
    102128         */
    103129        public function test_unload_textdomain_non_existent_file() {
    … …  
    109135        /**
    110136         * @ticket 21319
     137         *
     138         * @covers ::is_textdomain_loaded
    111139         */
    112140        public function test_is_textdomain_is_not_loaded_after_gettext_call_with_no_translations() {
    … …  
    116144        }
    117145
     146        /**
     147         * @covers ::load_textdomain
     148         */
    118149        public function test_override_load_textdomain_noop() {
    119150                add_filter( 'override_load_textdomain', '__return_true' );
    … …  
    125156        }
    126157
     158        /**
     159         * @covers ::load_textdomain
     160         */
    127161        public function test_override_load_textdomain_non_existent_mofile() {
    128162                add_filter( 'override_load_textdomain', array( $this, 'override_load_textdomain_filter' ), 10, 3 );
    … …  
    139173        }
    140174
     175        /**
     176         * @covers ::load_textdomain
     177         */
    141178        public function test_override_load_textdomain_custom_mofile() {
    142179                add_filter( 'override_load_textdomain', array( $this, 'override_load_textdomain_filter' ), 10, 3 );
    … …  
    181218        }
    182219
     220        /**
     221         * @covers ::load_muplugin_textdomain
     222         */
    183223        public function test_load_muplugin_textdomain_site_locale() {
    184224                load_muplugin_textdomain( 'wp-tests-domain' );
    … …  
    189229        /**
    190230         * @ticket 38485
     231         *
     232         * @covers ::load_muplugin_textdomain
    191233         */
    192234        public function test_load_muplugin_textdomain_user_locale() {
    … …  
    199241        }
    200242
     243        /**
     244         * @covers ::load_plugin_textdomain
     245         */
    201246        public function test_load_plugin_textdomain_site_locale() {
    202247                load_plugin_textdomain( 'wp-tests-domain' );
    … …  
    207252        /**
    208253         * @ticket 38485
     254         *
     255         * @covers ::load_plugin_textdomain
    209256         */
    210257        public function test_load_plugin_textdomain_user_locale() {
    … …  
    217264        }
    218265
     266        /**
     267         * @covers ::load_theme_textdomain
     268         */
    219269        public function test_load_theme_textdomain_site_locale() {
    220270                load_theme_textdomain( 'wp-tests-domain' );
    … …  
    225275        /**
    226276         * @ticket 38485
     277         *
     278         * @covers ::load_theme_textdomain
    227279         */
    228280        public function test_load_theme_textdomain_user_locale() {
  • trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php

    r52248 r53866  
    6363        /**
    6464         * @ticket 34114
     65         *
     66         * @covers ::is_textdomain_loaded
    6567         */
    6668        public function test_plugin_translation_should_be_translated_without_calling_load_plugin_textdomain() {
    … …  
    8284        /**
    8385         * @ticket 34114
     86         *
     87         * @covers ::is_textdomain_loaded
    8488         */
    8589        public function test_theme_translation_should_be_translated_without_calling_load_theme_textdomain() {
    … …  
    103107        /**
    104108         * @ticket 34114
     109         *
     110         * @covers ::get_translations_for_domain
    105111         */
    106112        public function test_get_translations_for_domain_does_not_return_null_if_override_load_textdomain_is_used() {
    … …  
    116122        /**
    117123         * @ticket 37113
     124         *
     125         * @covers ::is_textdomain_loaded
    118126         */
    119127        public function test_should_allow_unloading_of_text_domain() {
    … …  
    155163        /**
    156164         * @ticket 26511
     165         *
     166         * @covers ::switch_to_locale
    157167         */
    158168        public function test_plugin_translation_after_switching_locale() {
    … …  
    168178        /**
    169179         * @ticket 37997
     180         *
     181         * @covers ::switch_to_locale
    170182         */
    171183        public function test_plugin_translation_after_switching_locale_twice() {
    … …  
    186198        /**
    187199         * @ticket 26511
     200         *
     201         * @covers ::switch_to_locale
    188202         */
    189203        public function test_theme_translation_after_switching_locale() {
    … …  
    203217        /**
    204218         * @ticket 38485
     219         *
     220         * @covers ::wp_set_current_user
    205221         */
    206222        public function test_plugin_translation_with_user_locale() {
    … …  
    217233        /**
    218234         * @ticket 38485
     235         *
     236         * @covers ::wp_set_current_user
    219237         */
    220238        public function test_theme_translation_with_user_locale() {
    … …  
    234252        /**
    235253         * @ticket 37997
     254         *
     255         * @covers ::_load_textdomain_just_in_time
    236256         */
    237257        public function test_get_locale_is_called_only_once_per_textdomain() {
  • trunk/tests/phpunit/tests/l10n/translateSettingsUsingI18nSchema.php

    r52010 r53866  
    44 * @group l10n
    55 * @group i18n
     6 *
     7 * @covers ::translate_settings_using_i18n_schema
    68 */
    79class Tests_L10n_TranslateSettingsUsingI18nSchema extends WP_UnitTestCase {
  • trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php

    r52248 r53866  
    3636        }
    3737
     38        /**
     39         * @covers ::switch_to_locale
     40         */
    3841        public function test_switch_to_non_existent_locale_returns_false() {
    3942                $this->assertFalse( switch_to_locale( 'foo_BAR' ) );
    4043        }
    4144
     45        /**
     46         * @covers ::switch_to_locale
     47         */
    4248        public function test_switch_to_non_existent_locale_does_not_change_locale() {
    4349                switch_to_locale( 'foo_BAR' );
    … …  
    4652        }
    4753
     54        /**
     55         * @covers ::switch_to_locale
     56         */
    4857        public function test_switch_to_locale_returns_true() {
    4958                $expected = switch_to_locale( 'en_GB' );
    … …  
    5564        }
    5665
     66        /**
     67         * @covers ::switch_to_locale
     68         */
    5769        public function test_switch_to_locale_changes_the_locale() {
    5870                switch_to_locale( 'en_GB' );
    … …  
    6678        }
    6779
     80        /**
     81         * @covers ::switch_to_locale
     82         * @covers ::translate
     83         * @covers ::__
     84         */
    6885        public function test_switch_to_locale_loads_translation() {
    6986                switch_to_locale( 'es_ES' );
    … …  
    7794        }
    7895
     96        /**
     97         * @covers ::switch_to_locale
     98         */
    7999        public function test_switch_to_locale_changes_wp_locale_global() {
    80100                global $wp_locale;
    … …  
    95115        }
    96116
     117        /**
     118         * @covers ::switch_to_locale
     119         */
    97120        public function test_switch_to_locale_en_US() {
    98121                switch_to_locale( 'en_GB' );
    … …  
    108131        }
    109132
     133        /**
     134         * @covers ::switch_to_locale
     135         */
    110136        public function test_switch_to_locale_multiple_times() {
    111137                switch_to_locale( 'en_GB' );
    … …  
    120146        }
    121147
     148        /**
     149         * @covers ::switch_to_locale
     150         * @covers ::__
     151         * @covers ::translate
     152         */
    122153        public function test_switch_to_locale_multiple_times_loads_translation() {
    123154                switch_to_locale( 'en_GB' );
    … …  
    135166        }
    136167
     168        /**
     169         * @covers ::restore_previous_locale
     170         */
    137171        public function test_restore_previous_locale_without_switching() {
    138172                $this->assertFalse( restore_previous_locale() );
    139173        }
    140174
     175        /**
     176         * @covers ::restore_previous_locale
     177         */
    141178        public function test_restore_previous_locale_changes_the_locale_back() {
    142179                switch_to_locale( 'en_GB' );
    … …  
    148185        }
    149186
     187        /**
     188         * @covers ::restore_previous_locale
     189         */
    150190        public function test_restore_previous_locale_after_switching_multiple_times() {
    151191                switch_to_locale( 'en_GB' );
    … …  
    161201        }
    162202
     203        /**
     204         * @covers ::restore_previous_locale
     205         * @covers ::__
     206         * @covers ::translate
     207         */
    163208        public function test_restore_previous_locale_restores_translation() {
    164209                switch_to_locale( 'es_ES' );
    … …  
    170215        }
    171216
     217        /**
     218         * @covers ::restore_previous_locale
     219         */
    172220        public function test_restore_previous_locale_action_passes_previous_locale() {
    173221                switch_to_locale( 'en_GB' );
    … …  
    186234        }
    187235
     236        /**
     237         * @covers ::restore_previous_locale
     238         */
    188239        public function test_restore_previous_locale_restores_wp_locale_global() {
    189240                global $wp_locale;
    … …  
    200251        }
    201252
     253        /**
     254         * @covers ::restore_current_locale
     255         */
    202256        public function test_restore_current_locale_without_switching() {
    203257                $this->assertFalse( restore_current_locale() );
    204258        }
    205259
     260        /**
     261         * @covers ::restore_previous_locale
     262         */
    206263        public function test_restore_current_locale_after_switching_multiple_times() {
    207264                switch_to_locale( 'en_GB' );
    … …  
    219276        }
    220277
     278        /**
     279         * @covers ::is_locale_switched
     280         */
    221281        public function test_is_locale_switched_if_not_switched() {
    222282                $this->assertFalse( is_locale_switched() );
    223283        }
    224284
     285        /**
     286         * @covers ::is_locale_switched
     287         */
    225288        public function test_is_locale_switched_original_locale() {
    226289                $original_locale = get_locale();
    … …  
    236299        }
    237300
     301        /**
     302         * @covers ::is_locale_switched
     303         */
    238304        public function test_is_locale_switched() {
    239305                switch_to_locale( 'en_GB' );
    … …  
    247313        }
    248314
     315        /**
     316         * @covers ::switch_to_locale
     317         */
    249318        public function test_switch_to_site_locale_if_user_locale_is_set() {
    250319                global $l10n, $wp_locale_switcher;
    … …  
    293362        }
    294363
     364        /**
     365         * @covers ::switch_to_locale
     366         */
    295367        public function test_switch_to_different_site_locale_if_user_locale_is_set() {
    296368                global $l10n, $wp_locale_switcher;
    … …  
    344416        }
    345417
     418        /**
     419         * @covers ::switch_to_locale
     420         * @covers ::load_default_textdomain
     421         */
    346422        public function test_multiple_switches_to_site_locale_and_user_locale() {
    347423                global $wp_locale_switcher;
  • trunk/tests/phpunit/tests/locale.php

    r51568 r53866  
    1616        }
    1717
     18        /**
     19         * @covers WP_Locale::get_weekday
     20         */
    1821        public function test_get_weekday() {
    1922                $this->assertSame( __( 'Sunday' ), $this->locale->get_weekday( 0 ) );
    … …  
    2629        }
    2730
     31        /**
     32         * @covers WP_Locale::get_weekday
     33         */
    2834        public function test_get_weekday_undefined_index() {
    2935                if ( PHP_VERSION_ID >= 80000 ) {
    … …  
    3642        }
    3743
     44        /**
     45         * @covers WP_Locale::get_weekday_initial
     46         */
    3847        public function test_get_weekday_initial() {
    3948                $this->assertSame( __( 'S' ), $this->locale->get_weekday_initial( __( 'Sunday' ) ) );
    … …  
    4655        }
    4756
     57        /**
     58         * @covers WP_Locale::get_weekday_abbrev
     59         */
    4860        public function test_get_weekday_abbrev() {
    4961                $this->assertSame( __( 'Sun' ), $this->locale->get_weekday_abbrev( __( 'Sunday' ) ) );
    … …  
    5668        }
    5769
     70        /**
     71         * @covers WP_Locale::get_month
     72         */
    5873        public function test_get_month() {
    5974                $this->assertSame( __( 'January' ), $this->locale->get_month( 1 ) );
    … …  
    7186        }
    7287
     88        /**
     89         * @covers WP_Locale::get_month
     90         */
    7391        public function test_get_month_leading_zero() {
    7492                $this->assertSame( __( 'January' ), $this->locale->get_month( '01' ) );
    … …  
    83101        }
    84102
     103        /**
     104         * @covers WP_Locale::get_month_abbrev
     105         */
    85106        public function test_get_month_abbrev() {
    86107                $this->assertSame( __( 'Jan' ), $this->locale->get_month_abbrev( __( 'January' ) ) );
    … …  
    98119        }
    99120
     121        /**
     122         * @covers WP_Locale::get_meridiem
     123         */
    100124        public function test_get_meridiem() {
    101125                $this->assertSame( __( 'am' ), $this->locale->get_meridiem( 'am' ) );
    … …  
    105129        }
    106130
     131        /**
     132         * @covers WP_Locale::is_rtl
     133         */
    107134        public function test_is_rtl() {
    108135                $this->assertFalse( $this->locale->is_rtl() );
Note: See TracChangeset for help on using the changeset viewer.