Make WordPress Core

Ticket #39265: root.2.patch

File root.2.patch, 260.0 KB (added by pbearne, 3 years ago)

updated root patch

  • tests/phpunit/tests/actions.php

     
    77 */
    88class Tests_Actions extends WP_UnitTestCase {
    99
     10        /**
     11         *
     12         * @covers ::do_action
     13         */
    1014        function test_simple_action() {
    1115                $a   = new MockAction();
    1216                $tag = __FUNCTION__;
     
    2428                $this->assertEquals( array( '' ), $args );
    2529        }
    2630
     31        /**
     32         * @covers ::remove_action
     33         */
    2734        function test_remove_action() {
    2835                $a   = new MockAction();
    2936                $tag = __FUNCTION__;
     
    4350
    4451        }
    4552
     53        /**
     54         * @covers ::has_action
     55         */
    4656        function test_has_action() {
    4757                $tag  = __FUNCTION__;
    4858                $func = __FUNCTION__ . '_func';
     
    5767                $this->assertFalse( has_action( $tag ) );
    5868        }
    5969
    60         // One tag with multiple actions.
     70        /**
     71         * One tag with multiple actions.
     72         *
     73         * @covers ::add_action
     74         */
    6175        function test_multiple_actions() {
    6276                $a1  = new MockAction();
    6377                $a2  = new MockAction();
     
    7488                $this->assertEquals( 1, $a2->get_call_count() );
    7589        }
    7690
     91        /**
     92         * One tag with multiple actions.
     93         *
     94         * @covers ::do_action
     95         */
    7796        function test_action_args_1() {
    7897                $a   = new MockAction();
    7998                $tag = __FUNCTION__;
     
    89108                $this->assertEquals( array( $val ), array_pop( $argsvar ) );
    90109        }
    91110
     111        /**
     112         * One tag with multiple actions.
     113         *
     114         * @covers ::do_action
     115         */
    92116        function test_action_args_2() {
    93117                $a1   = new MockAction();
    94118                $a2   = new MockAction();
     
    120144         *
    121145         * @see https://core.trac.wordpress.org/ticket/17817#comment:72
    122146         * @ticket 17817
     147         *
     148         * @covers ::do_action
    123149         */
    124150        function test_action_args_3() {
    125151                $a1   = new MockAction();
     
    157183         * Tests PHP 4 notation for calling actions while passing in an object by reference.
    158184         *
    159185         * @ticket 48312
     186         *
     187         * @covers ::do_action
    160188         */
    161189        function test_action_args_with_php4_syntax() {
    162190                $a   = new MockAction();
     
    201229                $this->assertEquals( $expected, $a->get_events() );
    202230        }
    203231
     232        /**
     233         * @covers ::did_action
     234         */
    204235        function test_did_action() {
    205236                $tag1 = 'action1';
    206237                $tag2 = 'action2';
     
    222253
    223254        }
    224255
     256        /**
     257         * @covers ::add_action
     258         */
    225259        function test_all_action() {
    226260                $a    = new MockAction();
    227261                $tag1 = __FUNCTION__ . '_1';
     
    246280
    247281        }
    248282
     283        /**
     284         * @covers ::remove_action
     285         */
    249286        function test_remove_all_action() {
    250287                $a   = new MockAction();
    251288                $tag = __FUNCTION__;
     
    266303                $this->assertEquals( array( $tag ), $a->get_tags() );
    267304        }
    268305
     306        /**
     307         * @covers ::do_action_ref_array
     308         */
    269309        function test_action_ref_array() {
    270310                $obj = new stdClass();
    271311                $a   = new MockAction();
     
    284324
    285325        /**
    286326         * @ticket 11241
     327         *
     328         * @covers ::add_action
    287329         */
    288330        function test_action_keyed_array() {
    289331                $a = new MockAction();
     
    309351
    310352        }
    311353
     354        /**
     355         * @covers ::do_action
     356         */
    312357        function test_action_self_removal() {
    313358                add_action( 'test_action_self_removal', array( $this, 'action_self_removal' ) );
    314359                do_action( 'test_action_self_removal' );
     
    321366
    322367        /**
    323368         * @ticket 17817
     369         *
     370         * @covers ::do_action
    324371         */
    325372        function test_action_recursion() {
    326373                $tag = __FUNCTION__;
     
    336383                $this->assertEquals( 2, $b->get_call_count(), 'recursive actions should call callbacks with later priority' );
    337384        }
    338385
     386        /**
     387         * @covers ::do_action
     388         */
    339389        function action_that_causes_recursion( $tag ) {
    340390                static $recursing = false;
    341391                if ( ! $recursing ) {
     
    348398        /**
    349399         * @ticket 9968
    350400         * @ticket 17817
     401         *
     402         * @covers ::add_action
    351403         */
    352404        function test_action_callback_manipulation_while_running() {
    353405                $tag = __FUNCTION__;
     
    383435         *
    384436         * This specificaly addresses the concern raised at
    385437         * https://core.trac.wordpress.org/ticket/17817#comment:52
     438         *
     439         * @covers ::remove_filter
    386440         */
    387441        function test_remove_anonymous_callback() {
    388442                $tag = __FUNCTION__;
     
    416470         * Test the ArrayAccess methods of WP_Hook
    417471         *
    418472         * @ticket 17817
     473         *
     474         * @covers ::has_action
    419475         */
    420476        function test_array_access_of_wp_filter_global() {
    421477                global $wp_filter;
     
    442498         * Make sure current_action() behaves as current_filter()
    443499         *
    444500         * @ticket 14994
     501         *
     502         * @covers ::current_action
    445503         */
    446504        function test_current_action() {
    447505                global $wp_current_filter;
     
    453511
    454512        /**
    455513         * @ticket 14994
     514         *
     515         * @covers ::doing_filter
    456516         */
    457517        function test_doing_filter() {
    458518                global $wp_current_filter;
     
    472532
    473533        /**
    474534         * @ticket 14994
     535         *
     536         * @covers ::doing_filter
    475537         */
    476538        function test_doing_action() {
    477539                global $wp_current_filter;
     
    491553
    492554        /**
    493555         * @ticket 14994
     556         *
     557         * @covers ::doing_filter
    494558         */
    495559        function test_doing_filter_real() {
    496560                $this->assertFalse( doing_filter() );            // No filter is passed in, and no filter is being processed.
     
    509573                $this->assertFalse( doing_filter( 'testing' ) ); // No longer doing this filter.
    510574        }
    511575
     576        /**
     577         * @covers ::doing_filter
     578         */
    512579        function apply_testing_filter() {
    513580                $this->apply_testing_filter = true;
    514581
     
    530597                $this->assertFalse( doing_filter( 'testing_nested' ) );
    531598        }
    532599
     600        /**
     601         * @covers ::doing_filter
     602         */
    533603        function apply_testing_nested_filter() {
    534604                $this->apply_testing_nested_filter = true;
    535605                $this->assertTrue( doing_filter() );
     
    541611        /**
    542612         * @ticket 10441
    543613         * @expectedDeprecated tests_do_action_deprecated
     614         *
     615         * @covers ::do_action_deprecated
    544616         */
    545617        public function test_do_action_deprecated() {
    546618                $p = new WP_Post( (object) array( 'post_title' => 'Foo' ) );
     
    559631        /**
    560632         * @ticket 10441
    561633         * @expectedDeprecated tests_do_action_deprecated
     634         *
     635         * @covers ::do_action_deprecated
    562636         */
    563637        public function test_do_action_deprecated_with_multiple_params() {
    564638                $p1 = new WP_Post( (object) array( 'post_title' => 'Foo1' ) );
  • tests/phpunit/tests/adminbar.php

     
    3131
    3232        /**
    3333         * @ticket 21117
     34         *
     35         * @covers WP_Admin_Bar::get_nodes
    3436         */
    3537        function test_content_post_type() {
    3638                wp_set_current_user( self::$editor_id );
     
    5052
    5153        /**
    5254         * @ticket 21117
     55         *
     56         * @covers WP_Admin_Bar::add_node
    5357         */
    5458        function test_merging_existing_meta_values() {
    5559                wp_set_current_user( self::$editor_id );
     
    8690        /**
    8791         * @ticket 25162
    8892         * @group ms-excluded
     93         *
     94         * @covers ::_wp_admin_bar_init
    8995         */
    9096        public function test_admin_bar_contains_correct_links_for_users_with_no_role() {
    9197                $this->assertFalse( user_can( self::$no_role_id, 'read' ) );
     
    111117        /**
    112118         * @ticket 25162
    113119         * @group ms-excluded
     120         *
     121         * @covers ::_wp_admin_bar_init
    114122         */
    115123        public function test_admin_bar_contains_correct_links_for_users_with_role() {
    116124                $this->assertTrue( user_can( self::$editor_id, 'read' ) );
     
    139147         * @ticket 25162
    140148         * @group multisite
    141149         * @group ms-required
     150         *
     151         * @covers ::_wp_admin_bar_init
    142152         */
    143153        public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_blog() {
    144154                $blog_id = self::factory()->blog->create(
     
    188198         * @ticket 25162
    189199         * @group multisite
    190200         * @group ms-required
     201         *
     202         * @covers ::_wp_admin_bar_init
    191203         */
    192204        public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_network() {
    193205                $this->assertTrue( user_can( self::$admin_id, 'read' ) );
     
    239251                restore_current_blog();
    240252        }
    241253
     254        /**
     255         * @return mixed
     256         */
    242257        protected function get_standard_admin_bar() {
    243258                global $wp_admin_bar;
    244259
     
    259274         *
    260275         * @param array  $node_data     The data for a node, passed to `WP_Admin_Bar::add_node()`.
    261276         * @param string $expected_html The expected HTML when admin menu is rendered.
     277         *
     278         * @covers WP_Admin_Bar::add_node
    262279         */
    263280        public function test_admin_bar_with_tabindex_meta( $node_data, $expected_html ) {
    264281                $admin_bar = new WP_Admin_Bar();
     
    347364
    348365        /**
    349366         * @ticket 22247
     367         *
     368         * @covers ::_wp_admin_bar_init
     369         * @covers WP_Admin_Bar::get_node
    350370         */
    351371        public function test_admin_bar_has_edit_link_for_existing_posts() {
    352372                wp_set_current_user( self::$editor_id );
     
    374394
    375395        /**
    376396         * @ticket 22247
     397         *
     398         * @covers WP_Admin_Bar::get_node
    377399         */
    378400        public function test_admin_bar_has_no_edit_link_for_non_existing_posts() {
    379401                wp_set_current_user( self::$editor_id );
     
    393415
    394416        /**
    395417         * @ticket 34113
     418         *
     419         * @covers WP_Admin_Bar::get_node
    396420         */
    397421        public function test_admin_bar_has_no_archives_link_if_no_static_front_page() {
    398422                set_current_screen( 'edit-post' );
     
    407431
    408432        /**
    409433         * @ticket 34113
     434         *
     435         * @covers WP_Admin_Bar::get_node
    410436         */
    411437        public function test_admin_bar_contains_view_archive_link_if_static_front_page() {
    412438                update_option( 'show_on_front', 'page' );
     
    422448
    423449        /**
    424450         * @ticket 34113
     451         *
     452         * @covers WP_Admin_Bar::get_node
    425453         */
    426454        public function test_admin_bar_has_no_archives_link_for_pages() {
    427455                set_current_screen( 'edit-page' );
     
    437465        /**
    438466         * @ticket 37949
    439467         * @group ms-excluded
     468         *
     469         * @covers WP_Admin_Bar::get_node
    440470         */
    441471        public function test_admin_bar_contains_correct_about_link_for_users_with_role() {
    442472                wp_set_current_user( self::$editor_id );
     
    454484        /**
    455485         * @ticket 37949
    456486         * @group ms-excluded
     487         *
     488         * @covers WP_Admin_Bar::get_node
    457489         */
    458490        public function test_admin_bar_contains_correct_about_link_for_users_with_no_role() {
    459491                wp_set_current_user( self::$no_role_id );
     
    473505         * @ticket 37949
    474506         * @group multisite
    475507         * @group ms-required
     508         *
     509         * @covers WP_Admin_Bar::get_node
    476510         */
    477511        public function test_admin_bar_contains_correct_about_link_for_users_with_no_role_in_multisite() {
    478512                // User is not a member of a site.
     
    492526
    493527        /**
    494528         * @ticket 34113
     529         *
     530         * @covers WP_Admin_Bar::get_node
    495531         */
    496532        public function test_admin_bar_has_no_archives_link_for_non_public_cpt() {
    497533                register_post_type(
     
    516552
    517553        /**
    518554         * @ticket 34113
     555         *
     556         * @covers WP_Admin_Bar::get_node
    519557         */
    520558        public function test_admin_bar_has_no_archives_link_for_cpt_without_archive() {
    521559                register_post_type(
     
    540578
    541579        /**
    542580         * @ticket 34113
     581         *
     582         * @covers WP_Admin_Bar::get_node
    543583         */
    544584        public function test_admin_bar_has_no_archives_link_for_cpt_not_shown_in_admin_bar() {
    545585                register_post_type(
     
    596636
    597637        /**
    598638         * @ticket 39252
     639         *
     640         * @covers WP_Admin_Bar::get_node
    599641         */
    600642        public function test_new_user_link_exists_for_user_with_create_users() {
    601643                wp_set_current_user( self::$admin_id );
     
    615657
    616658        /**
    617659         * @ticket 39252
     660         *
     661         * @covers WP_Admin_Bar::get_node
    618662         */
    619663        public function test_new_user_link_existence_for_user_with_promote_users() {
    620664                wp_set_current_user( self::$admin_id );
     
    638682
    639683        /**
    640684         * @ticket 39252
     685         *
     686         * @covers WP_Admin_Bar::get_node
    641687         */
    642688        public function test_new_user_link_does_not_exist_for_user_without_create_or_promote_users() {
    643689                wp_set_current_user( self::$admin_id );
     
    657703        /**
    658704         * @ticket 30937
    659705         * @covers ::wp_admin_bar_customize_menu
     706         *
     707         * @covers WP_Admin_Bar::get_node
    660708         */
    661709        public function test_customize_link() {
    662710                global $wp_customize;
     
    694742        /**
    695743         * @ticket 39082
    696744         * @group ms-required
     745         *
     746         * @covers WP_Admin_Bar::get_nodes
    697747         */
    698748        public function test_my_sites_network_menu_for_regular_user() {
    699749                wp_set_current_user( self::$editor_id );
     
    709759        /**
    710760         * @ticket 39082
    711761         * @group ms-required
     762         *
     763         * @covers WP_Admin_Bar::get_nodes
    712764         */
    713765        public function test_my_sites_network_menu_for_super_admin() {
    714766                wp_set_current_user( self::$editor_id );
     
    726778        /**
    727779         * @ticket 39082
    728780         * @group ms-required
     781         *
     782         * @covers WP_Admin_Bar::get_nodes
    729783         */
    730784        public function test_my_sites_network_menu_for_regular_user_with_network_caps() {
    731785                global $current_user;
  • tests/phpunit/tests/auth.php

     
    3535                wp_set_current_user( self::$user_id );
    3636        }
    3737
     38        /**
     39         * @covers ::wp_validate_auth_cookie
     40         */
    3841        function test_auth_cookie_valid() {
    3942                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'auth' );
    4043                $this->assertEquals( self::$user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );
    4144        }
    4245
     46        /**
     47         * @covers ::wp_validate_auth_cookie
     48         */
    4349        function test_auth_cookie_invalid() {
    4450                // 3600 or less and +3600 may occur in wp_validate_auth_cookie(),
    4551                // as an ajax test may have defined DOING_AJAX, failing the test.
     
    5662                $this->assertEquals( false, wp_validate_auth_cookie( self::$user_id, 'auth' ), 'altered cookie' );
    5763        }
    5864
     65        /**
     66         * @covers ::wp_validate_auth_cookie
     67         */
    5968        function test_auth_cookie_scheme() {
    6069                // Arbitrary scheme name.
    6170                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' );
     
    6877
    6978        /**
    7079         * @ticket 23494
     80         *
     81         * @covers ::wp_authenticate
    7182         */
    7283        function test_password_trimming() {
    7384                $passwords_to_test = array(
     
    93104         * wp_hash_password function
    94105         *
    95106         * @ticket 24973
     107         *
     108         * @covers ::wp_hash_password
    96109         */
    97110        function test_wp_hash_password_trimming() {
    98111
    99112                $password = ' pass with leading whitespace';
    100                 $this->assertTrue( wp_check_password( 'pass with leading whitespace', wp_hash_password( $password ) ) );
     113                $this->assertTrue( wp_check_password( 'pass with leading whitespace', ( $password ) ) );
    101114
    102115                $password = 'pass with trailing whitespace ';
    103116                $this->assertTrue( wp_check_password( 'pass with trailing whitespace', wp_hash_password( $password ) ) );
     
    114127
    115128        /**
    116129         * @ticket 29217
     130         *
     131         * @covers ::wp_verify_nonce
    117132         */
    118133        function test_wp_verify_nonce_with_empty_arg() {
    119134                $this->assertFalse( wp_verify_nonce( '' ) );
     
    122137
    123138        /**
    124139         * @ticket 29542
     140         *
     141         * @covers ::wp_verify_nonce
    125142         */
    126143        function test_wp_verify_nonce_with_integer_arg() {
    127144                $this->assertFalse( wp_verify_nonce( 1 ) );
     
    129146
    130147        /**
    131148         * @ticket 24030
     149         *
     150         * @covers ::wp_verify_nonce
    132151         */
    133152        function test_wp_nonce_verify_failed() {
    134153                $nonce = substr( md5( uniqid() ), 0, 10 );
     
    141160
    142161        /**
    143162         * @ticket 24030
     163         *
     164         * @covers ::wp_verify_nonce
    144165         */
    145166        function test_wp_nonce_verify_success() {
    146167                $nonce = wp_create_nonce( 'nonce_test_action' );
     
    153174
    154175        /**
    155176         * @ticket 36361
     177         *
     178         * @covers ::check_admin_referer
    156179         */
    157180        public function test_check_admin_referer_with_no_action_triggers_doing_it_wrong() {
    158181                $this->setExpectedIncorrectUsage( 'check_admin_referer' );
     
    165188                unset( $_REQUEST['_wpnonce'] );
    166189        }
    167190
     191        /**
     192         * @covers ::check_admin_referer
     193         */
    168194        public function test_check_admin_referer_with_default_action_as_string_not_doing_it_wrong() {
    169195                // A valid nonce needs to be set so the check doesn't die().
    170196                $_REQUEST['_wpnonce'] = wp_create_nonce( '-1' );
     
    176202
    177203        /**
    178204         * @ticket 36361
     205        /**
     206         *
     207         * @c    *
     208         * @covers ::check_ajax_referer
    179209         */
    180210        public function test_check_ajax_referer_with_no_action_triggers_doing_it_wrong() {
    181211                $this->setExpectedIncorrectUsage( 'check_ajax_referer' );
     
    188218                unset( $_REQUEST['_wpnonce'] );
    189219        }
    190220
     221        /**
     222         * @covers ::wp_authenticate
     223         */
    191224        function test_password_length_limit() {
    192225                $limit = str_repeat( 'a', 4096 );
    193226
     
    237270
    238271        /**
    239272         * @ticket 45746
     273         *
     274         * @covers ::check_password_reset_key
    240275         */
    241276        function test_user_activation_key_is_saved() {
    242277                $user = get_userdata( $this->user->ID );
     
    251286
    252287        /**
    253288         * @ticket 32429
     289         *
     290         * @covers ::check_password_reset_key
    254291         */
    255292        function test_user_activation_key_is_checked() {
    256293                global $wpdb;
     
    289326
    290327        /**
    291328         * @ticket 32429
     329         *
     330         * @covers ::check_password_reset_key
    292331         */
    293332        function test_expired_user_activation_key_is_rejected() {
    294333                global $wpdb;
     
    312351
    313352        /**
    314353         * @ticket 32429
     354         *
     355         * @covers ::check_password_reset_key
    315356         */
    316357        function test_empty_user_activation_key_fails_key_check() {
    317358                // An empty user_activation_key should not allow any key to be accepted.
     
    325366
    326367        /**
    327368         * @ticket 32429
     369         *
     370         * @covers ::check_password_reset_key
    328371         */
    329372        function test_legacy_user_activation_key_is_rejected() {
    330373                global $wpdb;
     
    355398        /**
    356399         * @ticket 32429
    357400         * @ticket 24783
     401         *
     402         * @covers ::check_password_reset_key
    358403         */
    359404        function test_plaintext_user_activation_key_is_rejected() {
    360405                global $wpdb;
     
    386431         * Ensure users can log in using both their username and their email address.
    387432         *
    388433         * @ticket 9568
     434         *
     435         * @covers ::wp_authenticate
    389436         */
    390437        public function test_log_in_using_email() {
    391438                $user_args = array(
     
    401448
    402449        /**
    403450         * @ticket 38744
     451         *
     452         * @covers ::wp_signon
    404453         */
    405454        public function test_wp_signon_using_email_with_an_apostrophe() {
    406455                $user_args = array(
  • tests/phpunit/tests/avatar.php

     
    88class Tests_Avatar extends WP_UnitTestCase {
    99        /**
    1010         * @ticket 21195
     11         *
     12         * @covers ::get_avatar_url
    1113         */
    1214        public function test_get_avatar_url_gravatar_url() {
    1315                $url = get_avatar_url( 1 );
     
    1618
    1719        /**
    1820         * @ticket 21195
     21         *
     22         * @covers ::get_avatar_url
    1923         */
    2024        public function test_get_avatar_url_size() {
    2125                $url = get_avatar_url( 1 );
     
    2832
    2933        /**
    3034         * @ticket 21195
     35         *
     36         * @covers ::get_avatar_url
    3137         */
    3238        public function test_get_avatar_url_default() {
    3339                $url = get_avatar_url( 1 );
     
    4551
    4652        /**
    4753         * @ticket 21195
     54         *
     55         * @covers ::get_avatar_url
    4856         */
    4957        public function test_get_avatar_url_rating() {
    5058                $url = get_avatar_url( 1 );
     
    5765
    5866        /**
    5967         * @ticket 21195
     68         *
     69         * @covers ::get_avatar_url
    6070         */
    6171        public function test_get_avatar_url_scheme() {
    6272                $url = get_avatar_url( 1 );
     
    7383
    7484        /**
    7585         * @ticket 21195
     86         *
     87         * @covers ::get_avatar_url
    7688         */
    7789        public function test_get_avatar_url_user() {
    7890                $url = get_avatar_url( 1 );
     
    106118        protected $fake_url;
    107119        /**
    108120         * @ticket 21195
     121         *
     122         * @covers ::get_avatar_url
    109123         */
    110124        public function test_pre_get_avatar_url_filter() {
    111125                $this->fake_url = 'haha wat';
     
    116130
    117131                $this->assertEquals( $url, $this->fake_url );
    118132        }
     133
    119134        public function pre_get_avatar_url_filter( $args ) {
    120135                $args['url'] = $this->fake_url;
    121136                return $args;
     
    123138
    124139        /**
    125140         * @ticket 21195
     141         *
     142         * @covers ::get_avatar_url
    126143         */
    127144        public function test_get_avatar_url_filter() {
    128145                $this->fake_url = 'omg lol';
     
    139156
    140157        /**
    141158         * @ticket 21195
     159         *
     160         * @covers ::get_avatar_url
    142161         */
    143162        public function test_get_avatar_comment_types_filter() {
    144163                $url = get_avatar_url( 1 );
     
    167186                return $comment_types;
    168187        }
    169188
     189        /**
     190         * @covers ::get_avatar
     191         */
    170192        public function test_get_avatar() {
    171193                $img = get_avatar( 1 );
    172194                $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' srcset='[^']*' class='[^']*' height='[^']*' width='[^']*' loading='lazy'/>$|", $img ), 1 );
    173195        }
    174196
     197        /**
     198         * @covers ::get_avatar
     199         */
    175200        public function test_get_avatar_size() {
    176201                $size = '100';
    177202                $img  = get_avatar( 1, $size );
     
    178203                $this->assertEquals( preg_match( "|^<img .*height='$size'.*width='$size'|", $img ), 1 );
    179204        }
    180205
     206        /**
     207         * @covers ::get_avatar
     208         */
    181209        public function test_get_avatar_alt() {
    182210                $alt = 'Mr Hyde';
    183211                $img = get_avatar( 1, 96, '', $alt );
     
    184212                $this->assertEquals( preg_match( "|^<img alt='$alt'|", $img ), 1 );
    185213        }
    186214
     215        /**
     216         * @covers ::get_avatar
     217         */
    187218        public function test_get_avatar_class() {
    188219                $class = 'first';
    189220                $img   = get_avatar( 1, 96, '', '', array( 'class' => $class ) );
     
    190221                $this->assertEquals( preg_match( "|^<img .*class='[^']*{$class}[^']*'|", $img ), 1 );
    191222        }
    192223
     224        /**
     225         * @covers ::get_avatar
     226         */
    193227        public function test_get_avatar_default_class() {
    194228                $img = get_avatar( 1, 96, '', '', array( 'force_default' => true ) );
    195229                $this->assertEquals( preg_match( "|^<img .*class='[^']*avatar-default[^']*'|", $img ), 1 );
    196230        }
    197231
     232        /**
     233         * @covers ::get_avatar
     234         */
    198235        public function test_get_avatar_force_display() {
    199236                $old = get_option( 'show_avatars' );
    200237                update_option( 'show_avatars', false );
     
    210247        protected $fake_img;
    211248        /**
    212249         * @ticket 21195
     250         *
     251         * @covers ::get_avatar
    213252         */
    214253        public function test_pre_get_avatar_filter() {
    215254                $this->fake_img = 'YOU TOO?!';
     
    226265
    227266        /**
    228267         * @ticket 21195
     268         *
     269         * @covers ::get_avatar
    229270         */
    230271        public function test_get_avatar_filter() {
    231272                $this->fake_url = 'YA RLY';
     
    244285         * The `get_avatar_data()` function should return gravatar url when comment type allowed to retrieve avatars.
    245286         *
    246287         * @ticket 44033
     288         *
     289         * @covers ::is_avatar_comment_type
     290         * @covers ::get_avatar
    247291         */
    248292        public function test_get_avatar_data_should_return_gravatar_url_when_input_avatar_comment_type() {
    249293                $comment_type = 'comment';
     
    264308         * The `get_avatar_data()` function should return invalid url when comment type not allowed to retrieve avatars.
    265309         *
    266310         * @ticket 44033
     311         *
     312         * @covers ::is_avatar_comment_type
     313         * @covers ::get_avatar
    267314         */
    268315        public function test_get_avatar_data_should_return_invalid_url_when_input_not_avatar_comment_type() {
    269316                $comment_type = 'review';
  • tests/phpunit/tests/basic.php

     
    33/**
    44 * just make sure the test framework is working
    55 *
     6 * No Covers as this checks for content in files
     7 *
    68 * @group testsuite
    79 */
    810class Tests_Basic extends WP_UnitTestCase {
    911
     12        /**
     13         * @coversNothing
     14         */
    1015        function test_license() {
    1116                // This test is designed to only run on trunk/master.
    1217                $this->skipOnAutomatedBranches();
     
    1722                $this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." );
    1823        }
    1924
     25        /**
     26         * @coversNothing
     27         */
    2028        function test_security_md() {
    2129                // This test is designed to only run on trunk/master.
    2230                $this->skipOnAutomatedBranches();
     
    2836                $this->assertEquals( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." );
    2937        }
    3038
     39        /**
     40         * @coversNothing
     41         */
    3142        function test_package_json() {
    3243                $package_json    = file_get_contents( dirname( ABSPATH ) . '/package.json' );
    3344                $package_json    = json_decode( $package_json, true );
     
    4253
    4354        /**
    4455         * @depends test_package_json
     56         *
     57         * @coversNothing
    4558         */
    4659        function test_package_json_node_engine( $package_json ) {
    4760                $this->assertArrayHasKey( 'engines', $package_json );
     
    5063                $this->assertRegExp( '~^=?\d+\.\d+\.\d+$~', $node, "package.json's node version cannot be a range." );
    5164        }
    5265
    53         // Test some helper utility functions.
    54 
     66        /**
     67         * Test some helper utility functions.
     68         *
     69         * @coversNothing
     70         */
    5571        function test_strip_ws() {
    5672                $this->assertEquals( '', strip_ws( '' ) );
    5773                $this->assertEquals( 'foo', strip_ws( 'foo' ) );
     
    7995
    8096        }
    8197
     98        /**
     99         * @coversNothing
     100         */
    82101        function test_mask_input_value() {
    83102                $in = <<<EOF
    84103<h2>Assign Authors</h2>
  • tests/phpunit/tests/cache.php

     
    2626                return $cache;
    2727        }
    2828
     29        /**
     30         *
     31         * @covers WP_Object_Cache::test_miss
     32         */
    2933        function test_miss() {
    3034                $this->assertEquals( null, $this->cache->get( 'test_miss' ) );
    3135        }
    3236
     37        /**
     38         *
     39         * @covers WP_Object_Cache::add
     40         */
    3341        function test_add_get() {
    3442                $key = __FUNCTION__;
    3543                $val = 'val';
     
    3846                $this->assertEquals( $val, $this->cache->get( $key ) );
    3947        }
    4048
     49        /**
     50         *
     51         * @covers WP_Object_Cache::add
     52         */
    4153        function test_add_get_0() {
    4254                $key = __FUNCTION__;
    4355                $val = 0;
     
    4759                $this->assertEquals( $val, $this->cache->get( $key ) );
    4860        }
    4961
     62        /**
     63         *
     64         * @covers WP_Object_Cache::add
     65         */
    5066        function test_add_get_null() {
    5167                $key = __FUNCTION__;
    5268                $val = null;
     
    5672                $this->assertEquals( '', $this->cache->get( $key ) );
    5773        }
    5874
     75        /**
     76         *
     77         * @covers WP_Object_Cache::add
     78         */
    5979        function test_add() {
    6080                $key  = __FUNCTION__;
    6181                $val1 = 'val1';
     
    6989                $this->assertEquals( $val1, $this->cache->get( $key ) );
    7090        }
    7191
     92        /**
     93         *
     94         * @covers WP_Object_Cache::replace
     95         */
    7296        function test_replace() {
    7397                $key  = __FUNCTION__;
    7498                $val  = 'val1';
     
    83107                $this->assertEquals( $val2, $this->cache->get( $key ) );
    84108        }
    85109
     110        /**
     111         *
     112         * @covers WP_Object_Cache::set
     113         */
    86114        function test_set() {
    87115                $key  = __FUNCTION__;
    88116                $val1 = 'val1';
     
    96124                $this->assertEquals( $val2, $this->cache->get( $key ) );
    97125        }
    98126
     127        /**
     128         *
     129         * @covers WP_Object_Cache::flush
     130         */
    99131        function test_flush() {
    100132                global $_wp_using_ext_object_cache;
    101133
     
    114146                $this->assertFalse( $this->cache->get( $key ) );
    115147        }
    116148
    117         // Make sure objects are cloned going to and from the cache.
     149        /**
     150         * Make sure objects are cloned going to and from the cache.
     151         *
     152         * @covers WP_Object_Cache::set
     153         * @covers WP_Object_Cache::get
     154         */
    118155        function test_object_refs() {
    119156                $key           = __FUNCTION__ . '_1';
    120157                $object_a      = new stdClass;
     
    137174                $this->assertEquals( 'bravo', $object_a->foo );
    138175        }
    139176
     177        /**
     178         *
     179         * @covers WP_Object_Cache::incr
     180         */
    140181        function test_incr() {
    141182                $key = __FUNCTION__;
    142183
     
    150191                $this->assertEquals( 3, $this->cache->get( $key ) );
    151192        }
    152193
     194        /**
     195         *
     196         * @covers ::wp_cache_incr
     197         */
    153198        function test_wp_cache_incr() {
    154199                $key = __FUNCTION__;
    155200
     
    163208                $this->assertEquals( 3, wp_cache_get( $key ) );
    164209        }
    165210
     211        /**
     212         *
     213         * @covers WP_Object_Cache::decr
     214         */
    166215        function test_decr() {
    167216                $key = __FUNCTION__;
    168217
     
    182231
    183232        /**
    184233         * @ticket 21327
     234         *
     235         * @covers ::wp_cache_decr
    185236         */
    186237        function test_wp_cache_decr() {
    187238                $key = __FUNCTION__;
     
    200251                $this->assertEquals( 0, wp_cache_get( $key ) );
    201252        }
    202253
     254        /**
     255         *
     256         * @covers WP_Object_Cache::delete
     257         */
    203258        function test_delete() {
    204259                $key = __FUNCTION__;
    205260                $val = 'val';
     
    215270                $this->assertFalse( $this->cache->delete( $key, 'default' ) );
    216271        }
    217272
     273        /**
     274         *
     275         * @covers ::wp_cache_delete
     276         * @covers ::wp_cache_get
     277         * @covers ::wp_cache_set
     278         */
    218279        function test_wp_cache_delete() {
    219280                $key = __FUNCTION__;
    220281                $val = 'val';
     
    234295                $this->assertFalse( wp_cache_delete( $key, 'default' ) );
    235296        }
    236297
     298        /**
     299         *
     300         * @covers WP_Object_Cache::switch_to_blog
     301         */
    237302        function test_switch_to_blog() {
    238303                if ( ! method_exists( $this->cache, 'switch_to_blog' ) ) {
    239304                        return;
     
    280345                $this->assertEquals( $val2, $this->cache->get( $key, 'global-cache-test' ) );
    281346        }
    282347
     348        /**
     349         *
     350         * @covers ::wp_cache_init
     351         */
    283352        function test_wp_cache_init() {
    284353                $new_blank_cache_object = new WP_Object_Cache();
    285354                wp_cache_init();
     
    294363                }
    295364        }
    296365
     366        /**
     367         *
     368         * @covers ::wp_cache_replace
     369         */
    297370        function test_wp_cache_replace() {
    298371                $key  = 'my-key';
    299372                $val1 = 'first-val';
     
    318391
    319392        /**
    320393         * @ticket 20875
     394         *
     395         * @covers ::wp_cache_get_multiple
    321396         */
    322397        public function test_get_multiple() {
    323398                wp_cache_set( 'foo1', 'bar', 'group1' );
  • tests/phpunit/tests/canonical.php

     
    1717
    1818        /**
    1919         * @dataProvider data_canonical
     20         *
     21         * @covers ::redirect_canonical
    2022         */
    2123        function test_canonical( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) {
    2224
     
    232234
    233235        /**
    234236         * @ticket 16557
     237         *
     238         * @covers ::redirect_guess_404_permalink
    235239         */
    236240        public function test_do_redirect_guess_404_permalink() {
    237241                // Test disable do_redirect_guess_404_permalink().
     
    242246
    243247        /**
    244248         * @ticket 16557
     249         *
     250         * @covers ::redirect_guess_404_permalink
    245251         */
    246252        public function test_pre_redirect_guess_404_permalink() {
    247253                // Test short-circuit filter.
     
    257263
    258264        /**
    259265         * @ticket 16557
     266         *
     267         * @covers ::redirect_guess_404_permalink
    260268         */
    261269        public function test_strict_redirect_guess_404_permalink() {
    262270                $post = self::factory()->post->create(
     
    277285
    278286        /**
    279287         * @ticket 43745
     288         *
     289         * @covers ::redirect_canonical
    280290         */
    281291        public function test_utf8_query_keys_canonical() {
    282292                $p = self::factory()->post->create(
  • tests/phpunit/tests/category.php

     
    1818         * Validate get_all_category_ids
    1919         *
    2020         * @expectedDeprecated get_all_category_ids
     21         *
     22         * @covers ::get_all_category_ids
    2123         */
    2224        function test_get_all_category_ids() {
    2325                // Ccreate categories.
     
    3436
    3537        /**
    3638         * Validate get_category_by_slug function
     39         *
     40         * @covers ::get_category_by_slug
    3741         */
    3842        function test_get_category_by_slug() {
    3943
     
    6468
    6569        /**
    6670         * Validate _make_cat_compat function
     71         *
     72         * @covers ::_make_cat_compat
    6773         */
    6874        function test__make_cat_compat() {
    6975
     
    141147
    142148        /**
    143149         * Validate get_cat_name function
     150         *
     151         * @covers ::get_cat_name
    144152         */
    145153        function test_get_cat_name() {
    146154
     
    161169
    162170        /**
    163171         * Validate get_cat_name function
     172         *
     173         * @covers ::get_cat_ID
    164174         */
    165175        function test_get_cat_ID() {
    166176
     
    181191
    182192        /**
    183193         * Validate get_category_by_path function
     194         *
     195         * @covers ::get_category_by_path
    184196         */
    185197        function test_get_category_by_path() {
    186198
  • tests/phpunit/tests/comment-submission.php

     
    3939                require_once ABSPATH . WPINC . '/class-phpass.php';
    4040        }
    4141
     42        /**
     43         * @covers ::wp_handle_comment_submission
     44         */
    4245        public function test_submitting_comment_to_invalid_post_returns_error() {
    4346                $error = 'comment_id_not_found';
    4447
     
    5558
    5659        }
    5760
     61        /**
     62         * @covers ::wp_handle_comment_submission
     63         */
    5864        public function test_submitting_comment_to_post_with_closed_comments_returns_error() {
    5965
    6066                $error = 'comment_closed';
     
    7884
    7985        }
    8086
     87        /**
     88         * @covers ::wp_handle_comment_submission
     89         */
    8190        public function test_submitting_comment_to_trashed_post_returns_error() {
    8291
    8392                $error = 'comment_on_trash';
     
    99108
    100109        }
    101110
     111        /**
     112         * @covers ::wp_handle_comment_submission
     113         */
    102114        public function test_submitting_comment_to_draft_post_returns_error() {
    103115                $error = 'comment_on_draft';
    104116
     
    124136
    125137        /**
    126138         * @ticket 39650
     139         *
     140         * @covers ::wp_handle_comment_submission
    127141         */
    128142        public function test_submitting_comment_to_draft_post_returns_error_message_for_user_with_correct_caps() {
    129143                $error = 'comment_on_draft';
     
    150164                $this->assertNotEmpty( $comment->get_error_message() );
    151165        }
    152166
     167        /**
     168         * @covers ::wp_handle_comment_submission
     169         */
    153170        public function test_submitting_comment_to_scheduled_post_returns_error() {
    154171
    155172                // Same error as commenting on a draft.
     
    176193
    177194        }
    178195
     196        /**
     197         * @covers ::wp_handle_comment_submission
     198         */
    179199        public function test_submitting_comment_to_password_required_post_returns_error() {
    180200
    181201                $error = 'comment_on_password_protected';
     
    199219
    200220        }
    201221
     222        /**
     223         * @covers ::wp_handle_comment_submission
     224         */
    202225        public function test_submitting_comment_to_password_protected_post_succeeds() {
    203226
    204227                $password = 'password';
     
    227250
    228251        }
    229252
     253        /**
     254         * @covers ::wp_handle_comment_submission
     255         */
    230256        public function test_submitting_valid_comment_as_logged_in_user_succeeds() {
    231257
    232258                $user = self::factory()->user->create_and_get(
     
    254280
    255281        }
    256282
     283        /**
     284         * @covers ::wp_handle_comment_submission
     285         */
    257286        public function test_submitting_valid_comment_anonymously_succeeds() {
    258287
    259288                $data    = array(
     
    280309         * wp_handle_comment_submission() expects un-slashed data.
    281310         *
    282311         * @group slashes
     312         *
     313         * @covers ::wp_handle_comment_submission
    283314         */
    284315        public function test_submitting_comment_handles_slashes_correctly_handles_slashes() {
    285316
     
    300331
    301332        }
    302333
     334        /**
     335         * @covers ::wp_handle_comment_submission
     336         */
    303337        public function test_submitting_comment_anonymously_to_private_post_returns_error() {
    304338
    305339                $error = 'comment_id_not_found';
     
    321355
    322356        }
    323357
     358        /**
     359         * @covers ::wp_handle_comment_submission
     360         */
    324361        public function test_submitting_comment_as_logged_in_user_to_inaccessible_private_post_returns_error() {
    325362
    326363                $error = 'comment_id_not_found';
     
    351388
    352389        }
    353390
     391        /**
     392         * @covers ::wp_handle_comment_submission
     393         */
    354394        public function test_submitting_comment_to_private_post_with_closed_comments_returns_correct_error() {
    355395
    356396                $error = 'comment_id_not_found';
     
    382422
    383423        }
    384424
     425        /**
     426         * @covers ::wp_handle_comment_submission
     427         */
    385428        public function test_submitting_comment_to_own_private_post_succeeds() {
    386429
    387430                wp_set_current_user( self::$author_id );
     
    405448
    406449        }
    407450
     451        /**
     452         * @covers ::wp_handle_comment_submission
     453         */
    408454        public function test_submitting_comment_to_accessible_private_post_succeeds() {
    409455
    410456                wp_set_current_user( self::$editor_id );
     
    428474
    429475        }
    430476
     477        /**
     478         * @covers ::wp_handle_comment_submission
     479         */
    431480        public function test_anonymous_user_cannot_comment_unfiltered_html() {
    432481
    433482                $data    = array(
     
    444493
    445494        }
    446495
     496        /**
     497         * @covers ::wp_handle_comment_submission
     498         */
    447499        public function test_unprivileged_user_cannot_comment_unfiltered_html() {
    448500
    449501                wp_set_current_user( self::$author_id );
     
    462514
    463515        }
    464516
     517        /**
     518         * @covers ::wp_handle_comment_submission
     519         */
    465520        public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() {
    466521
    467522                wp_set_current_user( self::$author_id );
     
    486541
    487542        }
    488543
     544        /**
     545         * @covers ::wp_handle_comment_submission
     546         */
    489547        public function test_privileged_user_can_comment_unfiltered_html_with_valid_nonce() {
    490548
    491549                $this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) );
     
    518576
    519577        }
    520578
     579        /**
     580         * @covers ::wp_handle_comment_submission
     581         */
    521582        public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() {
    522583
    523584                if ( is_multisite() ) {
     
    542603
    543604        }
    544605
     606        /**
     607         * @covers ::wp_handle_comment_submission
     608         */
    545609        public function test_submitting_comment_as_anonymous_user_when_registration_required_returns_error() {
    546610
    547611                $error = 'not_logged_in';
     
    561625
    562626        }
    563627
     628        /**
     629         * @covers ::wp_handle_comment_submission
     630         */
    564631        public function test_submitting_comment_with_no_name_when_name_email_required_returns_error() {
    565632
    566633                $error = 'require_name_email';
     
    582649
    583650        }
    584651
     652        /**
     653         * @covers ::wp_handle_comment_submission
     654         */
    585655        public function test_submitting_comment_with_no_email_when_name_email_required_returns_error() {
    586656
    587657                $error = 'require_name_email';
     
    603673
    604674        }
    605675
     676        /**
     677         * @covers ::wp_handle_comment_submission
     678         */
    606679        public function test_submitting_comment_with_invalid_email_when_name_email_required_returns_error() {
    607680
    608681                $error = 'require_valid_email';
     
    625698
    626699        }
    627700
     701        /**
     702         * @covers ::wp_handle_comment_submission
     703         */
    628704        public function test_submitting_comment_with_no_comment_content_returns_error() {
    629705
    630706                $error = 'require_valid_comment';
     
    644720
    645721        /**
    646722         * @ticket 10377
     723         *
     724         * @covers ::wp_handle_comment_submission
    647725         */
    648726        public function test_submitting_comment_with_content_too_long_returns_error() {
    649727                $error = 'comment_content_column_length';
     
    662740
    663741        /**
    664742         * @ticket 10377
     743         *
     744         * @covers ::wp_handle_comment_submission
    665745         */
    666746        public function test_submitting_comment_with_author_too_long_returns_error() {
    667747                $error = 'comment_author_column_length';
     
    680760
    681761        /**
    682762         * @ticket 10377
     763         *
     764         * @covers ::wp_handle_comment_submission
    683765         */
    684766        public function test_submitting_comment_with_email_too_long_returns_error() {
    685767                $error = 'comment_author_email_column_length';
     
    698780
    699781        /**
    700782         * @ticket 10377
     783         *
     784         * @covers ::wp_handle_comment_submission
    701785         */
    702786        public function test_submitting_comment_with_url_too_long_returns_error() {
    703787                $error = 'comment_author_url_column_length';
     
    717801
    718802        /**
    719803         * @ticket 49236
     804         *
     805         * @covers ::wp_handle_comment_submission
    720806         */
    721807        public function test_submitting_comment_with_empty_type_results_in_correct_type() {
    722808                $data    = array(
     
    736822
    737823        /**
    738824         * @ticket 49236
     825         *
     826         * @covers ::wp_handle_comment_submission
    739827         */
    740828        public function test_inserting_comment_with_empty_type_results_in_correct_type() {
    741829                $data       = array(
     
    756844
    757845        /**
    758846         * @ticket 34997
     847         *
     848         * @covers ::wp_handle_comment_submission
    759849         */
    760850        public function test_comment_submission_sends_all_expected_parameters_to_preprocess_comment_filter() {
    761851
     
    798888
    799889        /**
    800890         * @ticket 36901
     891         *
     892         * @covers ::wp_handle_comment_submission
    801893         */
    802894        public function test_submitting_duplicate_comments() {
    803895                $data           = array(
     
    814906
    815907        /**
    816908         * @ticket 36901
     909         *
     910         * @covers ::wp_handle_comment_submission
    817911         */
    818912        public function test_comments_flood() {
    819913                $data          = array(
     
    833927
    834928        /**
    835929         * @ticket 36901
     930         *
     931         * @covers ::wp_handle_comment_submission
    836932         */
    837933        public function test_comments_flood_user_is_admin() {
    838934                $user = self::factory()->user->create_and_get(
  • tests/phpunit/tests/comment.php

     
    3030                );
    3131        }
    3232
     33        /**
     34         *
     35         *
     36         * @covers ::wp_update_comment
     37         */
    3338        public function test_wp_update_comment() {
    3439                $post  = self::factory()->post->create_and_get(
    3540                        array(
     
    7883
    7984        /**
    8085         * @ticket 30627
     86         *
     87         * @covers ::wp_update_comment
    8188         */
    8289        public function test_wp_update_comment_updates_comment_type() {
    8390                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     
    95102
    96103        /**
    97104         * @ticket 36784
     105         *
     106         * @covers ::wp_update_comment
    98107         */
    99108        public function test_wp_update_comment_updates_comment_meta() {
    100109                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     
    114123
    115124        /**
    116125         * @ticket 30307
     126         *
     127         * @covers ::wp_update_comment
    117128         */
    118129        public function test_wp_update_comment_updates_user_id() {
    119130                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     
    131142
    132143        /**
    133144         * @ticket 34954
     145         *
     146         * @covers ::wp_update_comment
    134147         */
    135148        public function test_wp_update_comment_with_no_post_id() {
    136149                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => 0 ) );
     
    152165
    153166        /**
    154167         * @ticket 39732
     168         *
     169         * @covers ::wp_update_comment
    155170         */
    156171        public function test_wp_update_comment_returns_false_for_invalid_comment_or_post_id() {
    157172                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     
    175190
    176191        /**
    177192         * @ticket 39732
     193         *
     194         * @covers ::wp_update_comment
    178195         */
    179196        public function test_wp_update_comment_is_wp_error() {
    180197                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     
    201218                return new WP_Error( 'comment_wrong', 'wp_update_comment_data filter fails for this comment.', 500 );
    202219        }
    203220
     221        /**
     222         *
     223         *
     224         * @covers ::get_approved_comments
     225         */
    204226        public function test_get_approved_comments() {
    205227                $ca1 = self::factory()->comment->create(
    206228                        array(
     
    257279
    258280        /**
    259281         * @ticket 30412
     282         *
     283         * @covers ::get_approved_comments
    260284         */
    261285        public function test_get_approved_comments_with_post_id_0_should_return_empty_array() {
    262286                $ca1 = self::factory()->comment->create(
     
    273297
    274298        /**
    275299         * @ticket 14279
     300         *
     301         * @covers ::wp_new_comment
    276302         */
    277303        public function test_wp_new_comment_respects_dates() {
    278304                $data = array(
     
    296322
    297323        /**
    298324         * @ticket 14601
     325         *
     326         * @covers ::wp_new_comment
    299327         */
    300328        public function test_wp_new_comment_respects_author_ip() {
    301329                $data = array(
     
    317345
    318346        /**
    319347         * @ticket 14601
     348         *
     349         * @covers ::wp_new_comment
    320350         */
    321351        public function test_wp_new_comment_respects_author_ip_empty_string() {
    322352                $data = array(
     
    338368
    339369        /**
    340370         * @ticket 14601
     371         *
     372         * @covers ::wp_new_comment
    341373         */
    342374        public function test_wp_new_comment_respects_comment_agent() {
    343375                $data = array(
     
    360392
    361393        /**
    362394         * @ticket 14601
     395         *
     396         * @covers ::wp_new_comment
    363397         */
    364398        public function test_wp_new_comment_should_trim_provided_comment_agent_to_254_chars() {
    365399                $data = array(
     
    382416
    383417        /**
    384418         * @ticket 14601
     419         *
     420         * @covers ::wp_new_comment
    385421         */
    386422        public function test_wp_new_comment_respects_comment_agent_empty_string() {
    387423                $data = array(
     
    402438                $this->assertEquals( $data['comment_agent'], $comment->comment_agent );
    403439        }
    404440
    405 
     441        /**
     442         * @covers ::wp_new_comment
     443         */
    406444        public function test_comment_field_lengths() {
    407445                $data = array(
    408446                        'comment_post_ID'      => self::$post_id,
     
    424462
    425463        /**
    426464         * @ticket 32566
     465         *
     466         * @covers ::wp_notify_moderator
    427467         */
    428468        public function test_wp_notify_moderator_should_not_throw_notice_when_post_author_is_0() {
    429469                $p = self::factory()->post->create(
     
    441481                $this->assertTrue( wp_notify_moderator( $c ) );
    442482        }
    443483
     484        /**
     485         *
     486         *
     487         * @covers ::wp_new_comment_notify_postauthor
     488         */
    444489        public function test_wp_new_comment_notify_postauthor_should_send_email_when_comment_is_approved() {
    445490                $c = self::factory()->comment->create(
    446491                        array(
     
    452497                $this->assertTrue( $sent );
    453498        }
    454499
     500        /**
     501         *
     502         *
     503         * @covers ::wp_new_comment_notify_postauthor
     504         */
    455505        public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_is_unapproved() {
    456506                $c = self::factory()->comment->create(
    457507                        array(
     
    466516
    467517        /**
    468518         * @ticket 33587
     519         *
     520         * @covers ::wp_new_comment_notify_postauthor
    469521         */
    470522        public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_marked_as_spam() {
    471523                $c = self::factory()->comment->create(
     
    481533
    482534        /**
    483535         * @ticket 35006
     536         *
     537         * @covers ::wp_new_comment_notify_postauthor
    484538         */
    485539        public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_trashed() {
    486540                $c = self::factory()->comment->create(
     
    496550
    497551        /**
    498552         * @ticket 43805
     553         *
     554         * @covers ::wp_new_comment_notify_postauthor
    499555         */
    500556        public function test_wp_new_comment_notify_postauthor_content_should_include_link_to_parent() {
    501557                $c1 = self::factory()->comment->create(
     
    520576
    521577        /**
    522578         * @ticket 43805
     579         *
     580         * @covers ::wp_new_comment_notify_moderator
    523581         */
    524582        public function test_wp_new_comment_notify_moderator_content_should_include_link_to_parent() {
    525583                $c1 = self::factory()->comment->create(
     
    556614
    557615        /**
    558616         * @ticket 12431
     617         *
     618         * @covers ::get_comment_meta
    559619         */
    560620        public function test_wp_new_comment_with_meta() {
    561621                $c = self::factory()->comment->create(
     
    573633
    574634        /**
    575635         * @ticket 8071
     636         *
     637         * @covers WP_Comment::get_children
    576638         */
    577639        public function test_wp_comment_get_children_should_fill_children() {
    578640                $c1 = self::factory()->comment->create(
     
    633695
    634696        /**
    635697         * @ticket 27571
     698         *
     699         * @covers ::get_comment
    636700         */
    637701        public function test_post_properties_should_be_lazyloaded() {
    638702                $c = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     
    684748
    685749        /**
    686750         * @ticket 761
     751         *
     752         * @covers ::wp_new_comment
    687753         */
    688754        public function test_wp_notify_moderator_filter_moderation_notify_option_true_filter_false() {
    689755                $comment_data = $this->setup_notify_comment();
     
    705771
    706772        /**
    707773         * @ticket 761
     774         *
     775         * @covers ::wp_new_comment
    708776         */
    709777        public function test_wp_notify_moderator_filter_moderation_notify_option_false_filter_true() {
    710778                $comment_data = $this->setup_notify_comment();
     
    726794
    727795        /**
    728796         * @ticket 761
     797         *
     798         * @covers ::wp_new_comment
    729799         */
    730800        public function test_wp_notify_post_author_filter_comments_notify_option_true_filter_false() {
    731801
     
    748818
    749819        /**
    750820         * @ticket 761
     821         *
     822         * @covers ::wp_new_comment
    751823         */
    752824        public function test_wp_notify_post_author_filter_comments_notify_option_false_filter_true() {
    753825                $comment_data = $this->setup_notify_comment();
     
    852924                return $email_sent_when_comment_approved || $email_sent_when_comment_added;
    853925        }
    854926
     927        /**
     928         *
     929         *
     930         * @covers ::_close_comments_for_old_post
     931         */
    855932        public function test_close_comments_for_old_post() {
    856933                update_option( 'close_comments_for_old_posts', true );
    857934                // Close comments more than one day old.
     
    867944                $this->assertTrue( $new_post_comment_status );
    868945        }
    869946
     947        /**
     948         *
     949         *
     950         * @covers ::_close_comments_for_old_post
     951         */
    870952        public function test_close_comments_for_old_post_undated_draft() {
    871953                $draft_id             = self::factory()->post->create(
    872954                        array(
     
    881963
    882964        /**
    883965         * @ticket 35276
     966         *
     967         * @covers ::wp_update_comment
    884968         */
    885969        public function test_wp_update_comment_author_id_and_agent() {
    886970
     
    9171001                $this->assertSame( 'SHIELD_AGENT', $updated->comment_agent );
    9181002        }
    9191003
     1004        /**
     1005         * @covers ::wp_get_comment_fields_max_lengths
     1006         */
    9201007        public function test_wp_get_comment_fields_max_lengths() {
    9211008                $expected = array(
    9221009                        'comment_author'       => 245,
     
    9371024         *
    9381025         * @group privacy
    9391026         * @ticket 43442
     1027         *
     1028         * @covers ::wp_comments_personal_data_eraser
    9401029         */
    9411030        public function test_wp_comments_personal_data_eraser() {
    9421031
     
    9941083         *
    9951084         * @group privacy
    9961085         * @ticket 43442
     1086         *
     1087         * @covers ::wp_comments_personal_data_eraser
    9971088         */
    9981089        public function test_wp_comments_personal_data_eraser_empty_first_page_output() {
    9991090
     
    10131104         *
    10141105         * @group privacy
    10151106         * @ticket 43442
     1107         *
     1108         * @covers ::wp_comments_personal_data_eraser
    10161109         */
    10171110        public function test_wp_comments_personal_data_eraser_non_empty_first_page_output() {
    10181111
     
    10451138         *
    10461139         * @group privacy
    10471140         * @ticket 43442
     1141         *
     1142         * @covers ::wp_comments_personal_data_eraser
    10481143         */
    10491144        public function test_wp_comments_personal_data_eraser_empty_second_page_output() {
    10501145
     
    10771172         *
    10781173         * @group privacy
    10791174         * @ticket 43442
     1175         *
     1176         * @covers ::wp_comments_personal_data_eraser
    10801177         */
    10811178        public function test_wp_anonymize_comment_filter_to_prevent_comment_anonymization() {
    10821179
     
    11141211         *
    11151212         * @group privacy
    11161213         * @ticket 43442
     1214         *
     1215         * @covers ::wp_comments_personal_data_eraser
    11171216         */
    11181217        public function test_wp_anonymize_comment_filter_to_prevent_comment_anonymization_with_custom_message() {
    11191218
     
    11791278                $this->assertSame( 'Bar', $comment->comment_author );
    11801279        }
    11811280
     1281        /**
     1282         *
     1283         *
     1284         * @covers ::wp_trash_comment
     1285         */
    11821286        public function test_trash_should_invalidate_comment_cache() {
    11831287                global $wpdb;
    11841288
     
    11931297                $this->assertSame( 'trash', $comment->comment_approved );
    11941298        }
    11951299
     1300        /**
     1301         *
     1302         *
     1303         * @covers ::wp_untrash_comment
     1304         */
    11961305        public function test_untrash_should_invalidate_comment_cache() {
    11971306                global $wpdb;
    11981307
     
    12091318                $this->assertSame( '1', $comment->comment_approved );
    12101319        }
    12111320
     1321        /**
     1322         *
     1323         *
     1324         * @covers ::wp_spam_comment
     1325         */
    12121326        public function test_spam_should_invalidate_comment_cache() {
    12131327                global $wpdb;
    12141328
     
    12231337                $this->assertSame( 'spam', $comment->comment_approved );
    12241338        }
    12251339
     1340        /**
     1341         *
     1342         *
     1343         * @covers ::wp_unspam_comment
     1344         */
    12261345        public function test_unspam_should_invalidate_comment_cache() {
    12271346                global $wpdb;
    12281347
     
    12441363         *
    12451364         * @group privacy
    12461365         * @ticket 43440
     1366         *
     1367         * @covers ::wp_comments_personal_data_exporter
    12471368         */
    12481369        public function test_wp_comments_personal_data_exporter() {
    12491370                $args = array(
     
    12901411         *
    12911412         * @group privacy
    12921413         * @ticket 43440
     1414         *
     1415         * @covers ::wp_comments_personal_data_exporter
    12931416         */
    12941417        public function test_wp_comments_personal_data_exporter_no_comments_found() {
    12951418
     
    13081431         *
    13091432         * @group privacy
    13101433         * @ticket 43440
     1434         *
     1435         * @covers ::wp_comments_personal_data_exporter
    13111436         */
    13121437        public function test_wp_comments_personal_data_exporter_empty_comment_prop() {
    13131438                $args = array(
     
    13391464         *
    13401465         * @group privacy
    13411466         * @ticket 43440
     1467         *
     1468         * @covers ::wp_comments_personal_data_exporter
    13421469         */
    13431470        public function test_wp_comments_personal_data_exporter_empty_second_page() {
    13441471                $args = array(
  • tests/phpunit/tests/compat.php

     
    3434
    3535        /**
    3636         * @dataProvider utf8_string_lengths
     37         *
     38         * @covers ::_mb_strlen
    3739         */
    3840        function test_mb_strlen( $string, $expected_character_length ) {
    3941                $this->assertEquals( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) );
     
    4143
    4244        /**
    4345         * @dataProvider utf8_string_lengths
     46         *
     47         * @covers ::_mb_strlen
    4448         */
    4549        function test_mb_strlen_via_regex( $string, $expected_character_length ) {
    4650                _wp_can_use_pcre_u( false );
     
    5054
    5155        /**
    5256         * @dataProvider utf8_string_lengths
     57         *
     58         * @covers ::_mb_strlen
    5359         */
    5460        function test_8bit_mb_strlen( $string, $expected_character_length, $expected_byte_length ) {
    5561                $this->assertEquals( $expected_byte_length, _mb_strlen( $string, '8bit' ) );
     
    5763
    5864        /**
    5965         * @dataProvider utf8_substrings
     66         *
     67         * @covers ::_mb_substr
    6068         */
    6169        function test_mb_substr( $string, $start, $length, $expected_character_substring ) {
    6270                $this->assertEquals( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) );
     
    6472
    6573        /**
    6674         * @dataProvider utf8_substrings
     75         *
     76         * @covers ::_mb_substr
    6777         */
    6878        function test_mb_substr_via_regex( $string, $start, $length, $expected_character_substring ) {
    6979                _wp_can_use_pcre_u( false );
     
    7383
    7484        /**
    7585         * @dataProvider utf8_substrings
     86         *
     87         * @covers ::_mb_substr
    7688         */
    7789        function test_8bit_mb_substr( $string, $start, $length, $expected_character_substring, $expected_byte_substring ) {
    7890                $this->assertEquals( $expected_byte_substring, _mb_substr( $string, $start, $length, '8bit' ) );
    7991        }
    8092
     93        /**
     94         *
     95         * @covers ::_mb_substr
     96         */
    8197        function test_mb_substr_phpcore() {
    8298                /* https://github.com/php/php-src/blob/php-5.6.8/ext/mbstring/tests/mb_substr_basic.phpt */
    8399                $string_ascii = 'ABCDEF';
     
    164180
    165181        }
    166182
     183        /**
     184         *
     185         * @covers ::_hash_hmac
     186         */
    167187        function test_hash_hmac_simple() {
    168188                $this->assertEquals( '140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac( 'md5', 'simple', 'key' ) );
    169189                $this->assertEquals( '993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac( 'sha1', 'simple', 'key' ) );
    170190        }
    171191
     192        /**
     193         *
     194         * @covers ::_hash_hmac
     195         */
    172196        function test_hash_hmac_padding() {
    173197                $this->assertEquals( '3c1399103807cf12ec38228614416a8c', _hash_hmac( 'md5', 'simple', '65 character key 65 character key 65 character key 65 character k' ) );
    174198                $this->assertEquals( '4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac( 'sha1', 'simple', '65 character key 65 character key 65 character key 65 character k' ) );
    175199        }
    176200
     201        /**
     202         *
     203         * @covers ::_hash_hmac
     204         */
    177205        function test_hash_hmac_output() {
    178206                $this->assertEquals( array( 1 => '140d1cb79fa12e2a31f32d35ad0a2723' ), unpack( 'H32', _hash_hmac( 'md5', 'simple', 'key', true ) ) );
    179207                $this->assertEquals( array( 1 => '993003b95758e0ac2eba451a4c5877eb1bb7b92a' ), unpack( 'H40', _hash_hmac( 'sha1', 'simple', 'key', true ) ) );
     
    181209
    182210        /**
    183211         * @expectedException PHPUnit_Framework_Error_Deprecated
     212         *
     213         * @covers Services_JSON::encodeUnsafe
     214         * @covers Services_JSON::decode
    184215         */
    185216        function test_json_encode_decode() {
    186217                require_once ABSPATH . WPINC . '/class-json.php';
     
    194225         * Test that is_countable() is always available (either from PHP or WP).
    195226         *
    196227         * @ticket 43583
     228         *
     229         * @covers ::is_countable
    197230         */
    198231        function test_is_countable_availability() {
    199232                $this->assertTrue( function_exists( 'is_countable' ) );
     
    208241         *
    209242         * @param mixed $variable     Variable to check.
    210243         * @param bool  $is_countable The expected return value of PHP 7.3 is_countable() function.
     244         *
     245         * @covers ::is_countable
    211246         */
    212247        function test_is_countable_functionality( $variable, $is_countable ) {
    213248                $this->assertSame( is_countable( $variable ), $is_countable );
     
    243278         * Test is_countable() polyfill for ResourceBundle.
    244279         *
    245280         * @ticket 43583
     281         *
     282         * @covers ::is_countable
    246283         */
    247284        function test_is_countable_ResourceBundle() {
    248285                if ( ! class_exists( 'ResourceBundle' ) ) {
     
    256293         * Test is_countable() polyfill for SimpleXMLElement.
    257294         *
    258295         * @ticket 43583
     296         *
     297         * @covers ::is_countable
    259298         */
    260299        function test_is_countable_SimpleXMLElement() {
    261300                if ( ! class_exists( 'SimpleXMLElement' ) ) {
     
    269308         * Test that is_iterable() is always available (either from PHP or WP).
    270309         *
    271310         * @ticket 43619
     311         *
     312         * @covers ::is_iterable
    272313         */
    273314        function test_is_iterable_availability() {
    274315                $this->assertTrue( function_exists( 'is_iterable' ) );
     
    283324         *
    284325         * @param mixed $variable    Variable to check.
    285326         * @param bool  $is_iterable The expected return value of PHP 7.1 is_iterable() function.
     327         *
     328         * @covers ::is_iterable
    286329         */
    287330        function test_is_iterable_functionality( $variable, $is_iterable ) {
    288331                $this->assertSame( is_iterable( $variable ), $is_iterable );
  • tests/phpunit/tests/cron.php

     
    3030                parent::tearDown();
    3131        }
    3232
     33        /**
     34         *
     35         * @covers ::wp_get_schedule
     36         */
    3337        function test_wp_get_schedule_empty() {
    3438                // Nothing scheduled.
    3539                $hook = __FUNCTION__;
     
    3640                $this->assertFalse( wp_get_schedule( $hook ) );
    3741        }
    3842
     43        /**
     44         *
     45         * @covers ::wp_schedule_single_event
     46         */
    3947        function test_schedule_event_single() {
    4048                // Schedule an event and make sure it's returned by wp_next_scheduled().
    4149                $hook      = __FUNCTION__;
     
    5058
    5159        }
    5260
     61        /**
     62         *
     63         * @covers ::wp_schedule_single_event
     64         */
    5365        function test_schedule_event_single_args() {
    5466                // Schedule an event with arguments and make sure it's returned by wp_next_scheduled().
    5567                $hook      = 'event';
     
    6880                $this->assertEquals( '', wp_get_schedule( $hook, $args ) );
    6981        }
    7082
     83        /**
     84         *
     85         * @covers ::wp_schedule_event
     86         */
    7187        function test_schedule_event() {
    7288                // Schedule an event and make sure it's returned by wp_next_scheduled().
    7389                $hook      = __FUNCTION__;
     
    8298                $this->assertEquals( $recur, wp_get_schedule( $hook ) );
    8399        }
    84100
     101        /**
     102         *
     103         * @covers ::wp_schedule_event
     104         */
    85105        function test_schedule_event_args() {
    86106                // Schedule an event and make sure it's returned by wp_next_scheduled().
    87107                $hook      = 'event';
     
    101121
    102122        }
    103123
     124        /**
     125         *
     126         * @covers ::wp_unschedule_event
     127         */
    104128        function test_unschedule_event() {
    105129                // Schedule an event and make sure it's returned by wp_next_scheduled().
    106130                $hook      = __FUNCTION__;
     
    115139                $this->assertEquals( false, wp_next_scheduled( $hook ) );
    116140        }
    117141
     142        /**
     143         *
     144         * @covers ::wp_clear_scheduled_hook
     145         */
    118146        function test_clear_schedule() {
    119147                $hook = __FUNCTION__;
    120148                $args = array( 'arg1' );
     
    142170                $this->assertFalse( wp_next_scheduled( $hook, $args ) );
    143171        }
    144172
     173        /**
     174         *
     175         * @covers ::wp_clear_scheduled_hook
     176         */
    145177        function test_clear_undefined_schedule() {
    146178                $hook = __FUNCTION__;
    147179                $args = array( 'arg1' );
     
    154186                $this->assertSame( 0, $hook_unscheduled );
    155187        }
    156188
     189        /**
     190         *
     191         * @covers ::wp_clear_scheduled_hook
     192         */
    157193        function test_clear_schedule_multiple_args() {
    158194                $hook = __FUNCTION__;
    159195                $args = array( 'arg1', 'arg2' );
     
    182218
    183219        /**
    184220         * @ticket 10468
     221         *
     222         * @covers ::wp_clear_scheduled_hook
    185223         */
    186224        function test_clear_schedule_new_args() {
    187225                $hook       = __FUNCTION__;
     
    220258
    221259        /**
    222260         * @ticket 18997
     261         *
     262         * @covers ::wp_clear_scheduled_hook
    223263         */
    224264        function test_unschedule_hook() {
    225265                $hook = __FUNCTION__;
     
    240280                $this->assertSame( 4, $unschedule_hook );
    241281                $this->assertFalse( wp_next_scheduled( $hook ) );
    242282        }
    243 
     283        /**
     284         *
     285         * @covers ::wp_clear_scheduled_hook
     286         */
    244287        function test_unschedule_undefined_hook() {
    245288                $hook           = __FUNCTION__;
    246289                $unrelated_hook = __FUNCTION__ . '_two';
     
    261304
    262305        /**
    263306         * @ticket 6966
     307         *
     308         * @covers ::wp_schedule_single_event
    264309         */
    265310        function test_duplicate_event() {
    266311                // Duplicate events close together should be skipped.
     
    280325
    281326        /**
    282327         * @ticket 6966
     328         *
     329         * @covers ::wp_schedule_single_event
    283330         */
    284331        function test_not_duplicate_event() {
    285332                // Duplicate events far apart should work normally.
     
    300347                $this->assertEquals( $ts1, wp_next_scheduled( $hook, $args ) );
    301348        }
    302349
     350        /**
     351         *
     352         * @covers ::wp_schedule_single_event
     353         */
    303354        function test_not_duplicate_event_reversed() {
    304355                // Duplicate events far apart should work normally regardless of order.
    305356                $hook = __FUNCTION__;
     
    324375         * modification of the cron_array_option.
    325376         *
    326377         * @ticket 32656
     378         *
     379         * @covers ::wp_schedule_single_event
    327380         */
    328381        function test_pre_schedule_event_filter() {
    329382                $hook = __FUNCTION__;
     
    376429         * modification of the cron_array_option.
    377430         *
    378431         * @ticket 32656
     432         *
     433         * @covers ::wp_schedule_event
    379434         */
    380435        function test_pre_reschedule_event_filter() {
    381436                $hook = __FUNCTION__;
     
    400455         * modification of the cron_array_option.
    401456         *
    402457         * @ticket 32656
     458         *
     459         * @covers ::wp_unschedule_event
    403460         */
    404461        function test_pre_unschedule_event_filter() {
    405462                $hook = __FUNCTION__;
     
    424481         * modification of the cron_array_option.
    425482         *
    426483         * @ticket 32656
     484         *
     485         * @covers ::wp_clear_scheduled_hook
    427486         */
    428487        function test_pre_clear_scheduled_hook_filters() {
    429488                $hook = __FUNCTION__;
     
    455514         * return a filtered value as expected.
    456515         *
    457516         * @ticket 32656
     517         *
     518         * @covers ::wp_get_scheduled_event
    458519         */
    459520        function test_pre_scheduled_event_hooks() {
    460521                add_filter( 'pre_get_scheduled_event', array( $this, 'filter_pre_scheduled_event_hooks' ) );
     
    489550         * When a timestamp is specified, a particular event should be returned.
    490551         *
    491552         * @ticket 45976.
     553         *
     554         * @covers ::wp_get_scheduled_event
    492555         */
    493556        function test_get_scheduled_event_singles() {
    494557                $hook    = __FUNCTION__;
     
    532595         * When a timestamp is specified, a particular event should be returned.
    533596         *
    534597         * @ticket 45976.
     598         *
     599         * @covers ::wp_get_scheduled_event
    535600         */
    536601        function test_get_scheduled_event_recurring() {
    537602                $hook     = __FUNCTION__;
     
    576641         * Ensure wp_get_scheduled_event() returns false when expected.
    577642         *
    578643         * @ticket 45976.
     644         *
     645         * @covers ::wp_get_scheduled_event
    579646         */
    580647        function test_get_scheduled_event_false() {
    581648                $hook = __FUNCTION__;
     
    601668         * Ensure any past event counts as a duplicate.
    602669         *
    603670         * @ticket 44818
     671         *
     672         * @covers ::wp_get_scheduled_event
    604673         */
    605674        function test_duplicate_past_event() {
    606675                $hook = __FUNCTION__;
     
    623692         * Ensure any near future event counts as a duplicate.
    624693         *
    625694         * @ticket 44818
     695         *
     696         * @covers ::wp_get_scheduled_event
    626697         */
    627698        function test_duplicate_near_future_event() {
    628699                $hook = __FUNCTION__;
     
    645716         * Duplicate future events are disallowed.
    646717         *
    647718         * @ticket 44818
     719         *
     720         * @covers ::wp_get_scheduled_event
    648721         */
    649722        function test_duplicate_future_event() {
    650723                $hook = __FUNCTION__;
     
    665738         * Future events are allowed.
    666739         *
    667740         * @ticket 44818
     741         *
     742         * @covers ::wp_get_scheduled_event
    668743         */
    669744        function test_not_duplicate_future_event() {
    670745                $hook = __FUNCTION__;
  • tests/phpunit/tests/db.php

     
    5858         * Test that WPDB will reconnect when the DB link dies
    5959         *
    6060         * @ticket 5932
     61         *
     62         * @covers wpdb::db_connect
    6163         */
    6264        public function test_db_reconnect() {
    6365                global $wpdb;
     
    8284         * @global mixed $wpdb
    8385         *
    8486         * @ticket 19861
     87         *
     88         * @covers wpdb::update
    8589         */
    8690        public function test_locale_floats() {
    8791                global $wpdb;
     
    128132
    129133        /**
    130134         * @ticket 10041
     135         *
     136         * @covers wpdb::esc_like
    131137         */
    132138        function test_esc_like() {
    133139                global $wpdb;
     
    164170         * @param $data string The haystack, raw.
    165171         * @param $like string The like phrase, raw.
    166172         * @param $result string The expected comparison result; '1' = true, '0' = false
     173         *
     174         * @covers wpdb::esc_like
    167175         */
    168176        function test_like_query( $data, $like, $result ) {
    169177                global $wpdb;
     
    227235
    228236        /**
    229237         * @ticket 18510
     238         *
     239         * @coversNothing
    230240         */
    231241        function test_wpdb_supposedly_protected_properties() {
    232242                global $wpdb;
     
    243253
    244254        /**
    245255         * @ticket 21212
     256         *
     257         * @coversNothing
    246258         */
    247259        function test_wpdb_actually_protected_properties() {
    248260                global $wpdb;
     
    274286         * Test that an escaped %%f is not altered
    275287         *
    276288         * @ticket 19861
     289         *
     290         * @covers wpdb::placeholder_escape
     291         * @covers wpdb::remove_placeholder_escape
    277292         */
    278293        public function test_double_escaped_placeholders() {
    279294                global $wpdb;
     
    289304         * Test that SQL modes are set correctly
    290305         *
    291306         * @ticket 26847
     307         *
     308         * @covers wpdb::set_sql_mode
    292309         */
    293310        function test_set_sql_mode() {
    294311                global $wpdb;
     
    309326         * Test that incompatible SQL modes are blocked
    310327         *
    311328         * @ticket 26847
     329         *
     330         * @covers wpdb::set_sql_mode
    312331         */
    313332        function test_set_incompatible_sql_mode() {
    314333                global $wpdb;
     
    327346         * Test that incompatible SQL modes can be changed
    328347         *
    329348         * @ticket 26847
     349         *
     350         * @covers wpdb::set_sql_mode
    330351         */
    331352        function test_set_allowed_incompatible_sql_mode() {
    332353                global $wpdb;
     
    360381        /**
    361382         * @ticket 25604
    362383         * @expectedIncorrectUsage wpdb::prepare
     384         *
     385         * @covers wpdb::prepare
    363386         */
    364387        function test_prepare_without_arguments() {
    365388                global $wpdb;
     
    370393                $this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0", $prepared );
    371394        }
    372395
     396        /**
     397         *
     398         * @covers wpdb::prepare
     399         */
    373400        function test_prepare_sprintf() {
    374401                global $wpdb;
    375402
     
    379406
    380407        /**
    381408         * @expectedIncorrectUsage wpdb::prepare
     409         *
     410         * @covers wpdb::prepare
    382411         */
    383412        function test_prepare_sprintf_invalid_args() {
    384413                global $wpdb;
     
    392421                $this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0 AND user_login = 'admin'", $prepared );
    393422        }
    394423
     424        /**
     425         *
     426         * @covers wpdb::prepare
     427         */
    395428        function test_prepare_vsprintf() {
    396429                global $wpdb;
    397430
     
    401434
    402435        /**
    403436         * @expectedIncorrectUsage wpdb::prepare
     437         *
     438         * @covers wpdb::prepare
    404439         */
    405440        function test_prepare_vsprintf_invalid_args() {
    406441                global $wpdb;
     
    418453         * @ticket 42040
    419454         * @dataProvider data_prepare_incorrect_arg_count
    420455         * @expectedIncorrectUsage wpdb::prepare
     456         *
     457         * @covers wpdb::prepare
    421458         */
    422459        public function test_prepare_incorrect_arg_count( $query, $args, $expected ) {
    423460                global $wpdb;
     
    479516                );
    480517        }
    481518
     519        /**
     520         *
     521         * @covers wpdb::db_version
     522         */
    482523        function test_db_version() {
    483524                global $wpdb;
    484525
    485526                $this->assertTrue( version_compare( $wpdb->db_version(), '5.0', '>=' ) );
    486527        }
    487 
     528        /**
     529         *
     530         * @covers wpdb::get_caller
     531         */
    488532        function test_get_caller() {
    489533                global $wpdb;
    490534                $str    = $wpdb->get_caller();
     
    493537                $this->assertEquals( $called, end( $calls ) );
    494538        }
    495539
     540        /**
     541         *
     542         * @covers wpdb::has_cap
     543         */
    496544        function test_has_cap() {
    497545                global $wpdb;
    498546                $this->assertTrue( $wpdb->has_cap( 'collation' ) );
     
    513561
    514562        /**
    515563         * @expectedDeprecated supports_collation
     564         *
     565         * @covers wpdb::supports_collation
    516566         */
    517567        function test_supports_collation() {
    518568                global $wpdb;
     
    519569                $this->assertTrue( $wpdb->supports_collation() );
    520570        }
    521571
     572        /**
     573         *
     574         * @covers wpdb::check_database_version
     575         */
    522576        function test_check_database_version() {
    523577                global $wpdb;
    524578                $this->assertEmpty( $wpdb->check_database_version() );
     
    526580
    527581        /**
    528582         * @expectedException WPDieException
     583         *
     584         * @covers wpdb::bail
    529585         */
    530586        function test_bail() {
    531587                global $wpdb;
    532588                $wpdb->bail( 'Database is dead.' );
    533589        }
    534 
     590        /**
     591         *
     592         * @covers wpdb::timer_start
     593         * @covers wpdb::timer_stop
     594         */
    535595        function test_timers() {
    536596                global $wpdb;
    537597
     
    542602                $this->assertNotEquals( $wpdb->time_start, $stop );
    543603                $this->assertGreaterThan( $stop, $wpdb->time_start );
    544604        }
    545 
     605        /**
     606         *
     607         * @covers wpdb::get_col_info
     608         */
    546609        function test_get_col_info() {
    547610                global $wpdb;
    548611
     
    552615                $this->assertEquals( array( $wpdb->users ), $wpdb->get_col_info( 'table' ) );
    553616                $this->assertEquals( $wpdb->users, $wpdb->get_col_info( 'table', 0 ) );
    554617        }
    555 
     618        /**
     619         *
     620         * @covers wpdb::query
     621         * @covers wpdb::delete
     622         */
    556623        function test_query_and_delete() {
    557624                global $wpdb;
    558625                $rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" );
     
    561628                $d_rows = $wpdb->delete( $wpdb->users, array( 'ID' => $wpdb->insert_id ) );
    562629                $this->assertEquals( 1, $d_rows );
    563630        }
    564 
     631        /**
     632         *
     633         * @covers wpdb::query
     634         * @covers wpdb::get_row
     635         */
    565636        function test_get_row() {
    566637                global $wpdb;
    567638                $rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" );
     
    584655         * @dataProvider data_test_get_col
    585656         *
    586657         * @ticket 45299
     658         *
     659         * @covers wpdb::get_col
    587660         */
    588661        function test_get_col( $query, $expected, $last_result, $column ) {
    589662                global $wpdb;
     
    664737                );
    665738        }
    666739
     740        /**
     741         *
     742         * @covers wpdb::replace
     743         */
    667744        function test_replace() {
    668745                global $wpdb;
    669746                $rows1 = $wpdb->insert( $wpdb->users, array( 'display_name' => 'Walter Sobchak' ) );
     
    691768         * wpdb::update() requires a WHERE condition.
    692769         *
    693770         * @ticket 26106
     771         *
     772         * @covers wpdb::update
    694773         */
    695774        function test_empty_where_on_update() {
    696775                global $wpdb;
     
    713792         * mysqli_ incorrect flush and further sync issues.
    714793         *
    715794         * @ticket 28155
     795         *
     796         * @coversNothing
    716797         */
    717798        function test_mysqli_flush_sync() {
    718799                global $wpdb;
     
    873954        /**
    874955         * @dataProvider data_get_table_from_query
    875956         * @ticket 21212
     957         *
     958         * @covers wpdb::get_table_from_query
    876959         */
    877960        function test_get_table_from_query( $query, $table ) {
    878961                $this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) );
     
    888971        /**
    889972         * @dataProvider data_get_table_from_query_false
    890973         * @ticket 21212
     974         *
     975         * @covers wpdb::get_table_from_query
    891976         */
    892977        function test_get_table_from_query_false( $query ) {
    893978                $this->assertFalse( self::$_wpdb->get_table_from_query( $query ) );
     
    9151000        /**
    9161001         * @dataProvider data_get_escaped_table_from_show_query
    9171002         * @ticket 38751
     1003         *
     1004         * @covers wpdb::get_table_from_query
    9181005         */
    9191006        function test_get_escaped_table_from_show_query( $query, $table ) {
    9201007                $this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) );
     
    10301117        /**
    10311118         * @dataProvider data_process_field_formats
    10321119         * @ticket 21212
     1120         *
     1121         * @covers wpdb::process_field_formats
    10331122         */
    10341123        function test_process_field_formats( $data, $format, $expected, $message ) {
    10351124                $actual = self::$_wpdb->process_field_formats( $data, $format );
     
    10381127
    10391128        /**
    10401129         * @ticket 21212
     1130         *
     1131         * @covers wpdb::process_fields
    10411132         */
    10421133        function test_process_fields() {
    10431134                global $wpdb;
     
    10681159        /**
    10691160         * @ticket 21212
    10701161         * @depends test_process_fields
     1162         *
     1163         * @covers wpdb::process_fields
    10711164         */
    10721165        function test_process_fields_on_nonexistent_table( $data ) {
    10731166                self::$_wpdb->suppress_errors( true );
     
    10781171
    10791172        /**
    10801173         * @ticket 21212
     1174         *
     1175         * @covers wpdb::get_table_charset
    10811176         */
    10821177        function test_pre_get_table_charset_filter() {
    10831178                add_filter( 'pre_get_table_charset', array( $this, 'filter_pre_get_table_charset' ), 10, 2 );
     
    10921187
    10931188        /**
    10941189         * @ticket 21212
     1190         *
     1191         * @covers wpdb::get_col_charset
    10951192         */
    10961193        function test_pre_get_col_charset_filter() {
    10971194                add_filter( 'pre_get_col_charset', array( $this, 'filter_pre_get_col_charset' ), 10, 3 );
     
    11061203
    11071204        /**
    11081205         * @ticket 15158
     1206         *
     1207         * @covers wpdb::insert
    11091208         */
    11101209        function test_null_insert() {
    11111210                global $wpdb;
     
    11281227
    11291228        /**
    11301229         * @ticket 15158
     1230         *
     1231         * @covers wpdb::insert
    11311232         */
    11321233        function test_null_update_value() {
    11331234                global $wpdb;
     
    11661267
    11671268        /**
    11681269         * @ticket 15158
     1270         *
     1271         * @covers wpdb::update
    11691272         */
    11701273        function test_null_update_where() {
    11711274                global $wpdb;
     
    12041307
    12051308        /**
    12061309         * @ticket 15158
     1310         *
     1311         * @covers wpdb::delete
    12071312         */
    12081313        function test_null_delete() {
    12091314                global $wpdb;
     
    12401345
    12411346        /**
    12421347         * @ticket 34903
     1348         *
     1349         * @covers wpdb::close
    12431350         */
    12441351        function test_close() {
    12451352                global $wpdb;
     
    12591366
    12601367        /**
    12611368         * @ticket 36917
     1369         *
     1370         * @covers wpdb::determine_charset
    12621371         */
    12631372        function test_charset_not_determined_when_disconnected() {
    12641373                global $wpdb;
     
    12771386
    12781387        /**
    12791388         * @ticket 36917
     1389         *
     1390         * @covers wpdb::determine_charset
    12801391         */
    12811392        function test_charset_switched_to_utf8mb4() {
    12821393                global $wpdb;
     
    12961407        /**
    12971408         * @ticket 32105
    12981409         * @ticket 36917
     1410         *
     1411         * @covers wpdb::determine_charset
    12991412         */
    13001413        function test_collate_switched_to_utf8mb4_520() {
    13011414                global $wpdb;
     
    13151428        /**
    13161429         * @ticket 32405
    13171430         * @ticket 36917
     1431         *
     1432         * @covers wpdb::determine_charset
    13181433         */
    13191434        function test_non_unicode_collations() {
    13201435                global $wpdb;
     
    13331448
    13341449        /**
    13351450         * @ticket 37982
     1451         *
     1452         * @covers wpdb::determine_charset
    13361453         */
    13371454        function test_charset_switched_to_utf8() {
    13381455                global $wpdb;
     
    13521469
    13531470        /**
    13541471         * @dataProvider data_prepare_with_placeholders
     1472         *
     1473         * @covers wpdb::prepare
    13551474         */
    13561475        function test_prepare_with_placeholders_and_individual_args( $sql, $values, $incorrect_usage, $expected ) {
    13571476                global $wpdb;
     
    13711490
    13721491        /**
    13731492         * @dataProvider data_prepare_with_placeholders
     1493         *
     1494         * @covers wpdb::prepare
    13741495         */
    13751496        function test_prepare_with_placeholders_and_array_args( $sql, $values, $incorrect_usage, $expected ) {
    13761497                global $wpdb;
     
    15651686
    15661687        /**
    15671688         * @dataProvider data_escape_and_prepare
     1689         *
     1690         * @covers ::esc_sql
     1691        /**
     1692         * @coversNothing
    15681693         */
     1694         */
    15691695        function test_escape_and_prepare( $escape, $sql, $values, $incorrect_usage, $expected ) {
    15701696                global $wpdb;
    15711697
     
    16121738
    16131739        /**
    16141740         * @expectedIncorrectUsage wpdb::prepare
     1741         *
     1742         * @covers wpdb::prepare
    16151743         */
    16161744        function test_double_prepare() {
    16171745                global $wpdb;
     
    16231751                $this->assertNull( $query );
    16241752        }
    16251753
     1754        /**
     1755         *
     1756         * @covers wpdb::prepare
     1757         */
    16261758        function test_prepare_numeric_placeholders_float_args() {
    16271759                global $wpdb;
    16281760
     
    16381770                $this->assertContains( ' second=2.2', $actual );
    16391771        }
    16401772
     1773        /**
     1774         *
     1775         * @covers wpdb::prepare
     1776         */
    16411777        function test_prepare_numeric_placeholders_float_array() {
    16421778                global $wpdb;
    16431779
     
    16521788                $this->assertContains( ' second=2.2', $actual );
    16531789        }
    16541790
     1791        /**
     1792         *
     1793         * @covers wpdb::prepare
     1794         */
    16551795        function test_query_unescapes_placeholders() {
    16561796                global $wpdb;
    16571797
     
    16711811                $this->assertEquals( $value, $actual );
    16721812        }
    16731813
     1814        /**
     1815         *
     1816         * @covers wpdb::placeholder_escape
     1817         */
    16741818        function test_esc_sql_with_unsupported_placeholder_type() {
    16751819                global $wpdb;
    16761820
     
    16841828        /**
    16851829         * @dataProvider parse_db_host_data_provider
    16861830         * @ticket 41722
     1831         *
     1832         * @covers wpdb::parse_db_host
    16871833         */
    16881834        public function test_parse_db_host( $host_string, $expect_bail, $host, $port, $socket, $is_ipv6 ) {
    16891835                global $wpdb;
  • tests/phpunit/tests/dbdelta.php

     
    9696
    9797        /**
    9898         * Test table creation.
     99         *
     100         * @covers ::dbDelta
    99101         */
    100102        public function test_creating_a_table() {
    101103
     
    133135
    134136        /**
    135137         * Test that it does nothing for an existing table.
     138         *
     139         * @covers ::dbDelta
    136140         */
    137141        public function test_existing_table() {
    138142
     
    155159
    156160        /**
    157161         * Test the column type is updated.
     162         *
     163         * @covers ::dbDelta
    158164         */
    159165        public function test_column_type_change() {
    160166
     
    184190
    185191        /**
    186192         * Test new column added.
     193         *
     194         * @covers ::dbDelta
    187195         */
    188196        public function test_column_added() {
    189197
     
    218226         * Test that it does nothing when a column is removed.
    219227         *
    220228         * @ticket 26801
     229         *
     230         * @covers ::dbDelta
    221231         */
    222232        public function test_columns_arent_removed() {
    223233
     
    242252
    243253        /**
    244254         * Test that nothing happens with $execute is false.
     255         *
     256         * @covers ::dbDelta
    245257         */
    246258        public function test_no_execution() {
    247259
     
    275287
    276288        /**
    277289         * Test inserting into the database
     290         *
     291         * @covers ::dbDelta
    278292         */
    279293        public function test_insert_into_table() {
    280294                global $wpdb;
     
    296310         * Test that FULLTEXT indexes are detected.
    297311         *
    298312         * @ticket 14445
     313         *
     314         * @covers ::dbDelta
    299315         */
    300316        public function test_fulltext_index() {
    301317                global $wpdb;
     
    401417
    402418        /**
    403419         * @ticket 31869
     420         *
     421         * @covers ::dbDelta
    404422         */
    405423        function test_truncated_index() {
    406424                global $wpdb;
     
    441459
    442460        /**
    443461         * @ticket 36748
     462         *
     463         * @covers ::dbDelta
    444464         */
    445465        function test_dont_downsize_text_fields() {
    446466                global $wpdb;
     
    466486
    467487        /**
    468488         * @ticket 36748
     489         *
     490         * @covers ::dbDelta
    469491         */
    470492        function test_dont_downsize_blob_fields() {
    471493                global $wpdb;
     
    491513
    492514        /**
    493515         * @ticket 36748
     516         *
     517         * @covers ::dbDelta
    494518         */
    495519        function test_upsize_text_fields() {
    496520                global $wpdb;
     
    522546
    523547        /**
    524548         * @ticket 36748
     549         *
     550         * @covers ::dbDelta
    525551         */
    526552        function test_upsize_blob_fields() {
    527553                global $wpdb;
     
    553579
    554580        /**
    555581         * @ticket 20263
     582         *
     583         * @covers ::dbDelta
    556584         */
    557585        function test_query_with_backticks_does_not_throw_an_undefined_index_warning() {
    558586                global $wpdb;
     
    578606
    579607        /**
    580608         * @ticket 36948
     609         *
     610         * @covers ::dbDelta
    581611         */
    582612        function test_spatial_indices() {
    583613                global $wpdb;
     
    639669
    640670        /**
    641671         * @ticket 20263
     672         *
     673         * @covers ::dbDelta
    642674         */
    643675        function test_query_with_backticks_does_not_cause_a_query_to_alter_all_columns_and_indices_to_run_even_if_none_have_changed() {
    644676                global $wpdb;
     
    668700
    669701        /**
    670702         * @ticket 20263
     703         *
     704         * @covers ::dbDelta
    671705         */
    672706        function test_index_with_a_reserved_keyword_can_be_created() {
    673707                global $wpdb;
     
    704738
    705739        /**
    706740         * @ticket 20263
     741         *
     742         * @covers ::dbDelta
    707743         */
    708744        function test_wp_get_db_schema_does_no_alter_queries_on_existing_install() {
    709745                $updates = dbDelta( wp_get_db_schema() );
     
    713749
    714750        /**
    715751         * @ticket 20263
     752         *
     753         * @covers ::dbDelta
    716754         */
    717755        function test_key_and_index_and_fulltext_key_and_fulltext_index_and_unique_key_and_unique_index_indicies() {
    718756                global $wpdb;
     
    751789
    752790        /**
    753791         * @ticket 20263
     792         *
     793         * @covers ::dbDelta
    754794         */
    755795        function test_index_and_key_are_synonyms_and_do_not_recreate_indices() {
    756796                global $wpdb;
     
    775815
    776816        /**
    777817         * @ticket 20263
     818         *
     819         * @covers ::dbDelta
    778820         */
    779821        function test_indices_with_prefix_limits_are_created_and_do_not_recreate_indices() {
    780822                global $wpdb;
     
    809851
    810852        /**
    811853         * @ticket 34959
     854         *
     855         * @covers ::dbDelta
    812856         */
    813857        function test_index_col_names_with_order_do_not_recreate_indices() {
    814858                global $wpdb;
     
    833877
    834878        /**
    835879         * @ticket 34873
     880         *
     881         * @covers ::dbDelta
    836882         */
    837883        function test_primary_key_with_single_space_does_not_recreate_index() {
    838884                global $wpdb;
     
    857903
    858904        /**
    859905         * @ticket 34869
     906         *
     907         * @covers ::dbDelta
    860908         */
    861909        function test_index_definitions_with_spaces_do_not_recreate_indices() {
    862910                global $wpdb;
     
    881929
    882930        /**
    883931         * @ticket 34871
     932         *
     933         * @covers ::dbDelta
    884934         */
    885935        function test_index_types_are_not_case_sensitive_and_do_not_recreate_indices() {
    886936                global $wpdb;
     
    905955
    906956        /**
    907957         * @ticket 34874
     958         *
     959         * @covers ::dbDelta
    908960         */
    909961        function test_key_names_are_not_case_sensitive_and_do_not_recreate_indices() {
    910962                global $wpdb;
     
    930982
    931983        /**
    932984         * @ticket 34870
     985         *
     986         * @covers ::dbDelta
    933987         */
    934988        function test_unchanged_key_lengths_do_not_recreate_index() {
    935989                global $wpdb;
     
    9551009
    9561010        /**
    9571011         * @ticket 34870
     1012         *
     1013         * @covers ::dbDelta
    9581014         */
    9591015        function test_changed_key_lengths_do_not_recreate_index() {
    9601016                global $wpdb;
     
    10391095
    10401096        /**
    10411097         * @ticket 31679
     1098         *
     1099         * @covers ::dbDelta
    10421100         */
    10431101        function test_column_type_change_with_hyphens_in_name() {
    10441102                global $wpdb;
  • tests/phpunit/tests/dependencies.php

     
    44 * @group scripts
    55 */
    66class Tests_Dependencies extends WP_UnitTestCase {
     7
     8        /**
     9         *
     10         * @covers WP_Dependencies::add
     11         */
    712        function test_add() {
    813                $dep = new WP_Dependencies;
    914
     
    1621                // Cannot reuse names.
    1722                $this->assertFalse( $dep->add( 'one', '' ) );
    1823        }
    19 
     24        /**
     25         *
     26         * @covers WP_Dependencies::remove
     27         */
    2028        function test_remove() {
    2129                $dep = new WP_Dependencies;
    2230
     
    2937                $this->assertInstanceOf( '_WP_Dependency', $dep->query( 'two' ) );
    3038
    3139        }
    32 
     40        /**
     41         *
     42         * @covers WP_Dependencies::enqueue
     43         */
    3344        function test_enqueue() {
    3445                $dep = new WP_Dependencies;
    3546
     
    4556                $this->assertTrue( $dep->query( 'one', 'queue' ) );
    4657                $this->assertTrue( $dep->query( 'two', 'queue' ) );
    4758        }
    48 
     59        /**
     60         *
     61         * @covers WP_Dependencies::dequeue
     62         */
    4963        function test_dequeue() {
    5064                $dep = new WP_Dependencies;
    5165
     
    6579                $this->assertFalse( $dep->query( 'one', 'queue' ) );
    6680                $this->assertFalse( $dep->query( 'two', 'queue' ) );
    6781        }
    68 
     82        /**
     83         *
     84         * @covers WP_Dependencies::enqueue
     85         */
    6986        function test_enqueue_args() {
    7087                $dep = new WP_Dependencies;
    7188
     
    83100                $this->assertTrue( $dep->query( 'two', 'queue' ) );
    84101                $this->assertEquals( 'arg', $dep->args['two'] );
    85102        }
    86 
     103        /**
     104         *
     105         * @covers WP_Dependencies::dequeue
     106         */
    87107        function test_dequeue_args() {
    88108                $dep = new WP_Dependencies;
    89109
     
    110130
    111131        /**
    112132         * @ticket 21741
     133         *
     134         * @covers WP_Dependencies::query
    113135         */
    114136        function test_query_and_registered_enqueued() {
    115137                $dep = new WP_Dependencies;
  • tests/phpunit/tests/dependencies/scripts.php

     
    10451045         * Testing `wp_enqueue_code_editor` with file path.
    10461046         *
    10471047         * @ticket 41871
    1048          * @covers ::wp_enqueue_code_editor()
     1048         * @covers ::wp_enqueue_code_editor
    10491049         */
    10501050        public function test_wp_enqueue_code_editor_when_php_file_will_be_passed() {
    10511051                $real_file              = WP_PLUGIN_DIR . '/hello.php';
     
    11321132         * Testing `wp_enqueue_code_editor` with `compact`.
    11331133         *
    11341134         * @ticket 41871
    1135          * @covers ::wp_enqueue_code_editor()
     1135         * @covers ::wp_enqueue_code_editor
    11361136         */
    11371137        public function test_wp_enqueue_code_editor_when_generated_array_by_compact_will_be_passed() {
    11381138                $file                   = '';
     
    12151215         * Testing `wp_enqueue_code_editor` with `array_merge`.
    12161216         *
    12171217         * @ticket 41871
    1218          * @covers ::wp_enqueue_code_editor()
     1218         * @covers ::wp_enqueue_code_editor
    12191219         */
    12201220        public function test_wp_enqueue_code_editor_when_generated_array_by_array_merge_will_be_passed() {
    12211221                $wp_enqueue_code_editor = wp_enqueue_code_editor(
     
    13121312         * Testing `wp_enqueue_code_editor` with `array`.
    13131313         *
    13141314         * @ticket 41871
    1315          * @covers ::wp_enqueue_code_editor()
     1315         * @covers ::wp_enqueue_code_editor
    13161316         */
    13171317        public function test_wp_enqueue_code_editor_when_simple_array_will_be_passed() {
    13181318                $wp_enqueue_code_editor = wp_enqueue_code_editor(
  • tests/phpunit/tests/file.php

     
    1616        /**
    1717         * @group plugins
    1818         * @group themes
     19         *
     20         * @cover ::get_file_data
    1921         */
    2022        function test_get_file_data() {
    2123                $theme_headers = array(
     
    4648        /**
    4749         * @group plugins
    4850         * @group themes
     51         *
     52         * @cover ::get_file_data
    4953         */
    5054        function test_get_file_data_cr_line_endings() {
    5155                $headers  = array(
     
    8892                return $result;
    8993        }
    9094
     95        /**
     96         *
     97         * @cover ::wp_unique_filename
     98         */
    9199        function test_unique_filename_is_valid() {
    92100                // Make sure it produces a valid, writable, unique filename.
    93101                $filename = wp_unique_filename( $this->dir, __FUNCTION__ . '.txt' );
     
    97105                unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
    98106        }
    99107
     108        /**
     109         *
     110         * @cover ::wp_unique_filename
     111         */
    100112        function test_unique_filename_is_unique() {
    101113                // Make sure it produces two unique filenames.
    102114                $name = __FUNCTION__;
     
    113125                unlink( $this->dir . DIRECTORY_SEPARATOR . $filename2 );
    114126        }
    115127
     128        /**
     129         *
     130         * @cover ::wp_unique_filename
     131         */
    116132        function test_unique_filename_is_sanitized() {
    117133                $name     = __FUNCTION__;
    118134                $filename = wp_unique_filename( $this->dir, $name . $this->badchars . '.txt' );
     
    125141                unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
    126142        }
    127143
     144        /**
     145         *
     146         * @cover ::wp_unique_filename
     147         */
    128148        function test_unique_filename_with_slashes() {
    129149                $name = __FUNCTION__;
    130150                // "foo/foo.txt"
     
    138158                unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
    139159        }
    140160
     161        /**
     162         *
     163         * @cover ::wp_unique_filename
     164         */
    141165        function test_unique_filename_multiple_ext() {
    142166                $name     = __FUNCTION__;
    143167                $filename = wp_unique_filename( $this->dir, $name . '.php.txt' );
     
    150174                unlink( $this->dir . DIRECTORY_SEPARATOR . $filename );
    151175        }
    152176
     177        /**
     178         *
     179         * @cover ::wp_unique_filename
     180         */
    153181        function test_unique_filename_no_ext() {
    154182                $name     = __FUNCTION__;
    155183                $filename = wp_unique_filename( $this->dir, $name );
     
    163191
    164192        /**
    165193         * @dataProvider data_wp_tempnam_filenames
     194         *
     195         * @cover ::wp_tempnam
    166196         */
    167197        function test_wp_tempnam( $case ) {
    168198                $file = wp_tempnam( $case );
     
    183213
    184214        /**
    185215         * @ticket 47186
     216         *
     217         * @cover ::verify_file_signature
    186218         */
    187219        function test_file_signature_functions_as_expected() {
    188220                $file = wp_tempnam();
     
    216248
    217249        /**
    218250         * @ticket 47186
     251         *
     252         * @cover ::verify_file_signature
    219253         */
    220254        function test_file_signature_expected_failure() {
    221255                $file = wp_tempnam();
  • tests/phpunit/tests/filters.php

     
    77 */
    88class Tests_Filters extends WP_UnitTestCase {
    99
     10        /**
     11         * @covers ::add_filter
     12         */
    1013        function test_simple_filter() {
    1114                $a   = new MockAction();
    1215                $tag = __FUNCTION__;
     
    2528                $this->assertEquals( array( $val ), $args );
    2629        }
    2730
     31        /**
     32         * @covers ::remove_filter
     33         */
    2834        function test_remove_filter() {
    2935                $a   = new MockAction();
    3036                $tag = __FUNCTION__;
     
    4551
    4652        }
    4753
     54        /**
     55         * @covers ::has_filter
     56         */
    4857        function test_has_filter() {
    4958                        $tag  = __FUNCTION__;
    5059                        $func = __FUNCTION__ . '_func';
     
    5968                        $this->assertFalse( has_filter( $tag ) );
    6069        }
    6170
    62         // One tag with multiple filters.
     71        /**
     72         * One tag with multiple filters.
     73         *
     74         * @covers ::add_filter
     75         */
    6376        function test_multiple_filters() {
    6477                $a1  = new MockAction();
    6578                $a2  = new MockAction();
     
    7790                $this->assertEquals( 1, $a2->get_call_count() );
    7891        }
    7992
     93        /**
     94         * One tag with multiple filters.
     95         *
     96         * @covers ::add_filter
     97         */
    8098        function test_filter_args_1() {
    8199                $a    = new MockAction();
    82100                $tag  = __FUNCTION__;
     
    92110                $this->assertEquals( array( $val, $arg1 ), array_pop( $argsvar ) );
    93111        }
    94112
     113        /**
     114         * One tag with multiple filters.
     115         *
     116         * @covers ::add_filter
     117         */
    95118        function test_filter_args_2() {
    96119                $a1   = new MockAction();
    97120                $a2   = new MockAction();
     
    117140                $this->assertEquals( array( $val ), array_pop( $argsvar2 ) );
    118141        }
    119142
     143        /**
     144         * One tag with multiple filters.
     145         *
     146         * @covers ::add_filter
     147         */
    120148        function test_filter_priority() {
    121149                $a   = new MockAction();
    122150                $tag = __FUNCTION__;
     
    148176                $this->assertEquals( $expected, $a->get_events() );
    149177        }
    150178
     179        /**
     180         * One tag with multiple filters.
     181         *
     182         * @covers ::add_filter
     183         */
    151184        function test_all_filter() {
    152185                $a    = new MockAction();
    153186                $tag1 = __FUNCTION__ . '_1';
     
    172205
    173206        }
    174207
     208        /**
     209         * One tag with multiple filters.
     210         *
     211         * @covers ::add_filter
     212         */
    175213        function test_remove_all_filter() {
    176214                $a   = new MockAction();
    177215                $tag = __FUNCTION__;
     
    198236
    199237        /**
    200238         * @ticket 20920
     239         *
     240         * @covers ::add_filter
    201241         */
    202242        function test_remove_all_filters_should_respect_the_priority_argument() {
    203243                $a   = new MockAction();
     
    217257
    218258        /**
    219259         * @ticket 9886
     260         *
     261         * @covers ::add_filter
    220262         */
    221263        function test_filter_ref_array() {
    222264                $obj = new stdClass();
     
    236278
    237279        /**
    238280         * @ticket 12723
     281         *
     282         * @covers ::add_filter
    239283         */
    240284        function test_filter_ref_array_result() {
    241285                $obj = new stdClass();
     
    271315
    272316        /**
    273317         * @ticket 29070
     318         *
     319         * @covers ::has_filter
    274320         */
    275321        function test_has_filter_after_remove_all_filters() {
    276322                $a   = new MockAction();
     
    298344        /**
    299345         * @ticket 10441
    300346         * @expectedDeprecated tests_apply_filters_deprecated
     347         *
     348         * @covers ::apply_filters_deprecated
    301349         */
    302350        public function test_apply_filters_deprecated() {
    303351                $p = 'Foo';
     
    317365        /**
    318366         * @ticket 10441
    319367         * @expectedDeprecated tests_apply_filters_deprecated
     368         *
     369         * @covers ::apply_filters_deprecated
    320370         */
    321371        public function test_apply_filters_deprecated_with_multiple_params() {
    322372                $p1 = 'Foo1';
     
    341391
    342392        /**
    343393         * @ticket 10441
     394         *
     395         * @covers ::apply_filters_deprecated
    344396         */
    345397        public function test_apply_filters_deprecated_without_filter() {
    346398                $val = 'Foobar';
     
    351403        private $current_priority;
    352404        /**
    353405         * @ticket 39007
     406         *
     407         * @covers ::add_action
    354408         */
    355409        public function test_current_priority() {
    356410                add_action( 'test_current_priority', array( $this, '_current_priority_action' ), 99 );
     
    360414                $this->assertSame( 99, $this->current_priority );
    361415        }
    362416
     417        /**
     418         * One tag with multiple filters.
     419         */
    363420        public function _current_priority_action() {
    364421                global $wp_filter;
    365422                $this->current_priority = $wp_filter[ current_filter() ]->current_priority();
     
    367424
    368425        /**
    369426         * @ticket 39007
     427         *
     428         * @covers ::add_action
    370429         */
    371430        public function test_other_priority() {
    372431                add_action( 'test_current_priority', array( $this, '_other_priority_action' ), 99 );
  • tests/phpunit/tests/functions.php

     
    44 * @group functions.php
    55 */
    66class Tests_Functions extends WP_UnitTestCase {
     7
     8        /**
     9         *
     10         * @covers ::wp_parse_args
     11         */
    712        function test_wp_parse_args_object() {
    813                $x        = new MockClass;
    914                $x->_baba = 5;
     
    2126                $this->assertEquals( array(), wp_parse_args( $y ) );
    2227        }
    2328
     29
     30        /**
     31         *
     32         * @covers ::wp_parse_args
     33         */
    2434        function test_wp_parse_args_array() {
    2535                // Arrays.
    2636                $a = array();
     
    4050                );
    4151        }
    4252
     53
     54        /**
     55         *
     56         * @covers ::wp_parse_args
     57         */
    4358        function test_wp_parse_args_defaults() {
    4459                $x        = new MockClass;
    4560                $x->_baba = 5;
     
    6681                );
    6782        }
    6883
     84
     85        /**
     86         *
     87         * @covers ::wp_parse_args
     88         */
    6989        function test_wp_parse_args_other() {
    7090                $b = true;
    7191                wp_parse_str( $b, $s );
     
    7797
    7898        /**
    7999         * @ticket 30753
     100         *
     101         * @covers ::wp_parse_args
    80102         */
    81103        function test_wp_parse_args_boolean_strings() {
    82104                $args = wp_parse_args( 'foo=false&bar=true' );
     
    86108
    87109        /**
    88110         * @ticket 35972
     111         *
     112         * @covers ::bool_from_yn
    89113         */
    90114        function test_bool_from_yn() {
    91115                $this->assertTrue( bool_from_yn( 'Y' ) );
     
    93117                $this->assertFalse( bool_from_yn( 'n' ) );
    94118        }
    95119
     120        /**
     121         *
     122         * @covers ::path_is_absolute
     123         */
    96124        function test_path_is_absolute() {
    97125                $absolute_paths = array(
    98126                        '/',
     
    111139                }
    112140        }
    113141
     142        /**
     143         *
     144         * @covers ::path_is_absolute
     145         */
    114146        function test_path_is_not_absolute() {
    115147                $relative_paths = array(
    116148                        '',
     
    134166         * @ticket 35996
    135167         *
    136168         * @dataProvider data_wp_normalize_path
     169         * @covers ::wp_normalize_path
    137170         */
    138171        function test_wp_normalize_path( $path, $expected ) {
    139172                $this->assertEquals( $expected, wp_normalize_path( $path ) );
     
    163196                );
    164197        }
    165198
     199
     200        /**
     201         *
     202         * @covers ::wp_unique_filename
     203         */
    166204        function test_wp_unique_filename() {
    167205
    168206                $testdir = DIR_TESTDATA . '/images/';
     
    198236
    199237        /**
    200238         * @ticket 42437
     239         *
     240         * @covers ::wp_unique_filename
    201241         */
    202242        function test_unique_filename_with_dimension_like_filename() {
    203243                $testdir = DIR_TESTDATA . '/images/';
     
    223263
    224264        /**
    225265         * @dataProvider data_is_not_serialized
     266         *
     267         * @covers ::serialize
    226268         */
    227269        function test_maybe_serialize( $value ) {
    228270                if ( is_array( $value ) || is_object( $value ) ) {
     
    236278
    237279        /**
    238280         * @dataProvider data_is_serialized
     281         *
     282         * @covers ::serialize
    239283         */
    240284        function test_maybe_serialize_with_double_serialization( $value ) {
    241285                $expected = serialize( $value );
     
    246290        /**
    247291         * @dataProvider data_is_serialized
    248292         * @dataProvider data_is_not_serialized
     293         *
     294         * @covers ::maybe_unserialize
    249295         */
    250296        function test_maybe_unserialize( $value, $is_serialized ) {
    251297                if ( $is_serialized ) {
     
    264310        /**
    265311         * @dataProvider data_is_serialized
    266312         * @dataProvider data_is_not_serialized
     313         *
     314         * @covers ::is_serialized
    267315         */
    268316        function test_is_serialized( $value, $expected ) {
    269317                $this->assertSame( $expected, is_serialized( $value ) );
     
    324372        /**
    325373         * @ticket 46570
    326374         * @dataProvider data_is_serialized_should_return_true_for_large_floats
     375         *
     376         * @covers ::is_serialized
    327377         */
    328378        function test_is_serialized_should_return_true_for_large_floats( $value ) {
    329379                $this->assertTrue( is_serialized( $value ) );
     
    338388
    339389        /**
    340390         * @ticket 17375
     391         *
     392         * @covers ::is_serialized
    341393         */
    342394        function test_no_new_serializable_types() {
    343395                $this->assertFalse( is_serialized( 'C:16:"Serialized_Class":6:{a:0:{}}' ) );
     
    345397
    346398        /**
    347399         * @group add_query_arg
     400         *
     401         * @covers ::add_query_arg
    348402         */
    349403        function test_add_query_arg() {
    350404                $old_req_uri = $_SERVER['REQUEST_URI'];
     
    533587
    534588        /**
    535589         * @ticket 31306
     590         *
     591         * @covers ::add_query_arg
    536592         */
    537593        function test_add_query_arg_numeric_keys() {
    538594                $url = add_query_arg( array( 'foo' => 'bar' ), '1=1' );
     
    553609
    554610        /**
    555611         * @ticket 21594
     612         *
     613         * @covers ::get_allowed_mime_types
    556614         */
    557615        function test_get_allowed_mime_types() {
    558616                $mimes = get_allowed_mime_types();
     
    573631
    574632        /**
    575633         * @ticket 21594
     634         *
     635         * @covers ::wp_get_mime_types
    576636         */
    577637        function test_wp_get_mime_types() {
    578638                $mimes = wp_get_mime_types();
     
    605665
    606666        /**
    607667         * @ticket 23688
     668         *
     669         * @covers ::get_option
     670         * @covers ::_canonical_charset
    608671         */
    609672        function test_canonical_charset() {
    610673                $orig_blog_charset = get_option( 'blog_charset' );
     
    643706        /**
    644707         * @ticket 43977
    645708         * @dataProvider data_wp_parse_list
     709         *
     710         * @covers ::wp_parse_list
    646711         */
    647712        function test_wp_parse_list( $expected, $actual ) {
    648713                $this->assertSame( $expected, array_values( wp_parse_list( $actual ) ) );
     
    666731
    667732        /**
    668733         * @dataProvider data_wp_parse_id_list
     734         *
     735         * @covers ::wp_parse_id_list
    669736         */
    670737        function test_wp_parse_id_list( $expected, $actual ) {
    671738                $this->assertSame( $expected, array_values( wp_parse_id_list( $actual ) ) );
     
    701768
    702769        /**
    703770         * @dataProvider data_device_can_upload
     771         *
     772         * @covers ::_device_can_upload
    704773         */
    705774        function test_device_can_upload( $user_agent, $expected ) {
    706775                $_SERVER['HTTP_USER_AGENT'] = $user_agent;
     
    761830
    762831        /**
    763832         * @ticket 9064
     833         *
     834         * @covers ::wp_extract_urls
    764835         */
    765836        function test_wp_extract_urls() {
    766837                $original_urls = array(
     
    928999
    9291000        /**
    9301001         * @ticket 28786
     1002         *
     1003         * @covers ::wp_json_encode
    9311004         */
    9321005        function test_wp_json_encode() {
    9331006                $this->assertEquals( wp_json_encode( 'a' ), '"a"' );
     
    9351008
    9361009        /**
    9371010         * @ticket 28786
     1011         *
     1012         * @covers ::wp_json_encode
    9381013         */
    9391014        function test_wp_json_encode_utf8() {
    9401015                $this->assertEquals( wp_json_encode( '这' ), '"\u8fd9"' );
     
    9421017
    9431018        /**
    9441019         * @ticket 28786
     1020         *
     1021         * @covers ::wp_json_encode
    9451022         */
    9461023        function test_wp_json_encode_non_utf8() {
    9471024                if ( ! function_exists( 'mb_detect_order' ) ) {
     
    9671044
    9681045        /**
    9691046         * @ticket 28786
     1047         *
     1048         * @covers ::wp_json_encode
    9701049         */
    9711050        function test_wp_json_encode_non_utf8_in_array() {
    9721051                if ( ! function_exists( 'mb_detect_order' ) ) {
     
    9921071
    9931072        /**
    9941073         * @ticket 28786
     1074         *
     1075         * @covers ::wp_json_encode
    9951076         */
    9961077        function test_wp_json_encode_array() {
    9971078                $this->assertEquals( wp_json_encode( array( 'a' ) ), '["a"]' );
     
    9991080
    10001081        /**
    10011082         * @ticket 28786
     1083         *
     1084         * @covers ::wp_json_encode
    10021085         */
    10031086        function test_wp_json_encode_object() {
    10041087                $object    = new stdClass;
     
    10081091
    10091092        /**
    10101093         * @ticket 28786
     1094         *
     1095         * @covers ::wp_json_encode
    10111096         */
    10121097        function test_wp_json_encode_depth() {
    10131098                $data = array( array( array( 1, 2, 3 ) ) );
     
    10221107        /**
    10231108         * @ticket 36054
    10241109         * @dataProvider datetime_provider
     1110         *
     1111         * @covers ::mysql_to_rfc3339
    10251112         */
    10261113        function test_mysql_to_rfc3339( $expected, $actual ) {
    10271114                $date_return = mysql_to_rfc3339( $actual );
     
    10441131
    10451132        /**
    10461133         * @ticket 35987
     1134         *
     1135         * @covers ::wp_get_ext_types
    10471136         */
    10481137        public function test_wp_get_ext_types() {
    10491138                $extensions = wp_get_ext_types();
     
    10631152
    10641153        /**
    10651154         * @ticket 35987
     1155         *
     1156         * @covers ::wp_get_ext_types
    10661157         */
    10671158        public function test_wp_ext2type() {
    10681159                $extensions = wp_get_ext_types();
     
    10841175         * test suite is -1, we can not test the memory limit negotiations.
    10851176         *
    10861177         * @ticket 32075
     1178         *
     1179         * @covers ::wp_raise_memory_limit
    10871180         */
    10881181        function test_wp_raise_memory_limit() {
    10891182                if ( -1 !== WP_MAX_MEMORY_LIMIT ) {
     
    11021195        /**
    11031196         * Tests wp_generate_uuid4().
    11041197         *
     1198         * @ticket 38164
     1199         *
    11051200         * @covers ::wp_generate_uuid4
    1106          * @ticket 38164
    11071201         */
    11081202        function test_wp_generate_uuid4() {
    11091203                $uuids = array();
     
    11201214        /**
    11211215         * Tests wp_is_uuid().
    11221216         *
     1217         * @ticket 39778
     1218         *
    11231219         * @covers ::wp_is_uuid
    1124          * @ticket 39778
    11251220         */
    11261221        function test_wp_is_valid_uuid() {
    11271222                $uuids_v4 = array(
     
    11701265        /**
    11711266         * Tests wp_unique_id().
    11721267         *
     1268         * @ticket 44883
     1269         *
    11731270         * @covers ::wp_unique_id
    1174          * @ticket 44883
    11751271         */
    11761272        function test_wp_unique_id() {
    11771273
     
    11981294        /**
    11991295         * @ticket 40017
    12001296         * @dataProvider _wp_get_image_mime
     1297         *
     1298         * @covers ::wp_get_image_mime
    12011299         */
    12021300        public function test_wp_get_image_mime( $file, $expected ) {
    12031301                if ( ! is_callable( 'exif_imagetype' ) && ! function_exists( 'getimagesize' ) ) {
     
    12101308        /**
    12111309         * @ticket 39550
    12121310         * @dataProvider _wp_check_filetype_and_ext_data
     1311         *
     1312         * @covers ::wp_check_filetype_and_ext
    12131313         */
    12141314        function test_wp_check_filetype_and_ext( $file, $filename, $expected ) {
    12151315                if ( ! extension_loaded( 'fileinfo' ) ) {
     
    12221322        /**
    12231323         * @ticket 39550
    12241324         * @group ms-excluded
     1325         *
     1326         * @covers ::wp_check_filetype_and_ext
    12251327         */
    12261328        function test_wp_check_filetype_and_ext_with_filtered_svg() {
    12271329                if ( ! extension_loaded( 'fileinfo' ) ) {
     
    12471349        /**
    12481350         * @ticket 39550
    12491351         * @group ms-excluded
     1352         *
     1353         * @covers ::wp_check_filetype_and_ext
    12501354         */
    12511355        function test_wp_check_filetype_and_ext_with_filtered_woff() {
    12521356                if ( ! extension_loaded( 'fileinfo' ) ) {
     
    14881592         * @param string $file          File path.
    14891593         * @param array  $allowed_files List of allowed files.
    14901594         * @param int    $expected      Expected result.
     1595         *
     1596         * @covers ::validate_file
    14911597         */
    14921598        public function test_validate_file( $file, $allowed_files, $expected ) {
    14931599                $this->assertSame( $expected, validate_file( $file, $allowed_files ) );
     
    16301736         *
    16311737         * @param string $path     The resource path or URL.
    16321738         * @param bool   $expected Expected result.
     1739         *
     1740         * @covers ::wp_is_stream
    16331741         */
    16341742        public function test_wp_is_stream( $path, $expected ) {
    16351743                if ( ! extension_loaded( 'openssl' ) && false !== strpos( $path, 'https://' ) ) {
     
    16741782         *
    16751783         * @param string $input    Duration.
    16761784         * @param string $expected Expected human readable duration.
     1785         *
     1786         * @covers ::human_readable_duration
    16771787         */
    16781788        public function test_human_readable_duration( $input, $expected ) {
    16791789                $this->assertSame( $expected, human_readable_duration( $input ) );
  • tests/phpunit/tests/kses.php

     
    99
    1010        /**
    1111         * @ticket 20210
     12         *
     13         * @covers ::wp_kses
    1214         */
    1315        function test_wp_filter_post_kses_address() {
    1416                global $allowedposttags;
     
    3638
    3739        /**
    3840         * @ticket 20210
     41         *
     42         * @covers ::wp_kses
    3943         */
    4044        function test_wp_filter_post_kses_a() {
    4145                global $allowedposttags;
     
    7781         * @param string $source   Source HTML.
    7882         * @param string $context  Context to use for parsing source.
    7983         * @param string $expected Expected output following KSES parsing.
     84         *
     85         * @covers ::wp_kses
    8086         */
    8187        function test_wp_kses_video( $source, $context, $expected ) {
    8288                $actual = wp_kses( $source, $context );
     
    123129
    124130        /**
    125131         * @ticket 20210
     132         *
     133         * @covers ::wp_kses
    126134         */
    127135        function test_wp_filter_post_kses_abbr() {
    128136                global $allowedposttags;
     
    141149                }
    142150        }
    143151
     152        /**
     153         *
     154         * @covers ::wp_kses
     155         */
    144156        function test_feed_links() {
    145157                global $allowedposttags;
    146158
     
    175187                $this->assertEquals( $expected, wp_kses( $content, $allowedposttags ) );
    176188        }
    177189
     190        /**
     191         *
     192         * @covers ::wp_kses_bad_protocol
     193         */
    178194        function test_wp_kses_bad_protocol() {
    179195                $bad = array(
    180196                        'dummy:alert(1)',
     
    277293                }
    278294        }
    279295
     296        /**
     297         *
     298         * @covers ::wp_kses_data
     299         */
    280300        public function test_hackers_attacks() {
    281301                $xss = simplexml_load_file( DIR_TESTDATA . '/formatting/xssAttacks.xml' );
    282302                foreach ( $xss->attack as $attack ) {
     
    421441
    422442        /**
    423443         * @ticket 20210
     444         *
     445         * @covers ::wp_kses_allowed_html
    424446         */
    425447        public function test_wp_kses_allowed_html() {
    426448                global $allowedposttags, $allowedtags, $allowedentitynames;
     
    470492                $this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) );
    471493        }
    472494
     495        /**
     496         *
     497         * @covers ::wp_kses_post
     498         */
    473499        function test_hyphenated_tag() {
    474500                $string                 = '<hyphenated-tag attribute="value" otherattribute="value2">Alot of hyphens.</hyphenated-tag>';
    475501                $custom_tags            = array(
     
    486512
    487513        /**
    488514         * @ticket 26290
     515         *
     516         * @covers ::wp_kses_normalize_entities
    489517         */
    490518        public function test_wp_kses_normalize_entities() {
    491519                $this->assertEquals( '&spades;', wp_kses_normalize_entities( '&spades;' ) );
     
    504532         *
    505533         * @ticket 28506
    506534         * @dataProvider data_ctrl_removal
     535         *
     536         * @covers ::wp_kses
    507537         */
    508538        function test_ctrl_removal( $input, $output ) {
    509539                global $allowedposttags;
     
    541571         *
    542572         * @ticket 28699
    543573         * @dataProvider data_slash_zero_removal
     574         *
     575         * @covers ::wp_kses
    544576         */
    545577        function test_slash_zero_removal( $input, $output ) {
    546578                global $allowedposttags;
     
    593625         * Test new function wp_kses_hair_parse().
    594626         *
    595627         * @dataProvider data_hair_parse
     628         *
     629         * @covers ::wp_kses_hair_parse
    596630         */
    597631        function test_hair_parse( $input, $output ) {
    598632                return $this->assertEquals( $output, wp_kses_hair_parse( $input ) );
     
    659693         * Test new function wp_kses_attr_parse().
    660694         *
    661695         * @dataProvider data_attr_parse
     696         *
     697         * @covers ::wp_kses_attr_parse
    662698         */
    663699        function test_attr_parse( $input, $output ) {
    664700                return $this->assertEquals( $output, wp_kses_attr_parse( $input ) );
     
    717753         * Test new function wp_kses_one_attr().
    718754         *
    719755         * @dataProvider data_one_attr
     756         *
     757         * @covers ::wp_kses_one_attr
    720758         */
    721759        function test_one_attr( $element, $input, $output ) {
    722760                return $this->assertEquals( $output, wp_kses_one_attr( $input, $element ) );
     
    794832
    795833        /**
    796834         * @ticket 34063
     835         *
     836         * @covers ::wp_kses
    797837         */
    798838        function test_bdo() {
    799839                global $allowedposttags;
     
    805845
    806846        /**
    807847         * @ticket 35079
     848         *
     849         * @covers ::wp_kses
    808850         */
    809851        function test_ol_reversed() {
    810852                global $allowedposttags;
     
    816858
    817859        /**
    818860         * @ticket 40680
     861         *
     862         * @covers ::wp_kses_attr
    819863         */
    820864        function test_wp_kses_attr_no_attributes_allowed_with_empty_array() {
    821865                $element   = 'foo';
     
    826870
    827871        /**
    828872         * @ticket 40680
     873         *
     874         * @covers ::wp_kses_attr
    829875         */
    830876        function test_wp_kses_attr_no_attributes_allowed_with_true() {
    831877                $element   = 'foo';
     
    836882
    837883        /**
    838884         * @ticket 40680
     885         *
     886         * @covers ::wp_kses_attr
    839887         */
    840888        function test_wp_kses_attr_single_attribute_is_allowed() {
    841889                $element   = 'foo';
     
    846894
    847895        /**
    848896         * @ticket 43312
     897         *
     898         * @covers ::wp_kses_attr
    849899         */
    850900        function test_wp_kses_attr_no_attributes_allowed_with_false() {
    851901                $element   = 'foo';
     
    864914         *
    865915         * @param string $css      A string of CSS rules.
    866916         * @param string $expected Expected string of CSS rules.
     917         *
     918         * @covers ::safecss_filter_attr
    867919         */
    868920        public function test_safecss_filter_attr( $css, $expected ) {
    869921                $this->assertSame( $expected, safecss_filter_attr( $css ) );
     
    10521104         * Data attributes are globally accepted.
    10531105         *
    10541106         * @ticket 33121
     1107         *
     1108         * @covers ::wp_kses_post
    10551109         */
    10561110        function test_wp_kses_attr_data_attribute_is_allowed() {
    10571111                $test     = '<div data-foo="foo" data-bar="bar" datainvalid="gone" data--invaild="gone"  data-also-invaild-="gone" data-two-hyphens="remains">Pens and pencils</div>';
     
    10641118         * Ensure wildcard attributes block unprefixed wildcard uses.
    10651119         *
    10661120         * @ticket 33121
     1121         *
     1122         * @covers ::wp_kses
    10671123         */
    10681124        function test_wildcard_requires_hyphen_after_prefix() {
    10691125                $allowed_html = array(
     
    10851141         * Ensure wildcard allows two hyphen.
    10861142         *
    10871143         * @ticket 33121
     1144         *
     1145         * @covers ::wp_kses
    10881146         */
    10891147        function test_wildcard_allows_two_hyphens() {
    10901148                $allowed_html = array(
     
    11071165         * @dataProvider data_wildcard_attribute_prefixes
    11081166         *
    11091167         * @ticket 33121
     1168         *
     1169         * @covers ::wp_kses_attr_check
    11101170         */
    11111171        function test_wildcard_attribute_prefixes( $wildcard_attribute, $expected ) {
    11121172                $allowed_html = array(
     
    11521212         *
    11531213         * @param $input string The style attribute saved in the editor.
    11541214         * @param $expected string The sanitized style attribute.
     1215         *
     1216         * @covers ::safecss_filter_attr
    11551217         */
    11561218        function test_kses_style_attr_with_url( $input, $expected ) {
    11571219                $actual = safecss_filter_attr( $input );
     
    12991361         *
    13001362         * @param string $css      A string of CSS rules.
    13011363         * @param string $expected Expected string of CSS rules.
     1364         *
     1365         * @covers ::safecss_filter_attr
    13021366         */
    13031367        public function test_safecss_filter_attr_filtered( $css, $expected ) {
    13041368                add_filter( 'safecss_filter_attr_allow_css', '__return_true' );
     
    13661430         * Test filtering a standard img tag.
    13671431         *
    13681432         * @ticket 50731
     1433         *
     1434         * @covers ::wp_kses_post
    13691435         */
    13701436        function test_wp_kses_img_tag_standard_attributes() {
    13711437                $html = array(
  • tests/phpunit/tests/l10n.php

     
    1717
    1818        /**
    1919         * @ticket 35961
     20         *
     21         * @covers ::_n_noop
    2022         */
    2123        function test_n_noop() {
    2224                $text_domain   = 'text-domain';
     
    3032
    3133        /**
    3234         * @ticket 35961
     35         *
     36         * @covers ::_nx_noop
    3337         */
    3438        function test_nx_noop() {
    3539                $text_domain   = 'text-domain';
     
    4448
    4549        /**
    4650         * @ticket 35073
     51         *
     52         * @covers ::before_last_bar
    4753         */
    4854        function test_before_last_bar() {
    4955                $this->assertEquals( 'no-bar-at-all', before_last_bar( 'no-bar-at-all' ) );
     
    5359
    5460        /**
    5561         * @ticket 35950
     62         *
     63         * @covers ::get_available_languages
    5664         */
    5765        function test_get_available_languages() {
    5866                $array = get_available_languages();
     
    6775
    6876        /**
    6977         * @ticket 35284
     78         *
     79         * @covers ::wp_get_installed_translations
    7080         */
    7181        function test_wp_get_installed_translations_for_core() {
    7282                $installed_translations = wp_get_installed_translations( 'core' );
     
    8999
    90100        /**
    91101         * @ticket 35294
     102         *
     103         * @covers ::wp_dropdown_languages
    92104         */
    93105        function test_wp_dropdown_languages() {
    94106                $args   = array(
     
    111123
    112124        /**
    113125         * @ticket 38632
     126         *
     127         * @covers ::wp_dropdown_languages
    114128         */
    115129        function test_wp_dropdown_languages_site_default() {
    116130                $args   = array(
     
    135149
    136150        /**
    137151         * @ticket 44494
     152         *
     153         * @covers ::wp_dropdown_languages
    138154         */
    139155        function test_wp_dropdown_languages_exclude_en_us() {
    140156                $args   = array(
     
    153169
    154170        /**
    155171         * @ticket 38632
     172         *
     173         * @covers ::wp_dropdown_languages
    156174         */
    157175        function test_wp_dropdown_languages_en_US_selected() {
    158176                $args   = array(
     
    175193
    176194        /**
    177195         * Add site default language to ja_JP in dropdown
     196         *
     197         * @covers ::wp_dropdown_languages
    178198         */
    179199        function test_wp_dropdown_languages_site_default_ja_JP() {
    180200                $args   = array(
     
    199219
    200220        /**
    201221         * Select dropdown language from de_DE to ja_JP
     222         *
     223         * @covers ::wp_dropdown_languages
    202224         */
    203225        function test_wp_dropdown_languages_ja_JP_selected() {
    204226                $args   = array(
     
    246268
    247269        /**
    248270         * @ticket 35284
     271         *
     272         * @covers ::wp_get_pomo_file_data
    249273         */
    250274        function test_wp_get_pomo_file_data() {
    251275                $file  = DIR_TESTDATA . '/pomo/empty.po';
     
    272296
    273297        /**
    274298         * @ticket 44541
     299         *
     300         * @covers ::the_excerpt
    275301         */
    276302        function test_length_of_excerpt_should_be_counted_by_words() {
    277303                global $post;
     
    296322
    297323        /**
    298324         * @ticket 44541
     325         *
     326         * @covers ::the_excerpt
    299327         */
    300328        function test_length_of_excerpt_should_be_counted_by_chars() {
    301329                global $post;
     
    320348
    321349        /**
    322350         * @ticket 44541
     351         *
     352         * @covers ::the_excerpt
    323353         */
    324354        function test_length_of_excerpt_should_be_counted_by_chars_in_japanese() {
    325355                global $post;
     
    344374
    345375        /**
    346376         * @ticket 44541
     377         *
     378         * @covers ::the_excerpt_rss
    347379         */
    348380        function test_length_of_excerpt_rss_should_be_counted_by_words() {
    349381                global $post;
     
    368400
    369401        /**
    370402         * @ticket 44541
     403         *
     404         * @covers ::the_excerpt_rss
    371405         */
    372406        function test_length_of_excerpt_rss_should_be_counted_by_chars() {
    373407                global $post;
     
    393427
    394428        /**
    395429         * @ticket 44541
     430         *
     431         * @covers ::wp_dashboard_recent_drafts
    396432         */
    397433        function test_length_of_draft_should_be_counted_by_words() {
    398434                require_once ABSPATH . 'wp-admin/includes/dashboard.php';
     
    417453
    418454        /**
    419455         * @ticket 44541
     456         *
     457         * @covers ::wp_dashboard_recent_drafts
    420458         */
    421459        function test_length_of_draft_should_be_counted_by_chars() {
    422460                require_once ABSPATH . 'wp-admin/includes/dashboard.php';
     
    441479
    442480        /**
    443481         * @ticket 44541
     482         *
     483         * @covers ::wp_dashboard_recent_drafts
    444484         */
    445485        function test_length_of_draft_should_be_counted_by_chars_in_japanese() {
    446486                require_once ABSPATH . 'wp-admin/includes/dashboard.php';
     
    465505
    466506        /**
    467507         * @ticket 44541
     508         *
     509         * @covers ::get_comment_excerpt
    468510         */
    469511        function test_length_of_comment_excerpt_should_be_counted_by_words() {
    470512                switch_to_locale( 'en_US' );
     
    483525
    484526        /**
    485527         * @ticket 44541
     528         *
     529         * @covers ::get_comment_excerpt
    486530         */
    487531        function test_length_of_comment_excerpt_should_be_counted_by_chars() {
    488532                switch_to_locale( 'ja_JP' );
     
    501545
    502546        /**
    503547         * @ticket 44541
     548         *
     549         * @covers ::get_comment_excerpt
    504550         */
    505551        function test_length_of_comment_excerpt_should_be_counted_by_chars_in_Japanese() {
    506552                switch_to_locale( 'ja_JP' );
  • tests/phpunit/tests/link.php

     
    1010
    1111        /**
    1212         * @ticket 8847
     13         *
     14         * @covers ::get_pagenum_link
    1315         */
    1416        function test_get_pagenum_link_case_insensitivity() {
    1517                $old_req_uri = $_SERVER['REQUEST_URI'];
     
    2628                $_SERVER['REQUEST_URI'] = $old_req_uri;
    2729        }
    2830
     31        /**
     32         *
     33         * @covers ::wp_get_shortlink
     34         */
    2935        function test_wp_get_shortlink() {
    3036                $post_id  = self::factory()->post->create();
    3137                $post_id2 = self::factory()->post->create();
     
    7076                $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() );
    7177        }
    7278
     79        /**
     80         *
     81         * @covers ::wp_get_shortlink
     82         */
    7383        function test_wp_get_shortlink_with_page() {
    7484                $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    7585
     
    8494
    8595        /**
    8696         * @ticket 26871
     97         *
     98         * @covers ::wp_get_shortlink
    8799         */
    88100        function test_wp_get_shortlink_with_home_page() {
    89101                $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
     
    99111
    100112        /**
    101113         * @ticket 30910
     114         *
     115         * @covers ::get_permalink
    102116         */
    103117        public function test_get_permalink_should_not_reveal_post_name_for_post_with_post_status_future() {
    104118                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
     
    114128
    115129                $non_pretty_permalink = add_query_arg( 'p', $p, trailingslashit( home_url() ) );
    116130
    117                 $this->assertEquals( $non_pretty_permalink, get_permalink( $p ) );
     131                $this->assertSame( $non_pretty_permalink, get_permalink( $p ) );
    118132        }
    119133
    120134        /**
    121135         * @ticket 30910
     136         *
     137         * @covers ::get_permalink
    122138         */
    123139        public function test_get_permalink_should_not_reveal_post_name_for_cpt_with_post_status_future() {
    124140                update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' );
     
    148164
    149165        /**
    150166         * @ticket 1914
     167         *
     168         * @covers ::get_permalink
    151169         */
    152170        public function test_unattached_attachment_has_a_pretty_permalink() {
    153171                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
     
    170188
    171189        /**
    172190         * @ticket 1914
     191         *
     192         * @covers ::get_permalink
    173193         */
    174194        public function test_attachment_attached_to_non_existent_post_type_has_a_pretty_permalink() {
    175195                global $wp_post_types;
  • tests/phpunit/tests/locale.php

     
    1515                $this->locale = new WP_Locale();
    1616        }
    1717
     18        /**
     19         *
     20         * @covers WP_Locale::get_weekday
     21         */
    1822        public function test_get_weekday() {
    1923                $this->assertEquals( __( 'Sunday' ), $this->locale->get_weekday( 0 ) );
    2024                $this->assertEquals( __( 'Monday' ), $this->locale->get_weekday( 1 ) );
     
    2731
    2832        /**
    2933         * @expectedException PHPUnit_Framework_Error_Notice
     34         *
     35         * @covers WP_Locale::get_weekday
    3036         */
    3137        public function test_get_weekday_undefined_index() {
    3238                $this->locale->get_weekday( 7 );
    3339        }
    3440
     41        /**
     42         *
     43         * @covers WP_Locale::get_weekday_initial
     44         */
    3545        public function test_get_weekday_initial() {
    3646                $this->assertEquals( __( 'S' ), $this->locale->get_weekday_initial( __( 'Sunday' ) ) );
    3747                $this->assertEquals( __( 'M' ), $this->locale->get_weekday_initial( __( 'Monday' ) ) );
     
    4252                $this->assertEquals( __( 'S' ), $this->locale->get_weekday_initial( __( 'Saturday' ) ) );
    4353        }
    4454
     55        /**
     56         *
     57         * @covers WP_Locale::get_weekday_abbrev
     58         */
    4559        public function test_get_weekday_abbrev() {
    4660                $this->assertEquals( __( 'Sun' ), $this->locale->get_weekday_abbrev( __( 'Sunday' ) ) );
    4761                $this->assertEquals( __( 'Mon' ), $this->locale->get_weekday_abbrev( __( 'Monday' ) ) );
     
    5266                $this->assertEquals( __( 'Sat' ), $this->locale->get_weekday_abbrev( __( 'Saturday' ) ) );
    5367        }
    5468
     69        /**
     70         *
     71         * @covers WP_Locale::get_month
     72         */
    5573        public function test_get_month() {
    5674                $this->assertEquals( __( 'January' ), $this->locale->get_month( 1 ) );
    5775                $this->assertEquals( __( 'February' ), $this->locale->get_month( 2 ) );
     
    6785                $this->assertEquals( __( 'December' ), $this->locale->get_month( 12 ) );
    6886        }
    6987
     88        /**
     89         *
     90         * @covers WP_Locale::get_month
     91         */
    7092        public function test_get_month_leading_zero() {
    7193                $this->assertEquals( __( 'January' ), $this->locale->get_month( '01' ) );
    7294                $this->assertEquals( __( 'February' ), $this->locale->get_month( '02' ) );
     
    79101                $this->assertEquals( __( 'September' ), $this->locale->get_month( '09' ) );
    80102        }
    81103
     104        /**
     105         *
     106         * @covers WP_Locale::get_month_abbrev
     107         */
    82108        public function test_get_month_abbrev() {
    83109                $this->assertEquals( __( 'Jan' ), $this->locale->get_month_abbrev( __( 'January' ) ) );
    84110                $this->assertEquals( __( 'Feb' ), $this->locale->get_month_abbrev( __( 'February' ) ) );
     
    94120                $this->assertEquals( __( 'Dec' ), $this->locale->get_month_abbrev( __( 'December' ) ) );
    95121        }
    96122
     123        /**
     124         *
     125         * @covers WP_Locale::get_meridiem
     126         */
    97127        public function test_get_meridiem() {
    98128                $this->assertEquals( __( 'am' ), $this->locale->get_meridiem( 'am' ) );
    99129                $this->assertEquals( __( 'AM' ), $this->locale->get_meridiem( 'AM' ) );
     
    101131                $this->assertEquals( __( 'PM' ), $this->locale->get_meridiem( 'PM' ) );
    102132        }
    103133
     134        /**
     135         *
     136         * @covers WP_Locale::is_rtl
     137         */
    104138        public function test_is_rtl() {
    105139                $this->assertFalse( $this->locale->is_rtl() );
    106140                $this->locale->text_direction = 'foo';
  • tests/phpunit/tests/mail.php

     
    2121         * when it encounters a line longer than 999 characters. But PHPMailer doesn't clean up after itself / presets
    2222         * all variables, which means that following tests would fail. To solve this issue we set `$this->Encoding`
    2323         * back to 8bit in `MockPHPMailer::preSend`.
     24         *
     25         * @covers ::wp_mail
    2426         */
    2527        function test_wp_mail_break_it() {
    2628                $content = str_repeat( 'A', 1000 );
     
    2729                $this->assertTrue( wp_mail( WP_TESTS_EMAIL, 'Looong line testing', $content ) );
    2830        }
    2931
     32        /**
     33         *
     34         * @covers ::wp_mail
     35         */
    3036        function test_wp_mail_custom_boundaries() {
    3137                $to       = 'user@example.com';
    3238                $subject  = 'Test email with custom boundaries';
     
    8793
    8894        /**
    8995         * @ticket 17305
     96         *
     97         * @covers ::wp_mail
    9098         */
    9199        function test_wp_mail_rfc2822_addresses() {
    92100                $to        = 'Name <address@tld.com>';
     
    117125
    118126        /**
    119127         * @ticket 17305
     128         *
     129         * @covers ::wp_mail
    120130         */
    121131        function test_wp_mail_multiple_rfc2822_to_addresses() {
    122132                $to      = 'Name <address@tld.com>, Another Name <another_address@different-tld.com>';
     
    135145                $this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body );
    136146        }
    137147
     148        /**
     149         *
     150         * @covers ::wp_mail
     151         */
    138152        function test_wp_mail_multiple_to_addresses() {
    139153                $to      = 'address@tld.com, another_address@different-tld.com';
    140154                $subject = 'RFC2822 Testing';
     
    150164
    151165        /**
    152166         * @ticket 18463
     167         *
     168         * @covers ::wp_mail
    153169         */
    154170        function test_wp_mail_to_address_no_name() {
    155171                $to      = '<address@tld.com>';
     
    165181
    166182        /**
    167183         * @ticket 23642
     184         *
     185         * @covers ::wp_mail
    168186         */
    169187        function test_wp_mail_return_value() {
    170188                // No errors.
     
    179197
    180198        /**
    181199         * @ticket 30266
     200         *
     201         * @covers ::wp_mail
    182202         */
    183203        public function test_wp_mail_with_valid_from_header() {
    184204                $to       = 'address@tld.com';
     
    195215
    196216        /**
    197217         * @ticket 30266
     218         *
     219         * @covers ::wp_mail
    198220         */
    199221        public function test_wp_mail_with_empty_from_header() {
    200222                $to       = 'address@tld.com';
     
    211233
    212234        /**
    213235         * @ticket 30266
     236         *
     237         * @covers ::wp_mail
    214238         */
    215239        public function test_wp_mail_with_empty_from_name_for_the_from_header() {
    216240                $to       = 'address@tld.com';
     
    227251
    228252        /**
    229253         * @ticket 30266
     254         *
     255         * @covers ::wp_mail
    230256         */
    231257        public function test_wp_mail_with_valid_content_type_header() {
    232258                $to       = 'address@tld.com';
     
    243269
    244270        /**
    245271         * @ticket 30266
     272         *
     273         * @covers ::wp_mail
    246274         */
    247275        public function test_wp_mail_with_empty_content_type_header() {
    248276                $to       = 'address@tld.com';
     
    259287
    260288        /**
    261289         * @ticket 30266
     290         *
     291         * @covers ::wp_mail
    262292         */
    263293        public function test_wp_mail_with_empty_charset_for_the_content_type_header() {
    264294                $to       = 'address@tld.com';
     
    275305
    276306        /**
    277307         * @ticket 43542
     308         *
     309         * @covers ::wp_mail
    278310         */
    279311        public function test_wp_mail_does_not_duplicate_mime_version_header() {
    280312                $to       = 'user@example.com';
     
    308340         * https://tools.ietf.org/html/rfc2045#section-6.1
    309341         *
    310342         * @ticket 28039
     343         *
     344         * @covers ::wp_mail
    311345         */
    312346        function test_wp_mail_content_transfer_encoding_in_quoted_printable_multipart() {
    313347                add_action( 'phpmailer_init', array( $this, 'wp_mail_quoted_printable' ) );
     
    325359
    326360        /**
    327361         * @ticket 21659
     362         *
     363         * @covers ::wp_mail
    328364         */
    329365        public function test_wp_mail_addresses_arent_encoded() {
    330366                $to      = 'Lukáš To <to@example.org>';
     
    367403         * set it correctly.
    368404         *
    369405         * @ticket 37736
     406         *
     407         * @covers ::wp_mail
    370408         */
    371409        public function test_wp_mail_sender_not_set() {
    372410                wp_mail( 'user@example.org', 'Testing the Sender field', 'The Sender field should not have been set.' );
     
    378416
    379417        /**
    380418         * @ticket 35598
     419         *
     420         * @covers ::wp_mail
    381421         */
    382422        public function test_phpmailer_exception_thrown() {
    383423                $to      = 'an_invalid_address';
     
    410450
    411451        /**
    412452         * @ticket 50720
     453         *
     454         * @coversNothing
    413455         */
    414456        function test_phpmailer_validator() {
    415457                $phpmailer = $GLOBALS['phpmailer'];
  • tests/phpunit/tests/media.php

     
    4646                );
    4747        }
    4848
     49        /**
     50         * @covers ::add_shortcode
     51         */
    4952        function test_img_caption_shortcode_added() {
    5053                global $shortcode_tags;
    5154                $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
     
    5255                $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
    5356        }
    5457
     58        /**
     59         * @covers ::img_caption_shortcode
     60         */
    5561        function test_img_caption_shortcode_with_empty_params() {
    5662                $result = img_caption_shortcode( array() );
    5763                $this->assertNull( $result );
     
    5965
    6066        /**
    6167         * @ticket 33981
     68         *
     69         * @covers ::img_caption_shortcode
    6270         */
    6371        function test_img_caption_shortcode_with_empty_params_but_content() {
    6472                $result = img_caption_shortcode( array(), $this->caption );
     
    6775
    6876        /**
    6977         * @ticket 33981
     78         *
     79         * @covers ::img_caption_shortcode
    7080         */
    7181        function test_img_caption_shortcode_short_circuit_filter() {
    7282                add_filter( 'img_caption_shortcode', array( $this, '_return_alt_caption' ) );
     
    8494
    8595        /**
    8696         * @ticket 33981
     97         *
     98         * @covers ::img_caption_shortcode
    8799         */
    88100    &nbs