Make WordPress Core

Ticket #39265: root.patch

File root.patch, 264.7 KB (added by pbearne, 5 years ago)

all the files in the root of test

  • package-lock.json

     
    59615961                },
    59625962                "bl": {
    59635963                        "version": "1.2.2",
    5964                         "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
     5964                        "resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
    59655965                        "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==",
    59665966                        "dev": true,
    59675967                        "optional": true,
     
    61526152                },
    61536153                "browserify-aes": {
    61546154                        "version": "1.2.0",
    6155                         "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
     6155                        "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
    61566156                        "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
    61576157                        "dev": true,
    61586158                        "requires": {
     
    75087508                },
    75097509                "create-hash": {
    75107510                        "version": "1.2.0",
    7511                         "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
     7511                        "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
    75127512                        "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
    75137513                        "dev": true,
    75147514                        "requires": {
     
    75217521                },
    75227522                "create-hmac": {
    75237523                        "version": "1.1.7",
    7524                         "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
     7524                        "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
    75257525                        "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
    75267526                        "dev": true,
    75277527                        "requires": {
     
    75877587                },
    75887588                "css-color-names": {
    75897589                        "version": "0.0.4",
    7590                         "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
     7590                        "resolved": "http://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
    75917591                        "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=",
    75927592                        "dev": true
    75937593                },
     
    85728572                },
    85738573                "diffie-hellman": {
    85748574                        "version": "5.0.3",
    8575                         "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
     8575                        "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
    85768576                        "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==",
    85778577                        "dev": true,
    85788578                        "requires": {
     
    88018801                },
    88028802                "duplexer": {
    88038803                        "version": "0.1.1",
    8804                         "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
     8804                        "resolved": "http://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
    88058805                        "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
    88068806                        "dev": true
    88078807                },
     
    2040020400                },
    2040120401                "react-autosize-textarea": {
    2040220402                        "version": "3.0.3",
    20403                         "resolved": "https://registry.npmjs.org/react-autosize-textarea/-/react-autosize-textarea-3.0.3.tgz",
     20403                        "resolved": "http://registry.npmjs.org/react-autosize-textarea/-/react-autosize-textarea-3.0.3.tgz",
    2040420404                        "integrity": "sha512-iOSZK7RUuJ+iEwkJ9rqYciqtjQgrG1CCRFL6h8Bk61kODnRyEq4tS74IgXpI1t4S6jBBZVm+6ugaU+tWTlVxXg==",
    2040520405                        "requires": {
    2040620406                                "autosize": "^4.0.0",
     
    2212422124                },
    2212522125                "sha.js": {
    2212622126                        "version": "2.4.11",
    22127                         "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
     22127                        "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
    2212822128                        "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
    2212922129                        "dev": true,
    2213022130                        "requires": {
  • 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         *
     33         * @covers ::remove_action
     34         */
    2735        function test_remove_action() {
    2836                $a   = new MockAction();
    2937                $tag = __FUNCTION__;
     
    4351
    4452        }
    4553
     54        /**
     55         *
     56         * @covers ::has_action
     57         */
    4658        function test_has_action() {
    4759                $tag  = __FUNCTION__;
    4860                $func = __FUNCTION__ . '_func';
     
    5769                $this->assertFalse( has_action( $tag ) );
    5870        }
    5971
    60         // One tag with multiple actions.
     72        /**
     73         * One tag with multiple actions.
     74         *
     75         * @covers ::add_action
     76         */
    6177        function test_multiple_actions() {
    6278                $a1  = new MockAction();
    6379                $a2  = new MockAction();
     
    7490                $this->assertEquals( 1, $a2->get_call_count() );
    7591        }
    7692
     93        /**
     94         * One tag with multiple actions.
     95         *
     96         * @covers ::do_action
     97         */
    7798        function test_action_args_1() {
    7899                $a   = new MockAction();
    79100                $tag = __FUNCTION__;
     
    89110                $this->assertEquals( array( $val ), array_pop( $argsvar ) );
    90111        }
    91112
     113        /**
     114         * One tag with multiple actions.
     115         *
     116         * @covers ::do_action
     117         */
    92118        function test_action_args_2() {
    93119                $a1   = new MockAction();
    94120                $a2   = new MockAction();
     
    120146         *
    121147         * @see https://core.trac.wordpress.org/ticket/17817#comment:72
    122148         * @ticket 17817
     149         *
     150         * @covers ::do_action
    123151         */
    124152        function test_action_args_3() {
    125153                $a1   = new MockAction();
     
    157185         * Tests PHP 4 notation for calling actions while passing in an object by reference.
    158186         *
    159187         * @ticket 48312
     188         *
     189         * @covers ::do_action
    160190         */
    161191        function test_action_args_with_php4_syntax() {
    162192                $a   = new MockAction();
     
    201231                $this->assertEquals( $expected, $a->get_events() );
    202232        }
    203233
     234        /**
     235         *
     236         * @covers ::did_action
     237         */
    204238        function test_did_action() {
    205239                $tag1 = 'action1';
    206240                $tag2 = 'action2';
     
    222256
    223257        }
    224258
     259        /**
     260         *
     261         * @covers ::add_action
     262         */
    225263        function test_all_action() {
    226264                $a    = new MockAction();
    227265                $tag1 = __FUNCTION__ . '_1';
     
    246284
    247285        }
    248286
     287        /**
     288         *
     289         * @covers ::remove_action
     290         */
    249291        function test_remove_all_action() {
    250292                $a   = new MockAction();
    251293                $tag = __FUNCTION__;
     
    266308                $this->assertEquals( array( $tag ), $a->get_tags() );
    267309        }
    268310
     311        /**
     312         *
     313         * @covers ::do_action_ref_array
     314         */
    269315        function test_action_ref_array() {
    270316                $obj = new stdClass();
    271317                $a   = new MockAction();
     
    284330
    285331        /**
    286332         * @ticket 11241
     333         *
     334         * @covers ::add_action
    287335         */
    288336        function test_action_keyed_array() {
    289337                $a = new MockAction();
     
    309357
    310358        }
    311359
     360        /**
     361         *
     362         * @covers ::do_action
     363         */
    312364        function test_action_self_removal() {
    313365                add_action( 'test_action_self_removal', array( $this, 'action_self_removal' ) );
    314366                do_action( 'test_action_self_removal' );
     
    321373
    322374        /**
    323375         * @ticket 17817
     376         *
     377         * @covers ::do_action
    324378         */
    325379        function test_action_recursion() {
    326380                $tag = __FUNCTION__;
     
    336390                $this->assertEquals( 2, $b->get_call_count(), 'recursive actions should call callbacks with later priority' );
    337391        }
    338392
     393        /**
     394         *
     395         * @covers ::do_action
     396         */
    339397        function action_that_causes_recursion( $tag ) {
    340398                static $recursing = false;
    341399                if ( ! $recursing ) {
     
    348406        /**
    349407         * @ticket 9968
    350408         * @ticket 17817
     409         *
     410         * @covers ::add_action
    351411         */
    352412        function test_action_callback_manipulation_while_running() {
    353413                $tag = __FUNCTION__;
     
    383443         *
    384444         * This specificaly addresses the concern raised at
    385445         * https://core.trac.wordpress.org/ticket/17817#comment:52
     446         *
     447         * @covers ::remove_filter
    386448         */
    387449        function test_remove_anonymous_callback() {
    388450                $tag = __FUNCTION__;
     
    416478         * Test the ArrayAccess methods of WP_Hook
    417479         *
    418480         * @ticket 17817
     481         *
     482         * @covers ::has_action
    419483         */
    420484        function test_array_access_of_wp_filter_global() {
    421485                global $wp_filter;
     
    442506         * Make sure current_action() behaves as current_filter()
    443507         *
    444508         * @ticket 14994
     509         *
     510         * @covers ::current_action
    445511         */
    446512        function test_current_action() {
    447513                global $wp_current_filter;
     
    453519
    454520        /**
    455521         * @ticket 14994
     522         *
     523         * @covers ::doing_filter
    456524         */
    457525        function test_doing_filter() {
    458526                global $wp_current_filter;
     
    472540
    473541        /**
    474542         * @ticket 14994
     543         *
     544         * @covers ::doing_filter
    475545         */
    476546        function test_doing_action() {
    477547                global $wp_current_filter;
     
    491561
    492562        /**
    493563         * @ticket 14994
     564         *
     565         * @covers ::doing_filter
    494566         */
    495567        function test_doing_filter_real() {
    496568                $this->assertFalse( doing_filter() );            // No filter is passed in, and no filter is being processed.
     
    509581                $this->assertFalse( doing_filter( 'testing' ) ); // No longer doing this filter.
    510582        }
    511583
     584        /**
     585         *
     586         * @covers ::doing_filter
     587         */
    512588        function apply_testing_filter() {
    513589                $this->apply_testing_filter = true;
    514590
     
    530606                $this->assertFalse( doing_filter( 'testing_nested' ) );
    531607        }
    532608
     609        /**
     610         *
     611         * @covers ::doing_filter
     612         */
    533613        function apply_testing_nested_filter() {
    534614                $this->apply_testing_nested_filter = true;
    535615                $this->assertTrue( doing_filter() );
     
    541621        /**
    542622         * @ticket 10441
    543623         * @expectedDeprecated tests_do_action_deprecated
     624         *
     625         * @covers ::do_action_deprecated
    544626         */
    545627        public function test_do_action_deprecated() {
    546628                $p = new WP_Post( (object) array( 'post_title' => 'Foo' ) );
     
    559641        /**
    560642         * @ticket 10441
    561643         * @expectedDeprecated tests_do_action_deprecated
     644         *
     645         * @covers ::do_action_deprecated
    562646         */
    563647        public function test_do_action_deprecated_with_multiple_params() {
    564648                $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         *
     256         *
     257         * @return mixed
     258         *
     259         * @covers ::is_admin_bar_showing
     260         */
    242261        protected function get_standard_admin_bar() {
    243262                global $wp_admin_bar;
    244263
     
    259278         *
    260279         * @param array  $node_data     The data for a node, passed to `WP_Admin_Bar::add_node()`.
    261280         * @param string $expected_html The expected HTML when admin menu is rendered.
     281         *
     282         * @covers WP_Admin_Bar::add_node
    262283         */
    263284        public function test_admin_bar_with_tabindex_meta( $node_data, $expected_html ) {
    264285                $admin_bar = new WP_Admin_Bar();
     
    347368
    348369        /**
    349370         * @ticket 22247
     371         *
     372         * @covers ::_wp_admin_bar_init
     373         *
     374         * @covers WP_Admin_Bar::get_node
    350375         */
    351376        public function test_admin_bar_has_edit_link_for_existing_posts() {
    352377                wp_set_current_user( self::$editor_id );
     
    374399
    375400        /**
    376401         * @ticket 22247
     402         *
     403         * @covers WP_Admin_Bar::get_node
    377404         */
    378405        public function test_admin_bar_has_no_edit_link_for_non_existing_posts() {
    379406                wp_set_current_user( self::$editor_id );
     
    393420
    394421        /**
    395422         * @ticket 34113
     423         *
     424         * @covers WP_Admin_Bar::get_node
    396425         */
    397426        public function test_admin_bar_has_no_archives_link_if_no_static_front_page() {
    398427                set_current_screen( 'edit-post' );
     
    407436
    408437        /**
    409438         * @ticket 34113
     439         *
     440         * @covers WP_Admin_Bar::get_node
    410441         */
    411442        public function test_admin_bar_contains_view_archive_link_if_static_front_page() {
    412443                update_option( 'show_on_front', 'page' );
     
    422453
    423454        /**
    424455         * @ticket 34113
     456         *
     457         * @covers WP_Admin_Bar::get_node
    425458         */
    426459        public function test_admin_bar_has_no_archives_link_for_pages() {
    427460                set_current_screen( 'edit-page' );
     
    437470        /**
    438471         * @ticket 37949
    439472         * @group ms-excluded
     473         *
     474         * @covers WP_Admin_Bar::get_node
    440475         */
    441476        public function test_admin_bar_contains_correct_about_link_for_users_with_role() {
    442477                wp_set_current_user( self::$editor_id );
     
    454489        /**
    455490         * @ticket 37949
    456491         * @group ms-excluded
     492         *
     493         * @covers WP_Admin_Bar::get_node
    457494         */
    458495        public function test_admin_bar_contains_correct_about_link_for_users_with_no_role() {
    459496                wp_set_current_user( self::$no_role_id );
     
    473510         * @ticket 37949
    474511         * @group multisite
    475512         * @group ms-required
     513         *
     514         * @covers WP_Admin_Bar::get_node
    476515         */
    477516        public function test_admin_bar_contains_correct_about_link_for_users_with_no_role_in_multisite() {
    478517                // User is not a member of a site.
     
    492531
    493532        /**
    494533         * @ticket 34113
     534         *
     535         * @covers WP_Admin_Bar::get_node
    495536         */
    496537        public function test_admin_bar_has_no_archives_link_for_non_public_cpt() {
    497538                register_post_type(
     
    516557
    517558        /**
    518559         * @ticket 34113
     560         *
     561         * @covers WP_Admin_Bar::get_node
    519562         */
    520563        public function test_admin_bar_has_no_archives_link_for_cpt_without_archive() {
    521564                register_post_type(
     
    540583
    541584        /**
    542585         * @ticket 34113
     586         *
     587         * @covers WP_Admin_Bar::get_node
    543588         */
    544589        public function test_admin_bar_has_no_archives_link_for_cpt_not_shown_in_admin_bar() {
    545590                register_post_type(
     
    596641
    597642        /**
    598643         * @ticket 39252
     644         *
     645         * @covers WP_Admin_Bar::get_node
    599646         */
    600647        public function test_new_user_link_exists_for_user_with_create_users() {
    601648                wp_set_current_user( self::$admin_id );
     
    615662
    616663        /**
    617664         * @ticket 39252
     665         *
     666         * @covers WP_Admin_Bar::get_node
    618667         */
    619668        public function test_new_user_link_existence_for_user_with_promote_users() {
    620669                wp_set_current_user( self::$admin_id );
     
    638687
    639688        /**
    640689         * @ticket 39252
     690         *
     691         * @covers WP_Admin_Bar::get_node
    641692         */
    642693        public function test_new_user_link_does_not_exist_for_user_without_create_or_promote_users() {
    643694                wp_set_current_user( self::$admin_id );
     
    657708        /**
    658709         * @ticket 30937
    659710         * @covers ::wp_admin_bar_customize_menu
     711         *
     712         * @covers WP_Admin_Bar::get_node
    660713         */
    661714        public function test_customize_link() {
    662715                global $wp_customize;
     
    694747        /**
    695748         * @ticket 39082
    696749         * @group ms-required
     750         *
     751         *
     752         * @covers WP_Admin_Bar::get_nodes
    697753         */
    698754        public function test_my_sites_network_menu_for_regular_user() {
    699755                wp_set_current_user( self::$editor_id );
     
    709765        /**
    710766         * @ticket 39082
    711767         * @group ms-required
     768         *
     769         * @covers WP_Admin_Bar::get_nodes
    712770         */
    713771        public function test_my_sites_network_menu_for_super_admin() {
    714772                wp_set_current_user( self::$editor_id );
     
    726784        /**
    727785         * @ticket 39082
    728786         * @group ms-required
     787         *
     788         * @covers WP_Admin_Bar::get_nodes
    729789         */
    730790        public function test_my_sites_network_menu_for_regular_user_with_network_caps() {
    731791                global $current_user;
  • tests/phpunit/tests/auth.php

     
    3535                wp_set_current_user( self::$user_id );
    3636        }
    3737
     38        /**
     39         *
     40         * @covers ::wp_validate_auth_cookie
     41         */
    3842        function test_auth_cookie_valid() {
    3943                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'auth' );
    4044                $this->assertEquals( self::$user_id, wp_validate_auth_cookie( $cookie, 'auth' ) );
    4145        }
    4246
     47        /**
     48         *
     49         * @covers ::wp_validate_auth_cookie
     50         */
    4351        function test_auth_cookie_invalid() {
    4452                // 3600 or less and +3600 may occur in wp_validate_auth_cookie(),
    4553                // as an ajax test may have defined DOING_AJAX, failing the test.
     
    5664                $this->assertEquals( false, wp_validate_auth_cookie( self::$user_id, 'auth' ), 'altered cookie' );
    5765        }
    5866
     67        /**
     68         *
     69         * @covers ::wp_validate_auth_cookie
     70         */
    5971        function test_auth_cookie_scheme() {
    6072                // Arbitrary scheme name.
    6173                $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' );
     
    6880
    6981        /**
    7082         * @ticket 23494
     83         *
     84         * @covers ::wp_authenticate
    7185         */
    7286        function test_password_trimming() {
    7387                $passwords_to_test = array(
     
    93107         * wp_hash_password function
    94108         *
    95109         * @ticket 24973
     110         *
     111         * @covers ::wp_hash_password
    96112         */
    97113        function test_wp_hash_password_trimming() {
    98114
    99115                $password = ' pass with leading whitespace';
    100                 $this->assertTrue( wp_check_password( 'pass with leading whitespace', wp_hash_password( $password ) ) );
     116                $this->assertTrue( wp_check_password( 'pass with leading whitespace', ( $password ) ) );
    101117
    102118                $password = 'pass with trailing whitespace ';
    103119                $this->assertTrue( wp_check_password( 'pass with trailing whitespace', wp_hash_password( $password ) ) );
     
    114130
    115131        /**
    116132         * @ticket 29217
     133         *
     134         * @covers ::wp_verify_nonce
    117135         */
    118136        function test_wp_verify_nonce_with_empty_arg() {
    119137                $this->assertFalse( wp_verify_nonce( '' ) );
     
    122140
    123141        /**
    124142         * @ticket 29542
     143         *
     144         * @covers ::wp_verify_nonce
     145         *
     146         * @covers ::wp_verify_nonce
    125147         */
    126148        function test_wp_verify_nonce_with_integer_arg() {
    127149                $this->assertFalse( wp_verify_nonce( 1 ) );
     
    129151
    130152        /**
    131153         * @ticket 24030
     154         *
     155         * @covers ::wp_verify_nonce
    132156         */
    133157        function test_wp_nonce_verify_failed() {
    134158                $nonce = substr( md5( uniqid() ), 0, 10 );
     
    141165
    142166        /**
    143167         * @ticket 24030
     168         *
     169         * @covers ::wp_verify_nonce
    144170         */
    145171        function test_wp_nonce_verify_success() {
    146172                $nonce = wp_create_nonce( 'nonce_test_action' );
     
    153179
    154180        /**
    155181         * @ticket 36361
     182         *
     183         * @covers ::check_admin_referer
    156184         */
    157185        public function test_check_admin_referer_with_no_action_triggers_doing_it_wrong() {
    158186                $this->setExpectedIncorrectUsage( 'check_admin_referer' );
     
    165193                unset( $_REQUEST['_wpnonce'] );
    166194        }
    167195
     196        /**
     197         *
     198         * @covers ::check_admin_referer
     199         */
    168200        public function test_check_admin_referer_with_default_action_as_string_not_doing_it_wrong() {
    169201                // A valid nonce needs to be set so the check doesn't die().
    170202                $_REQUEST['_wpnonce'] = wp_create_nonce( '-1' );
     
    176208
    177209        /**
    178210         * @ticket 36361
     211         *
     212         * @covers ::check_ajax_referer
    179213         */
    180214        public function test_check_ajax_referer_with_no_action_triggers_doing_it_wrong() {
    181215                $this->setExpectedIncorrectUsage( 'check_ajax_referer' );
     
    188222                unset( $_REQUEST['_wpnonce'] );
    189223        }
    190224
     225        /**
     226         *
     227         * @covers ::wp_authenticate
     228         */
    191229        function test_password_length_limit() {
    192230                $limit = str_repeat( 'a', 4096 );
    193231
     
    237275
    238276        /**
    239277         * @ticket 45746
     278         *
     279         * @covers ::check_password_reset_key
    240280         */
    241281        function test_user_activation_key_is_saved() {
    242282                $user = get_userdata( $this->user->ID );
     
    251291
    252292        /**
    253293         * @ticket 32429
     294         *
     295         * @covers ::check_password_reset_key
    254296         */
    255297        function test_user_activation_key_is_checked() {
    256298                global $wpdb;
     
    289331
    290332        /**
    291333         * @ticket 32429
     334         *
     335         * @covers ::check_password_reset_key
    292336         */
    293337        function test_expired_user_activation_key_is_rejected() {
    294338                global $wpdb;
     
    312356
    313357        /**
    314358         * @ticket 32429
     359         *
     360         * @covers ::check_password_reset_key
    315361         */
    316362        function test_empty_user_activation_key_fails_key_check() {
    317363                // An empty user_activation_key should not allow any key to be accepted.
     
    325371
    326372        /**
    327373         * @ticket 32429
     374         *
     375         * @covers ::check_password_reset_key
    328376         */
    329377        function test_legacy_user_activation_key_is_rejected() {
    330378                global $wpdb;
     
    355403        /**
    356404         * @ticket 32429
    357405         * @ticket 24783
     406         *
     407         * @covers ::check_password_reset_key
    358408         */
    359409        function test_plaintext_user_activation_key_is_rejected() {
    360410                global $wpdb;
     
    386436         * Ensure users can log in using both their username and their email address.
    387437         *
    388438         * @ticket 9568
     439         *
     440         * @covers ::wp_authenticate
    389441         */
    390442        public function test_log_in_using_email() {
    391443                $user_args = array(
     
    401453
    402454        /**
    403455         * @ticket 38744
     456         *
     457         * @covers ::wp_signon
    404458         */
    405459        public function test_wp_signon_using_email_with_an_apostrophe() {
    406460                $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         *
     191         * @covers ::get_avatar
     192         */
    170193        public function test_get_avatar() {
    171194                $img = get_avatar( 1 );
    172195                $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' srcset='[^']*' class='[^']*' height='[^']*' width='[^']*' loading='lazy'/>$|", $img ), 1 );
    173196        }
    174197
     198        /**
     199         *
     200         * @covers ::get_avatar
     201         */
    175202        public function test_get_avatar_size() {
    176203                $size = '100';
    177204                $img  = get_avatar( 1, $size );
     
    178205                $this->assertEquals( preg_match( "|^<img .*height='$size'.*width='$size'|", $img ), 1 );
    179206        }
    180207
     208        /**
     209         *
     210         * @covers ::get_avatar
     211         */
    181212        public function test_get_avatar_alt() {
    182213                $alt = 'Mr Hyde';
    183214                $img = get_avatar( 1, 96, '', $alt );
     
    184215                $this->assertEquals( preg_match( "|^<img alt='$alt'|", $img ), 1 );
    185216        }
    186217
     218        /**
     219         *
     220         * @covers ::get_avatar
     221         */
    187222        public function test_get_avatar_class() {
    188223                $class = 'first';
    189224                $img   = get_avatar( 1, 96, '', '', array( 'class' => $class ) );
     
    190225                $this->assertEquals( preg_match( "|^<img .*class='[^']*{$class}[^']*'|", $img ), 1 );
    191226        }
    192227
     228        /**
     229         *
     230         * @covers ::get_avatar
     231         */
    193232        public function test_get_avatar_default_class() {
    194233                $img = get_avatar( 1, 96, '', '', array( 'force_default' => true ) );
    195234                $this->assertEquals( preg_match( "|^<img .*class='[^']*avatar-default[^']*'|", $img ), 1 );
    196235        }
    197236
     237        /**
     238         *
     239         * @covers ::get_avatar
     240         */
    198241        public function test_get_avatar_force_display() {
    199242                $old = get_option( 'show_avatars' );
    200243                update_option( 'show_avatars', false );
     
    210253        protected $fake_img;
    211254        /**
    212255         * @ticket 21195
     256         *
     257         * @covers ::get_avatar
    213258         */
    214259        public function test_pre_get_avatar_filter() {
    215260                $this->fake_img = 'YOU TOO?!';
     
    226271
    227272        /**
    228273         * @ticket 21195
     274         *
     275         * @covers ::get_avatar
    229276         */
    230277        public function test_get_avatar_filter() {
    231278                $this->fake_url = 'YA RLY';
     
    244291         * The `get_avatar_data()` function should return gravatar url when comment type allowed to retrieve avatars.
    245292         *
    246293         * @ticket 44033
     294         *
     295         * @covers ::is_avatar_comment_type
     296         * @covers ::get_avatar
    247297         */
    248298        public function test_get_avatar_data_should_return_gravatar_url_when_input_avatar_comment_type() {
    249299                $comment_type = 'comment';
     
    264314         * The `get_avatar_data()` function should return invalid url when comment type not allowed to retrieve avatars.
    265315         *
    266316         * @ticket 44033
     317         *
     318         * @covers ::is_avatar_comment_type
     319         * @covers ::get_avatar
    267320         */
    268321        public function test_get_avatar_data_should_return_invalid_url_when_input_not_avatar_comment_type() {
    269322                $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 {
  • 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         *
     44         * @covers ::wp_handle_comment_submission
     45         */
    4246        public function test_submitting_comment_to_invalid_post_returns_error() {
    4347                $error = 'comment_id_not_found';
    4448
     
    5559
    5660        }
    5761
     62        /**
     63         *
     64         * @covers ::wp_handle_comment_submission
     65         */
    5866        public function test_submitting_comment_to_post_with_closed_comments_returns_error() {
    5967
    6068                $error = 'comment_closed';
     
    7886
    7987        }
    8088
     89        /**
     90         *
     91         * @covers ::wp_handle_comment_submission
     92         */
    8193        public function test_submitting_comment_to_trashed_post_returns_error() {
    8294
    8395                $error = 'comment_on_trash';
     
    99111
    100112        }
    101113
     114        /**
     115         *
     116         * @covers ::wp_handle_comment_submission
     117         */
    102118        public function test_submitting_comment_to_draft_post_returns_error() {
    103119                $error = 'comment_on_draft';
    104120
     
    124140
    125141        /**
    126142         * @ticket 39650
     143         *
     144         * @covers ::wp_handle_comment_submission
    127145         */
    128146        public function test_submitting_comment_to_draft_post_returns_error_message_for_user_with_correct_caps() {
    129147                $error = 'comment_on_draft';
     
    150168                $this->assertNotEmpty( $comment->get_error_message() );
    151169        }
    152170
     171        /**
     172         *
     173         * @covers ::wp_handle_comment_submission
     174         */
    153175        public function test_submitting_comment_to_scheduled_post_returns_error() {
    154176
    155177                // Same error as commenting on a draft.
     
    176198
    177199        }
    178200
     201        /**
     202         *
     203         * @covers ::wp_handle_comment_submission
     204         */
    179205        public function test_submitting_comment_to_password_required_post_returns_error() {
    180206
    181207                $error = 'comment_on_password_protected';
     
    199225
    200226        }
    201227
     228        /**
     229         *
     230         * @covers ::wp_handle_comment_submission
     231         */
    202232        public function test_submitting_comment_to_password_protected_post_succeeds() {
    203233
    204234                $password = 'password';
     
    227257
    228258        }
    229259
     260        /**
     261         *
     262         * @covers ::wp_handle_comment_submission
     263         */
    230264        public function test_submitting_valid_comment_as_logged_in_user_succeeds() {
    231265
    232266                $user = self::factory()->user->create_and_get(
     
    254288
    255289        }
    256290
     291        /**
     292         *
     293         * @covers ::wp_handle_comment_submission
     294         */
    257295        public function test_submitting_valid_comment_anonymously_succeeds() {
    258296
    259297                $data    = array(
     
    280318         * wp_handle_comment_submission() expects un-slashed data.
    281319         *
    282320         * @group slashes
     321         *
     322         * @covers ::wp_handle_comment_submission
    283323         */
    284324        public function test_submitting_comment_handles_slashes_correctly_handles_slashes() {
    285325
     
    300340
    301341        }
    302342
     343        /**
     344         *
     345         * @covers ::wp_handle_comment_submission
     346         */
    303347        public function test_submitting_comment_anonymously_to_private_post_returns_error() {
    304348
    305349                $error = 'comment_id_not_found';
     
    321365
    322366        }
    323367
     368        /**
     369         *
     370         * @covers ::wp_handle_comment_submission
     371         */
    324372        public function test_submitting_comment_as_logged_in_user_to_inaccessible_private_post_returns_error() {
    325373
    326374                $error = 'comment_id_not_found';
     
    351399
    352400        }
    353401
     402        /**
     403         *
     404         * @covers ::wp_handle_comment_submission
     405         */
    354406        public function test_submitting_comment_to_private_post_with_closed_comments_returns_correct_error() {
    355407
    356408                $error = 'comment_id_not_found';
     
    382434
    383435        }
    384436
     437        /**
     438         *
     439         * @covers ::wp_handle_comment_submission
     440         */
    385441        public function test_submitting_comment_to_own_private_post_succeeds() {
    386442
    387443                wp_set_current_user( self::$author_id );
     
    405461
    406462        }
    407463
     464        /**
     465         *
     466         * @covers ::wp_handle_comment_submission
     467         */
    408468        public function test_submitting_comment_to_accessible_private_post_succeeds() {
    409469
    410470                wp_set_current_user( self::$editor_id );
     
    428488
    429489        }
    430490
     491        /**
     492         *
     493         * @covers ::wp_handle_comment_submission
     494         */
    431495        public function test_anonymous_user_cannot_comment_unfiltered_html() {
    432496
    433497                $data    = array(
     
    444508
    445509        }
    446510
     511        /**
     512         *
     513         * @covers ::wp_handle_comment_submission
     514         */
    447515        public function test_unprivileged_user_cannot_comment_unfiltered_html() {
    448516
    449517                wp_set_current_user( self::$author_id );
     
    462530
    463531        }
    464532
     533        /**
     534         *
     535         * @covers ::wp_handle_comment_submission
     536         */
    465537        public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() {
    466538
    467539                wp_set_current_user( self::$author_id );
     
    486558
    487559        }
    488560
     561        /**
     562         *
     563         * @covers ::wp_handle_comment_submission
     564         */
    489565        public function test_privileged_user_can_comment_unfiltered_html_with_valid_nonce() {
    490566
    491567                $this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) );
     
    518594
    519595        }
    520596
     597        /**
     598         *
     599         * @covers ::wp_handle_comment_submission
     600         */
    521601        public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() {
    522602
    523603                if ( is_multisite() ) {
     
    542622
    543623        }
    544624
     625        /**
     626         *
     627         * @covers ::wp_handle_comment_submission
     628         */
    545629        public function test_submitting_comment_as_anonymous_user_when_registration_required_returns_error() {
    546630
    547631                $error = 'not_logged_in';
     
    561645
    562646        }
    563647
     648        /**
     649         *
     650         * @covers ::wp_handle_comment_submission
     651         */
    564652        public function test_submitting_comment_with_no_name_when_name_email_required_returns_error() {
    565653
    566654                $error = 'require_name_email';
     
    582670
    583671        }
    584672
     673        /**
     674         *
     675         * @covers ::wp_handle_comment_submission
     676         */
    585677        public function test_submitting_comment_with_no_email_when_name_email_required_returns_error() {
    586678
    587679                $error = 'require_name_email';
     
    603695
    604696        }
    605697
     698        /**
     699         *
     700         * @covers ::wp_handle_comment_submission
     701         */
    606702        public function test_submitting_comment_with_invalid_email_when_name_email_required_returns_error() {
    607703
    608704                $error = 'require_valid_email';
     
    625721
    626722        }
    627723
     724        /**
     725         *
     726         * @covers ::wp_handle_comment_submission
     727         */
    628728        public function test_submitting_comment_with_no_comment_content_returns_error() {
    629729
    630730                $error = 'require_valid_comment';
     
    644744
    645745        /**
    646746         * @ticket 10377
     747         *
     748         * @covers ::wp_handle_comment_submission
    647749         */
    648750        public function test_submitting_comment_with_content_too_long_returns_error() {
    649751                $error = 'comment_content_column_length';
     
    662764
    663765        /**
    664766         * @ticket 10377
     767         *
     768         * @covers ::wp_handle_comment_submission
    665769         */
    666770        public function test_submitting_comment_with_author_too_long_returns_error() {
    667771                $error = 'comment_author_column_length';
     
    680784
    681785        /**
    682786         * @ticket 10377
     787         *
     788         * @covers ::wp_handle_comment_submission
    683789         */
    684790        public function test_submitting_comment_with_email_too_long_returns_error() {
    685791                $error = 'comment_author_email_column_length';
     
    698804
    699805        /**
    700806         * @ticket 10377
     807         *
     808         * @covers ::wp_handle_comment_submission
    701809         */
    702810        public function test_submitting_comment_with_url_too_long_returns_error() {
    703811                $error = 'comment_author_url_column_length';
     
    717825
    718826        /**
    719827         * @ticket 49236
     828         *
     829         * @covers ::wp_handle_comment_submission
    720830         */
    721831        public function test_submitting_comment_with_empty_type_results_in_correct_type() {
    722832                $data    = array(
     
    736846
    737847        /**
    738848         * @ticket 49236
     849         *
     850         * @covers ::wp_handle_comment_submission
    739851         */
    740852        public function test_inserting_comment_with_empty_type_results_in_correct_type() {
    741853                $data       = array(
     
    756868
    757869        /**
    758870         * @ticket 34997
     871         *
     872         * @covers ::wp_handle_comment_submission
    759873         */
    760874        public function test_comment_submission_sends_all_expected_parameters_to_preprocess_comment_filter() {
    761875
     
    798912
    799913        /**
    800914         * @ticket 36901
     915         *
     916         * @covers ::wp_handle_comment_submission
    801917         */
    802918        public function test_submitting_duplicate_comments() {
    803919                $data           = array(
     
    814930
    815931        /**
    816932         * @ticket 36901
     933         *
     934         * @covers ::wp_handle_comment_submission
    817935         */
    818936        public function test_comments_flood() {
    819937                $data          = array(
     
    833951
    834952        /**
    835953         * @ticket 36901
     954         *
     955         * @covers ::wp_handle_comment_submission
    836956         */
    837957        public function test_comments_flood_user_is_admin() {
    838958                $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         *
     443         * @covers ::wp_new_comment
     444         */
    406445        public function test_comment_field_lengths() {
    407446                $data = array(
    408447                        'comment_post_ID'      => self::$post_id,
     
    424463
    425464        /**
    426465         * @ticket 32566
     466         *
     467         * @covers ::wp_notify_moderator
    427468         */
    428469        public function test_wp_notify_moderator_should_not_throw_notice_when_post_author_is_0() {
    429470                $p = self::factory()->post->create(
     
    441482                $this->assertTrue( wp_notify_moderator( $c ) );
    442483        }
    443484
     485        /**
     486         *
     487         *
     488         * @covers ::wp_new_comment_notify_postauthor
     489         */
    444490        public function test_wp_new_comment_notify_postauthor_should_send_email_when_comment_is_approved() {
    445491                $c = self::factory()->comment->create(
    446492                        array(
     
    452498                $this->assertTrue( $sent );
    453499        }
    454500
     501        /**
     502         *
     503         *
     504         * @covers ::wp_new_comment_notify_postauthor
     505         */
    455506        public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_is_unapproved() {
    456507                $c = self::factory()->comment->create(
    457508                        array(
     
    466517
    467518        /**
    468519         * @ticket 33587
     520         *
     521         * @covers ::wp_new_comment_notify_postauthor
    469522         */
    470523        public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_marked_as_spam() {
    471524                $c = self::factory()->comment->create(
     
    481534
    482535        /**
    483536         * @ticket 35006
     537         *
     538         * @covers ::wp_new_comment_notify_postauthor
    484539         */
    485540        public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_trashed() {
    486541                $c = self::factory()->comment->create(
     
    496551
    497552        /**
    498553         * @ticket 43805
     554         *
     555         * @covers ::wp_new_comment_notify_postauthor
    499556         */
    500557        public function test_wp_new_comment_notify_postauthor_content_should_include_link_to_parent() {
    501558                $c1 = self::factory()->comment->create(
     
    520577
    521578        /**
    522579         * @ticket 43805
     580         *
     581         * @covers ::wp_new_comment_notify_moderator
    523582         */
    524583        public function test_wp_new_comment_notify_moderator_content_should_include_link_to_parent() {
    525584                $c1 = self::factory()->comment->create(
     
    556615
    557616        /**
    558617         * @ticket 12431
     618         *
     619         * @covers ::get_comment_meta
    559620         */
    560621        public function test_wp_new_comment_with_meta() {
    561622                $c = self::factory()->comment->create(
     
    573634
    574635        /**
    575636         * @ticket 8071
     637         *
     638         * @covers WP_Comment::get_children
    576639         */
    577640        public function test_wp_comment_get_children_should_fill_children() {
    578641                $c1 = self::factory()->comment->create(
     
    633696
    634697        /**
    635698         * @ticket 27571
     699         *
     700         * @covers ::get_comment
    636701         */
    637702        public function test_post_properties_should_be_lazyloaded() {
    638703                $c = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     
    684749
    685750        /**
    686751         * @ticket 761
     752         *
     753         * @covers ::wp_new_comment
    687754         */
    688755        public function test_wp_notify_moderator_filter_moderation_notify_option_true_filter_false() {
    689756                $comment_data = $this->setup_notify_comment();
     
    705772
    706773        /**
    707774         * @ticket 761
     775         *
     776         * @covers ::wp_new_comment
    708777         */
    709778        public function test_wp_notify_moderator_filter_moderation_notify_option_false_filter_true() {
    710779                $comment_data = $this->setup_notify_comment();
     
    726795
    727796        /**
    728797         * @ticket 761
     798         *
     799         * @covers ::wp_new_comment
    729800         */
    730801        public function test_wp_notify_post_author_filter_comments_notify_option_true_filter_false() {
    731802
     
    748819
    749820        /**
    750821         * @ticket 761
     822         *
     823         * @covers ::wp_new_comment
    751824         */
    752825        public function test_wp_notify_post_author_filter_comments_notify_option_false_filter_true() {
    753826                $comment_data = $this->setup_notify_comment();
     
    852925                return $email_sent_when_comment_approved || $email_sent_when_comment_added;
    853926        }
    854927
     928        /**
     929         *
     930         *
     931         * @covers ::_close_comments_for_old_post
     932         */
    855933        public function test_close_comments_for_old_post() {
    856934                update_option( 'close_comments_for_old_posts', true );
    857935                // Close comments more than one day old.
     
    867945                $this->assertTrue( $new_post_comment_status );
    868946        }
    869947
     948        /**
     949         *
     950         *
     951         * @covers ::_close_comments_for_old_post
     952         */
    870953        public function test_close_comments_for_old_post_undated_draft() {
    871954                $draft_id             = self::factory()->post->create(
    872955                        array(
     
    881964
    882965        /**
    883966         * @ticket 35276
     967         *
     968         * @covers ::wp_update_comment
    884969         */
    885970        public function test_wp_update_comment_author_id_and_agent() {
    886971
     
    9171002                $this->assertSame( 'SHIELD_AGENT', $updated->comment_agent );
    9181003        }
    9191004
     1005        /**
     1006         *
     1007         * @covers ::wp_get_comment_fields_max_lengths
     1008         */
    9201009        public function test_wp_get_comment_fields_max_lengths() {
    9211010                $expected = array(
    9221011                        'comment_author'       => 245,
     
    9371026         *
    9381027         * @group privacy
    9391028         * @ticket 43442
     1029         *
     1030         * @covers ::wp_comments_personal_data_eraser
    9401031         */
    9411032        public function test_wp_comments_personal_data_eraser() {
    9421033
     
    9941085         *
    9951086         * @group privacy
    9961087         * @ticket 43442
     1088         *
     1089         * @covers ::wp_comments_personal_data_eraser
    9971090         */
    9981091        public function test_wp_comments_personal_data_eraser_empty_first_page_output() {
    9991092
     
    10131106         *
    10141107         * @group privacy
    10151108         * @ticket 43442
     1109         *
     1110         * @covers ::wp_comments_personal_data_eraser
    10161111         */
    10171112        public function test_wp_comments_personal_data_eraser_non_empty_first_page_output() {
    10181113
     
    10451140         *
    10461141         * @group privacy
    10471142         * @ticket 43442
     1143         *
     1144         * @covers ::wp_comments_personal_data_eraser
    10481145         */
    10491146        public function test_wp_comments_personal_data_eraser_empty_second_page_output() {
    10501147
     
    10771174         *
    10781175         * @group privacy
    10791176         * @ticket 43442
     1177         *
     1178         * @covers ::wp_comments_personal_data_eraser
    10801179         */
    10811180        public function test_wp_anonymize_comment_filter_to_prevent_comment_anonymization() {
    10821181
     
    11141213         *
    11151214         * @group privacy
    11161215         * @ticket 43442
     1216         *
     1217         * @covers ::wp_comments_personal_data_eraser
    11171218         */
    11181219        public function test_wp_anonymize_comment_filter_to_prevent_comment_anonymization_with_custom_message() {
    11191220
     
    11791280                $this->assertSame( 'Bar', $comment->comment_author );
    11801281        }
    11811282
     1283        /**
     1284         *
     1285         *
     1286         * @covers ::wp_trash_comment
     1287         */
    11821288        public function test_trash_should_invalidate_comment_cache() {
    11831289                global $wpdb;
    11841290
     
    11931299                $this->assertSame( 'trash', $comment->comment_approved );
    11941300        }
    11951301
     1302        /**
     1303         *
     1304         *
     1305         * @covers ::wp_untrash_comment
     1306         */
    11961307        public function test_untrash_should_invalidate_comment_cache() {
    11971308                global $wpdb;
    11981309
     
    12091320                $this->assertSame( '1', $comment->comment_approved );
    12101321        }
    12111322
     1323        /**
     1324         *
     1325         *
     1326         * @covers ::wp_spam_comment
     1327         */
    12121328        public function test_spam_should_invalidate_comment_cache() {
    12131329                global $wpdb;
    12141330
     
    12231339                $this->assertSame( 'spam', $comment->comment_approved );
    12241340        }
    12251341
     1342        /**
     1343         *
     1344         *
     1345         * @covers ::wp_unspam_comment
     1346         */
    12261347        public function test_unspam_should_invalidate_comment_cache() {
    12271348                global $wpdb;
    12281349
     
    12441365         *
    12451366         * @group privacy
    12461367         * @ticket 43440
     1368         *
     1369         * @covers ::wp_comments_personal_data_exporter
    12471370         */
    12481371        public function test_wp_comments_personal_data_exporter() {
    12491372                $args = array(
     
    12901413         *
    12911414         * @group privacy
    12921415         * @ticket 43440
     1416         *
     1417         * @covers ::wp_comments_personal_data_exporter
    12931418         */
    12941419        public function test_wp_comments_personal_data_exporter_no_comments_found() {
    12951420
     
    13081433         *
    13091434         * @group privacy
    13101435         * @ticket 43440
     1436         *
     1437         * @covers ::wp_comments_personal_data_exporter
    13111438         */
    13121439        public function test_wp_comments_personal_data_exporter_empty_comment_prop() {
    13131440                $args = array(
     
    13391466         *
    13401467         * @group privacy
    13411468         * @ticket 43440
     1469         *
     1470         * @covers ::wp_comments_personal_data_exporter
    13421471         */
    13431472        public function test_wp_comments_personal_data_exporter_empty_second_page() {
    13441473                $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         *
    230239         */
    231240        function test_wpdb_supposedly_protected_properties() {
    232241                global $wpdb;
     
    243252
    244253        /**
    245254         * @ticket 21212
     255         *
    246256         */
    247257        function test_wpdb_actually_protected_properties() {
    248258                global $wpdb;
     
    274284         * Test that an escaped %%f is not altered
    275285         *
    276286         * @ticket 19861
     287         *
     288         * @covers wpdb::placeholder_escape
     289         * @covers wpdb::remove_placeholder_escape
    277290         */
    278291        public function test_double_escaped_placeholders() {
    279292                global $wpdb;
     
    289302         * Test that SQL modes are set correctly
    290303         *
    291304         * @ticket 26847
     305         *
     306         * @covers wpdb::set_sql_mode
    292307         */
    293308        function test_set_sql_mode() {
    294309                global $wpdb;
     
    309324         * Test that incompatible SQL modes are blocked
    310325         *
    311326         * @ticket 26847
     327         *
     328         * @covers wpdb::set_sql_mode
    312329         */
    313330        function test_set_incompatible_sql_mode() {
    314331                global $wpdb;
     
    327344         * Test that incompatible SQL modes can be changed
    328345         *
    329346         * @ticket 26847
     347         *
     348         * @covers wpdb::set_sql_mode
    330349         */
    331350        function test_set_allowed_incompatible_sql_mode() {
    332351                global $wpdb;
     
    360379        /**
    361380         * @ticket 25604
    362381         * @expectedIncorrectUsage wpdb::prepare
     382         *
     383         * @covers wpdb::prepare
    363384         */
    364385        function test_prepare_without_arguments() {
    365386                global $wpdb;
     
    370391                $this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0", $prepared );
    371392        }
    372393
     394        /**
     395         *
     396         * @covers wpdb::prepare
     397         */
    373398        function test_prepare_sprintf() {
    374399                global $wpdb;
    375400
     
    379404
    380405        /**
    381406         * @expectedIncorrectUsage wpdb::prepare
     407         *
     408         * @covers wpdb::prepare
    382409         */
    383410        function test_prepare_sprintf_invalid_args() {
    384411                global $wpdb;
     
    392419                $this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0 AND user_login = 'admin'", $prepared );
    393420        }
    394421
     422        /**
     423         *
     424         * @covers wpdb::prepare
     425         */
    395426        function test_prepare_vsprintf() {
    396427                global $wpdb;
    397428
     
    401432
    402433        /**
    403434         * @expectedIncorrectUsage wpdb::prepare
     435         *
     436         * @covers wpdb::prepare
    404437         */
    405438        function test_prepare_vsprintf_invalid_args() {
    406439                global $wpdb;
     
    418451         * @ticket 42040
    419452         * @dataProvider data_prepare_incorrect_arg_count
    420453         * @expectedIncorrectUsage wpdb::prepare
     454         *
     455         * @covers wpdb::prepare
    421456         */
    422457        public function test_prepare_incorrect_arg_count( $query, $args, $expected ) {
    423458                global $wpdb;
     
    479514                );
    480515        }
    481516
     517        /**
     518         *
     519         * @covers wpdb::db_version
     520         */
    482521        function test_db_version() {
    483522                global $wpdb;
    484523
    485524                $this->assertTrue( version_compare( $wpdb->db_version(), '5.0', '>=' ) );
    486525        }
    487 
     526        /**
     527         *
     528         * @covers wpdb::get_caller
     529         */
    488530        function test_get_caller() {
    489531                global $wpdb;
    490532                $str    = $wpdb->get_caller();
     
    493535                $this->assertEquals( $called, end( $calls ) );
    494536        }
    495537
     538        /**
     539         *
     540         * @covers wpdb::has_cap
     541         */
    496542        function test_has_cap() {
    497543                global $wpdb;
    498544                $this->assertTrue( $wpdb->has_cap( 'collation' ) );
     
    513559
    514560        /**
    515561         * @expectedDeprecated supports_collation
     562         *
     563         * @covers wpdb::supports_collation
    516564         */
    517565        function test_supports_collation() {
    518566                global $wpdb;
     
    519567                $this->assertTrue( $wpdb->supports_collation() );
    520568        }
    521569
     570        /**
     571         *
     572         * @covers wpdb::check_database_version
     573         */
    522574        function test_check_database_version() {
    523575                global $wpdb;
    524576                $this->assertEmpty( $wpdb->check_database_version() );
     
    526578
    527579        /**
    528580         * @expectedException WPDieException
     581         *
     582         * @covers wpdb::bail
    529583         */
    530584        function test_bail() {
    531585                global $wpdb;
    532586                $wpdb->bail( 'Database is dead.' );
    533587        }
    534 
     588        /**
     589         *
     590         * @covers wpdb::timer_start
     591         * @covers wpdb::timer_stop
     592         */
    535593        function test_timers() {
    536594                global $wpdb;
    537595
     
    542600                $this->assertNotEquals( $wpdb->time_start, $stop );
    543601                $this->assertGreaterThan( $stop, $wpdb->time_start );
    544602        }
    545 
     603        /**
     604         *
     605         * @covers wpdb::get_col_info
     606         */
    546607        function test_get_col_info() {
    547608                global $wpdb;
    548609
     
    552613                $this->assertEquals( array( $wpdb->users ), $wpdb->get_col_info( 'table' ) );
    553614                $this->assertEquals( $wpdb->users, $wpdb->get_col_info( 'table', 0 ) );
    554615        }
    555 
     616        /**
     617         *
     618         * @covers wpdb::query
     619         * @covers wpdb::delete
     620         */
    556621        function test_query_and_delete() {
    557622                global $wpdb;
    558623                $rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" );
     
    561626                $d_rows = $wpdb->delete( $wpdb->users, array( 'ID' => $wpdb->insert_id ) );
    562627                $this->assertEquals( 1, $d_rows );
    563628        }
    564 
     629        /**
     630         *
     631         * @covers wpdb::query
     632         * @covers wpdb::get_row
     633         */
    565634        function test_get_row() {
    566635                global $wpdb;
    567636                $rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" );
     
    584653         * @dataProvider data_test_get_col
    585654         *
    586655         * @ticket 45299
     656         *
     657         * @covers wpdb::get_col
    587658         */
    588659        function test_get_col( $query, $expected, $last_result, $column ) {
    589660                global $wpdb;
     
    664735                );
    665736        }
    666737
     738        /**
     739         *
     740         * @covers wpdb::replace
     741         */
    667742        function test_replace() {
    668743                global $wpdb;
    669744                $rows1 = $wpdb->insert( $wpdb->users, array( 'display_name' => 'Walter Sobchak' ) );
     
    691766         * wpdb::update() requires a WHERE condition.
    692767         *
    693768         * @ticket 26106
     769         *
     770         * @covers wpdb::update
    694771         */
    695772        function test_empty_where_on_update() {
    696773                global $wpdb;
     
    713790         * mysqli_ incorrect flush and further sync issues.
    714791         *
    715792         * @ticket 28155
     793         *
    716794         */
    717795        function test_mysqli_flush_sync() {
    718796                global $wpdb;
     
    873951        /**
    874952         * @dataProvider data_get_table_from_query
    875953         * @ticket 21212
     954         *
     955         * @covers wpdb::get_table_from_query
    876956         */
    877957        function test_get_table_from_query( $query, $table ) {
    878958                $this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) );
     
    888968        /**
    889969         * @dataProvider data_get_table_from_query_false
    890970         * @ticket 21212
     971         *
     972         * @covers wpdb::get_table_from_query
    891973         */
    892974        function test_get_table_from_query_false( $query ) {
    893975                $this->assertFalse( self::$_wpdb->get_table_from_query( $query ) );
     
    915997        /**
    916998         * @dataProvider data_get_escaped_table_from_show_query
    917999         * @ticket 38751
     1000         *
     1001         * @covers wpdb::get_table_from_query
    9181002         */
    9191003        function test_get_escaped_table_from_show_query( $query, $table ) {
    9201004                $this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) );
     
    10301114        /**
    10311115         * @dataProvider data_process_field_formats
    10321116         * @ticket 21212
     1117         *
     1118         * @covers wpdb::process_field_formats
    10331119         */
    10341120        function test_process_field_formats( $data, $format, $expected, $message ) {
    10351121                $actual = self::$_wpdb->process_field_formats( $data, $format );
     
    10381124
    10391125        /**
    10401126         * @ticket 21212
     1127         *
     1128         * @covers wpdb::process_fields
    10411129         */
    10421130        function test_process_fields() {
    10431131                global $wpdb;
     
    10681156        /**
    10691157         * @ticket 21212
    10701158         * @depends test_process_fields
     1159         *
     1160         * @covers wpdb::process_fields
    10711161         */
    10721162        function test_process_fields_on_nonexistent_table( $data ) {
    10731163                self::$_wpdb->suppress_errors( true );
     
    10781168
    10791169        /**
    10801170         * @ticket 21212
     1171         *
     1172         * @covers wpdb::get_table_charset
    10811173         */
    10821174        function test_pre_get_table_charset_filter() {
    10831175                add_filter( 'pre_get_table_charset', array( $this, 'filter_pre_get_table_charset' ), 10, 2 );
     
    10921184
    10931185        /**
    10941186         * @ticket 21212
     1187         *
     1188         * @covers wpdb::get_col_charset
    10951189         */
    10961190        function test_pre_get_col_charset_filter() {
    10971191                add_filter( 'pre_get_col_charset', array( $this, 'filter_pre_get_col_charset' ), 10, 3 );
     
    11061200
    11071201        /**
    11081202         * @ticket 15158
     1203         *
     1204         * @covers wpdb::insert
    11091205         */
    11101206        function test_null_insert() {
    11111207                global $wpdb;
     
    11281224
    11291225        /**
    11301226         * @ticket 15158
     1227         *
     1228         * @covers wpdb::insert
    11311229         */
    11321230        function test_null_update_value() {
    11331231                global $wpdb;
     
    11661264
    11671265        /**
    11681266         * @ticket 15158
     1267         *
     1268         * @covers wpdb::update
    11691269         */
    11701270        function test_null_update_where() {
    11711271                global $wpdb;
     
    12041304
    12051305        /**
    12061306         * @ticket 15158
     1307         *
     1308         * @covers wpdb::delete
    12071309         */
    12081310        function test_null_delete() {
    12091311                global $wpdb;
     
    12401342
    12411343        /**
    12421344         * @ticket 34903
     1345         *
     1346         * @covers wpdb::close
    12431347         */
    12441348        function test_close() {
    12451349                global $wpdb;
     
    12591363
    12601364        /**
    12611365         * @ticket 36917
     1366         *
     1367         * @covers wpdb::determine_charset
    12621368         */
    12631369        function test_charset_not_determined_when_disconnected() {
    12641370                global $wpdb;
     
    12771383
    12781384        /**
    12791385         * @ticket 36917
     1386         *
     1387         * @covers wpdb::determine_charset
    12801388         */
    12811389        function test_charset_switched_to_utf8mb4() {
    12821390                global $wpdb;
     
    12961404        /**
    12971405         * @ticket 32105
    12981406         * @ticket 36917
     1407         *
     1408         * @covers wpdb::determine_charset
    12991409         */
    13001410        function test_collate_switched_to_utf8mb4_520() {
    13011411                global $wpdb;
     
    13151425        /**
    13161426         * @ticket 32405
    13171427         * @ticket 36917
     1428         *
     1429         * @covers wpdb::determine_charset
    13181430         */
    13191431        function test_non_unicode_collations() {
    13201432                global $wpdb;
     
    13331445
    13341446        /**
    13351447         * @ticket 37982
     1448         *
     1449         * @covers wpdb::determine_charset
    13361450         */
    13371451        function test_charset_switched_to_utf8() {
    13381452                global $wpdb;
     
    13521466
    13531467        /**
    13541468         * @dataProvider data_prepare_with_placeholders
     1469         *
     1470         * @covers wpdb::prepare
    13551471         */
    13561472        function test_prepare_with_placeholders_and_individual_args( $sql, $values, $incorrect_usage, $expected ) {
    13571473                global $wpdb;
     
    13711487
    13721488        /**
    13731489         * @dataProvider data_prepare_with_placeholders
     1490         *
     1491         * @covers wpdb::prepare
    13741492         */
    13751493        function test_prepare_with_placeholders_and_array_args( $sql, $values, $incorrect_usage, $expected ) {
    13761494                global $wpdb;
     
    15651683
    15661684        /**
    15671685         * @dataProvider data_escape_and_prepare
     1686         *
     1687         * @covers esc_sql
    15681688         */
    15691689        function test_escape_and_prepare( $escape, $sql, $values, $incorrect_usage, $expected ) {
    15701690                global $wpdb;
     
    16121732
    16131733        /**
    16141734         * @expectedIncorrectUsage wpdb::prepare
     1735         *
     1736         * @covers wpdb::prepare
    16151737         */
    16161738        function test_double_prepare() {
    16171739                global $wpdb;
     
    16231745                $this->assertNull( $query );
    16241746        }
    16251747
     1748        /**
     1749         *
     1750         * @covers wpdb::prepare
     1751         */
    16261752        function test_prepare_numeric_placeholders_float_args() {
    16271753                global $wpdb;
    16281754
     
    16381764                $this->assertContains( ' second=2.2', $actual );
    16391765        }
    16401766
     1767        /**
     1768         *
     1769         * @covers wpdb::prepare
     1770         */
    16411771        function test_prepare_numeric_placeholders_float_array() {
    16421772                global $wpdb;
    16431773
     
    16521782                $this->assertContains( ' second=2.2', $actual );
    16531783        }
    16541784
     1785        /**
     1786         *
     1787         * @covers wpdb::prepare
     1788         */
    16551789        function test_query_unescapes_placeholders() {
    16561790                global $wpdb;
    16571791
     
    16711805                $this->assertEquals( $value, $actual );
    16721806        }
    16731807
     1808        /**
     1809         *
     1810         * @covers wpdb::placeholder_escape
     1811         */
    16741812        function test_esc_sql_with_unsupported_placeholder_type() {
    16751813                global $wpdb;
    16761814
     
    16841822        /**
    16851823         * @dataProvider parse_db_host_data_provider
    16861824         * @ticket 41722
     1825         *
     1826         * @covers wpdb::
     1827         *
     1828         * @covers wpdb::600179
    16871829         */
    16881830        public function test_parse_db_host( $host_string, $expect_bail, $host, $port, $socket, $is_ipv6 ) {
    16891831                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         *
     12         * @covers ::add_filter
     13         */
    1014        function test_simple_filter() {
    1115                $a   = new MockAction();
    1216                $tag = __FUNCTION__;
     
    2529                $this->assertEquals( array( $val ), $args );
    2630        }
    2731
     32        /**
     33         *
     34         * @covers ::remove_filter
     35         */
    2836        function test_remove_filter() {
    2937                $a   = new MockAction();
    3038                $tag = __FUNCTION__;
     
    4553
    4654        }
    4755
     56        /**
     57         *
     58         * @covers ::has_filter
     59         */
    4860        function test_has_filter() {
    4961                        $tag  = __FUNCTION__;
    5062                        $func = __FUNCTION__ . '_func';
     
    5971                        $this->assertFalse( has_filter( $tag ) );
    6072        }
    6173
    62         // One tag with multiple filters.
     74        /**
     75         * One tag with multiple filters.
     76         *
     77         * @covers ::add_filter
     78         */
    6379        function test_multiple_filters() {
    6480                $a1  = new MockAction();
    6581                $a2  = new MockAction();
     
    7793                $this->assertEquals( 1, $a2->get_call_count() );
    7894        }
    7995
     96        /**
     97         * One tag with multiple filters.
     98         *
     99         * @covers ::add_filter
     100         */
    80101        function test_filter_args_1() {
    81102                $a    = new MockAction();
    82103                $tag  = __FUNCTION__;
     
    92113                $this->assertEquals( array( $val, $arg1 ), array_pop( $argsvar ) );
    93114        }
    94115
     116        /**
     117         * One tag with multiple filters.
     118         *
     119         * @covers ::add_filter
     120         */
    95121        function test_filter_args_2() {
    96122                $a1   = new MockAction();
    97123                $a2   = new MockAction();
     
    117143                $this->assertEquals( array( $val ), array_pop( $argsvar2 ) );
    118144        }
    119145
     146        /**
     147         * One tag with multiple filters.
     148         *
     149         * @covers ::add_filter
     150         */
    120151        function test_filter_priority() {
    121152                $a   = new MockAction();
    122153                $tag = __FUNCTION__;
     
    148179                $this->assertEquals( $expected, $a->get_events() );
    149180        }
    150181
     182        /**
     183         * One tag with multiple filters.
     184         *
     185         * @covers ::add_filter
     186         */
    151187        function test_all_filter() {
    152188                $a    = new MockAction();
    153189                $tag1 = __FUNCTION__ . '_1';
     
    172208
    173209        }
    174210
     211        /**
     212         * One tag with multiple filters.
     213         *
     214         * @covers ::add_filter
     215         */
    175216        function test_remove_all_filter() {
    176217                $a   = new MockAction();
    177218                $tag = __FUNCTION__;
     
    198239
    199240        /**
    200241         * @ticket 20920
     242         *
     243         * @covers ::add_filter
    201244         */
    202245        function test_remove_all_filters_should_respect_the_priority_argument() {
    203246                $a   = new MockAction();
     
    217260
    218261        /**
    219262         * @ticket 9886
     263         *
     264         * @covers ::add_filter
    220265         */
    221266        function test_filter_ref_array() {
    222267                $obj = new stdClass();
     
    236281
    237282        /**
    238283         * @ticket 12723
     284         *
     285         * @covers ::add_filter
    239286         */
    240287        function test_filter_ref_array_result() {
    241288                $obj = new stdClass();
     
    271318
    272319        /**
    273320         * @ticket 29070
     321         *
     322         * @covers ::has_filter
    274323         */
    275324        function test_has_filter_after_remove_all_filters() {
    276325                $a   = new MockAction();
     
    298347        /**
    299348         * @ticket 10441
    300349         * @expectedDeprecated tests_apply_filters_deprecated
     350         *
     351         * @covers ::apply_filters_deprecated
    301352         */
    302353        public function test_apply_filters_deprecated() {
    303354                $p = 'Foo';
     
    317368        /**
    318369         * @ticket 10441
    319370         * @expectedDeprecated tests_apply_filters_deprecated
     371         *
     372         * @covers ::apply_filters_deprecated
    320373         */
    321374        public function test_apply_filters_deprecated_with_multiple_params() {
    322375                $p1 = 'Foo1';
     
    341394
    342395        /**
    343396         * @ticket 10441
     397         *
     398         * @covers ::apply_filters_deprecated
    344399         */
    345400        public function test_apply_filters_deprecated_without_filter() {
    346401                $val = 'Foobar';
     
    351406        private $current_priority;
    352407        /**
    353408         * @ticket 39007
     409         *
     410         * @covers ::add_action
    354411         */
    355412        public function test_current_priority() {
    356413                add_action( 'test_current_priority', array( $this, '_current_priority_action' ), 99 );
     
    360417                $this->assertSame( 99, $this->current_priority );
    361418        }
    362419
     420        /**
     421         * One tag with multiple filters.
     422         *
     423         */
    363424        public function _current_priority_action() {
    364425                global $wp_filter;
    365426                $this->current_priority = $wp_filter[ current_filter() ]->current_priority();
     
    367428
    368429        /**
    369430         * @ticket 39007
     431         *
     432         * @covers ::add_action
    370433         */
    371434        public function test_other_priority() {
    372435                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->assertEquals( $non_pretty_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         * @covers PHPMailer\PHPMailer::validateAddress
    413455         */
    414456        function test_phpmailer_validator() {
    415457                $phpmailer = $GLOBALS['phpmailer'];
  • tests/phpunit/tests/media.php

     
    4646                );
    4747        }
    4848
     49        /**
     50         *
     51         * @covers ::add_shortcode
     52         */
    4953        function test_img_caption_shortcode_added() {
    5054                global $shortcode_tags;
    5155                $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] );
     
    5256                $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] );
    5357        }
    5458
     59        /**
     60         *
     61         * @covers ::img_caption_shortcode
     62         */
    5563        function test_img_caption_shortcode_with_empty_params() {
    5664                $result = img_caption_shortcode( array() );
    5765                $this->assertNull( $result );
     
    5967
    6068        /**
    6169         * @ticket 33981
     70         *
     71         * @covers ::img_caption_shortcode
    6272         */
    6373        function test_img_caption_shortcode_with_empty_params_but_content() {
    6474                $result = img_caption_shortcode( array(), $this->caption );
     
    6777
    6878        /**
    6979         * @ticket 33981
     80         *
     81         * @covers ::img_caption_shortcode
    7082         */
    7183        function test_img_caption_shortcode_short_circuit_filter() {
    7284                add_filter( 'img_caption_shortcode', array( $this, '_return_alt_caption' ) );
     
    8496
    8597        /**
    8698         * @ticket 33981
     99         *
     100         * @covers ::img_caption_shortcode
    87101         */
    88102        function test_img_caption_shortcode_empty_width() {
    89103                $result = img_caption_shortcode(
     
    97111
    98112        /**
    99113         * @ticket 33981
     114         *
     115         * @covers ::img_caption_shortcode
    100116         */
    101117        function test_img_caption_shortcode_empty_caption() {
    102118                $result = img_caption_shortcode(
     
    109125
    110126        /**
    111127         * @ticket 33981
     128         *
     129         * @covers ::img_caption_shortcode
    112130         */
    113131        function test_img_caption_shortcode_empty_caption_and_content() {
    114132                $result = img_caption_shortcode(
     
    120138                $this->assertEquals( $this->caption, $result );
    121139        }
    122140
     141        /**
     142         *
     143         * @covers ::img_caption_shortcode
     144         */
    123145        function test_img_caption_shortcode_with_old_format() {
    124146                $result = img_caption_shortcode(
    125147                        array(
     
    139161                }
    140162        }
    141163
     164        /**
     165         *
     166         * @covers ::img_caption_shortcode
     167         */
    142168        function test_img_caption_shortcode_with_old_format_id_and_align() {
    143169                $result = img_caption_shortcode(
    144170                        array(
     
    153179                $this->assertEquals( 1, preg_match_all( "/{$this->caption}/", $result, $_r ) );
    154180        }
    155181
     182        /**
     183         *
     184         * @covers ::img_caption_shortcode
     185         */
    156186        function test_img_caption_shortcode_with_old_format_and_class() {
    157187                $result = img_caption_shortcode(
    158188                        array(
     
    165195
    166196        }
    167197
     198        /**
     199         *
     200         * @covers ::img_caption_shortcode
     201         */
    168202        function test_new_img_caption_shortcode_with_html_caption() {
    169203                $result   = img_caption_shortcode(
    170204                        array(
     
    177211                $this->assertEquals( 1, preg_match_all( "~{$our_preg}~", $result, $_r ) );
    178212        }
    179213
     214        /**
     215         *
     216         * @covers ::img_caption_shortcode
     217         */
    180218        function test_new_img_caption_shortcode_new_format() {
    181219                $result       = img_caption_shortcode(
    182220                        array( 'width' => 20 ),
     
    189227                $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
    190228        }
    191229
     230        /**
     231         *
     232         * @covers ::img_caption_shortcode
     233         */
    192234        function test_new_img_caption_shortcode_new_format_and_linked_image() {
    193235                $linked_image = "<a href='#'>{$this->img_content}</a>";
    194236                $result       = img_caption_shortcode(
     
    202244                $this->assertEquals( 1, preg_match_all( "~wp-caption-text.*{$content_preg}~", $result, $_r ) );
    203245        }
    204246
     247        /**
     248         *
     249         * @covers ::img_caption_shortcode
     250         */
    205251        function test_new_img_caption_shortcode_new_format_and_linked_image_with_newline() {
    206252                $linked_image = "<a href='#'>{$this->img_content}</a>";
    207253                $result       = img_caption_shortcode(
     
    217263
    218264        /**
    219265         * @ticket 34595
     266         *
     267         * @covers ::img_caption_shortcode
    220268         */
    221269        function test_img_caption_shortcode_has_aria_describedby() {
    222270                $result = img_caption_shortcode(
     
    230278                $this->assertEquals( 1, preg_match_all( '/aria-describedby="caption-myId"/', $result, $_r ) );
    231279        }
    232280
     281        /**
     282         *
     283         * @covers ::wp_oembed_remove_provider
     284         */
    233285        function test_add_remove_oembed_provider() {
    234286                wp_oembed_add_provider( 'http://foo.bar/*', 'http://foo.bar/oembed' );
    235287                $this->assertTrue( wp_oembed_remove_provider( 'http://foo.bar/*' ) );
     
    238290
    239291        /**
    240292         * @ticket 23776
     293         *
     294         * @covers WP_Embed::autoembed
    241295         */
    242296        function test_autoembed_empty() {
    243297                global $wp_embed;
     
    250304
    251305        /**
    252306         * @ticket 23776
     307         *
     308         * @covers WP_Embed::autoembed
    253309         */
    254310        function test_autoembed_no_paragraphs_around_urls() {
    255311                global $wp_embed;
     
    329385
    330386        /**
    331387         * @dataProvider data_autoembed
     388         *
     389         * @covers WP_Embed::autoembed
    332390         */
    333391        function test_autoembed( $content, $result = null ) {
    334392                $wp_embed = new Test_Autoembed;
     
    336394                $this->assertEquals( $wp_embed->autoembed( $content ), $result ? $result : $content );
    337395        }
    338396
     397        /**
     398         *
     399         * @covers ::wp_prepare_attachment_for_js
     400         */
    339401        function test_wp_prepare_attachment_for_js() {
    340402                // Attachment without media.
    341403                $id   = wp_insert_attachment(
     
    389451
    390452        /**
    391453         * @ticket 38965
     454         *
     455         * @covers ::wp_prepare_attachment_for_js
    392456         */
    393457        function test_wp_prepare_attachment_for_js_without_image_sizes() {
    394458                // Create the attachement post.
     
    420484        /**
    421485         * @ticket 19067
    422486         * @expectedDeprecated wp_convert_bytes_to_hr
     487         *
     488         * @covers ::wp_convert_bytes_to_hr
     489         * @covers ::size_format
    423490         */
    424491        function test_wp_convert_bytes_to_hr() {
    425492                $kb = 1024;
     
    452519                $this->assertEquals( 1022.99902344, (float) str_replace( ',', '.', $hr ), 'The values should be equal', 0.0001 );
    453520
    454521                // Edge.
    455                 $this->assertEquals( '-1B', wp_convert_bytes_to_hr( -1 ) );
     522                $this->assertEquals( '-1B', wp_convert_bytWP_Embedes_to_hr( -1 ) );
    456523                $this->assertEquals( '0B', wp_convert_bytes_to_hr( 0 ) );
    457524        }
    458525
    459526        /**
    460527         * @ticket 22960
     528         *
     529         * @covers ::get_attached_media
    461530         */
    462531        function test_get_attached_images() {
    463532                $post_id       = self::factory()->post->create();
     
    476545
    477546        /**
    478547         * @ticket 22960
     548         *
     549         * @covers ::wp_update_attachment_metadata
    479550         */
    480551        function test_post_galleries_images() {
    481552                $ids1      = array();
     
    527598
    528599        /**
    529600         * @ticket 39304
     601         *
     602         * @covers ::get_post_galleries
    530603         */
    531604        function test_post_galleries_images_without_global_post() {
    532605                // Set up an unattached image.
     
    552625
    553626        /**
    554627         * @ticket 39304
     628         *
     629         * @covers ::get_post_galleries
    555630         */
    556631        function test_post_galleries_ignores_global_post() {
    557632                $global_post_id = $this->factory->post->create(
     
    587662
    588663        /**
    589664         * @ticket 39304
     665         *
     666         * @covers ::get_post_galleries
    590667         */
    591668        function test_post_galleries_respects_id_attrs() {
    592669                $post_id     = $this->factory->post->create(
     
    626703
    627704        /**
    628705         * @ticket 22960
     706         *
     707         * @covers ::get_post_gallery_images
    629708         */
    630709        function test_post_gallery_images() {
    631710                $ids1      = array();
     
    675754                $this->assertEquals( $srcs, $ids1_srcs );
    676755        }
    677756
     757        /**
     758         *
     759         * @covers ::get_media_embedded_in_content
     760         */
    678761        function test_get_media_embedded_in_content() {
    679762                $object = <<<OBJ
    680763<object src="this" data="that">
     
    739822                $this->assertEquals( $contents, $matches );
    740823        }
    741824
     825        /**
     826         *
     827         * @covers ::get_media_embedded_in_content
     828         */
    742829        function test_get_media_embedded_in_content_order() {
    743830                $audio   = <<<AUDIO
    744831<audio preload="none">
     
    769856
    770857        /**
    771858         * @ticket 35367
     859         *
     860         * @covers ::wp_audio_shortcode
    772861         */
    773862        function test_wp_audio_shortcode_with_bad_attr() {
    774863                $this->assertSame(
     
    783872
    784873        /**
    785874         * @ticket 35367
     875         *
     876         * @covers ::wp_audio_shortcode
    786877         */
    787878        function test_wp_audio_shortcode_attributes() {
    788879                $actual = wp_audio_shortcode(
     
    819910
    820911        /**
    821912         * Test [video] shortcode processing
     913         *
     914         * @covers ::wp_video_shortcode
    822915         */
    823916        function test_video_shortcode_body() {
    824917                $width  = 720;
     
    865958        /**
    866959         * @ticket 35367
    867960         * @depends test_video_shortcode_body
     961         *
     962         * @covers ::wp_video_shortcode
    868963         */
    869964        function test_wp_video_shortcode_with_empty_params() {
    870965                $this->assertNull( wp_video_shortcode( array() ) );
     
    873968        /**
    874969         * @ticket 35367
    875970         * @depends test_video_shortcode_body
     971         *
     972         * @covers ::wp_video_shortcode
    876973         */
    877974        function test_wp_video_shortcode_with_bad_attr() {
    878975                $this->assertSame(
     
    888985        /**
    889986         * @ticket 35367
    890987         * @depends test_video_shortcode_body
     988         *
     989         * @covers ::wp_video_shortcode
    891990         */
    892991        function test_wp_video_shortcode_attributes() {
    893992                $actual = wp_video_shortcode(
     
    9301029        /**
    9311030         * @ticket 40866
    9321031         * @depends test_video_shortcode_body
     1032         *
     1033         * @covers ::wp_video_shortcode
    9331034         */
    9341035        function test_wp_video_shortcode_youtube_remove_feature() {
    9351036                $actual = wp_video_shortcode(
     
    9441045        /**
    9451046         * @ticket 40866
    9461047         * @depends test_video_shortcode_body
     1048         *
     1049         * @covers ::wp_video_shortcode
    9471050         */
    9481051        function test_wp_video_shortcode_youtube_force_ssl() {
    9491052                $actual = wp_video_shortcode(
     
    9581061        /**
    9591062         * @ticket 40866
    9601063         * @depends test_video_shortcode_body
     1064         *
     1065         * @covers ::wp_video_shortcode
    9611066         */
    9621067        function test_wp_video_shortcode_vimeo_force_ssl_remove_query_args() {
    9631068                $actual = wp_video_shortcode(
     
    9731078        /**
    9741079         * @ticket 40977
    9751080         * @depends test_video_shortcode_body
     1081         *
     1082         * @covers ::wp_video_shortcode
    9761083         */
    9771084        function test_wp_video_shortcode_vimeo_adds_loop() {
    9781085                $actual = wp_video_shortcode(
     
    9871094        /**
    9881095         * @ticket 40977
    9891096         * @depends test_video_shortcode_body
     1097         *
     1098         * @covers ::wp_video_shortcode
    9901099         */
    9911100        function test_wp_video_shortcode_vimeo_force_adds_loop_true() {
    9921101                $actual = wp_video_shortcode(
     
    10011110
    10021111        /**
    10031112         * @ticket 26768
     1113         *
     1114         * @covers ::add_image_size
    10041115         */
    10051116        function test_add_image_size() {
    10061117                $_wp_additional_image_sizes = wp_get_additional_image_sizes();
     
    10221133
    10231134        /**
    10241135         * @ticket 26768
     1136         *
     1137         * @covers ::remove_image_size
    10251138         */
    10261139        function test_remove_image_size() {
    10271140                add_image_size( 'test-size', 200, 600 );
     
    10321145
    10331146        /**
    10341147         * @ticket 26951
     1148         *
     1149         * @covers ::has_image_size
    10351150         */
    10361151        function test_has_image_size() {
    10371152                add_image_size( 'test-size', 200, 600 );
     
    10431158
    10441159        /**
    10451160         * @ticket 30346
     1161         *
     1162         * @covers ::attachment_url_to_postid
    10461163         */
    10471164        function test_attachment_url_to_postid() {
    10481165                $image_path    = '2014/11/' . $this->img_name;
     
    10611178
    10621179        /**
    10631180         * @ticket 33109
     1181         *
     1182         * @covers ::attachment_url_to_postid
    10641183         */
    10651184        function test_attachment_url_to_postid_with_different_scheme() {
    10661185                $image_path    = '2014/11/' . $this->img_name;
     
    10791198
    10801199        /**
    10811200         * @ticket 39768
     1201         *
     1202         * @covers ::attachment_url_to_postid
    10821203         */
    10831204        function test_attachment_url_to_postid_should_be_case_sensitive() {
    10841205                $image_path_lower_case    = '2014/11/' . $this->img_name;
     
    11051226                $this->assertEquals( $attachment_id_upper_case, attachment_url_to_postid( $image_url ) );
    11061227        }
    11071228
     1229        /**
     1230         *
     1231         * @covers ::attachment_url_to_postid
     1232         */
    11081233        function test_attachment_url_to_postid_filtered() {
    11091234                $image_path    = '2014/11/' . $this->img_name;
    11101235                $attachment_id = self::factory()->attachment->create_object(
     
    11291254
    11301255        /**
    11311256         * @ticket 31044
     1257         *
     1258         * @covers ::attachment_url_to_postid
    11321259         */
    11331260        function test_attachment_url_to_postid_with_empty_url() {
    11341261                $post_id = attachment_url_to_postid( '' );
     
    11381265
    11391266        /**
    11401267         * @ticket 22768
     1268         *
     1269         * @covers ::media_handle_upload
    11411270         */
    11421271        public function test_media_handle_upload_sets_post_excerpt() {
    11431272                $iptc_file = DIR_TESTDATA . '/images/test-image-iptc.jpg';
     
    11771306
    11781307        /**
    11791308         * @ticket 37989
     1309         *
     1310         * @covers ::media_handle_upload
    11801311         */
    11811312        public function test_media_handle_upload_expected_titles() {
    11821313                $test_file = DIR_TESTDATA . '/images/test-image.jpg';
     
    12161347
    12171348        /**
    12181349         * @ticket 33016
     1350         *
     1351         * @covers WP_Embed::autoembed
    12191352         */
    12201353        function test_multiline_cdata() {
    12211354                global $wp_embed;
     
    12331366
    12341367        /**
    12351368         * @ticket 33016
     1369         *
     1370         * @covers WP_Embed::autoembed
    12361371         */
    12371372        function test_multiline_comment() {
    12381373                global $wp_embed;
     
    12501385
    12511386        /**
    12521387         * @ticket 33016
     1388         *
     1389         * @covers WP_Embed::autoembed
    12531390         */
    12541391        function test_multiline_comment_with_embeds() {
    12551392                $content = <<<EOF
     
    12931430
    12941431        /**
    12951432         * @ticket 33016
     1433         *
     1434         * @covers WP_Embed::autoembed
    12961435         */
    12971436        function test_oembed_explicit_media_link() {
    12981437                global $wp_embed;
     
    13301469         * Tests the default output of `wp_get_attachment_image()`.
    13311470         *
    13321471         * @ticket 34635
     1472         *
     1473         * @covers ::wp_get_attachment_image
    13331474         */
    13341475        function test_wp_get_attachment_image_defaults() {
    13351476                $image    = image_downsize( self::$large_id, 'thumbnail' );
     
    13471488         * Test that `wp_get_attachment_image()` returns a proper alt value.
    13481489         *
    13491490         * @ticket 34635
     1491         *
     1492         * @covers ::wp_get_attachment_image
    13501493         */
    13511494        function test_wp_get_attachment_image_with_alt() {
    13521495                // Add test alt metadata.
     
    13681511
    13691512        /**
    13701513         * @ticket 33878
     1514         *
     1515         * @covers ::wp_get_attachment_image
    13711516         */
    13721517        function test_wp_get_attachment_image_url() {
    13731518                $this->assertFalse( wp_get_attachment_image_url( 0 ) );
     
    13891534
    13901535        /**
    13911536         * @ticket 12235
     1537         *
     1538         * @covers ::wp_get_attachment_caption
    13921539         */
    13931540        function test_wp_get_attachment_caption() {
    1394                 $this->assertFalse( wp_get_attachment_caption( 0 ) );
     1541                $this->assertFalse( ( 0 ) );
    13951542
    13961543                $caption = 'This is a caption.';
    13971544
     
    14131560
    14141561        /**
    14151562         * @ticket 12235
     1563         *
     1564         * @covers ::wp_get_attachment_caption
    14161565         */
    14171566        function test_wp_get_attachment_caption_empty() {
    14181567                $post_id       = self::factory()->post->create();
     
    14631612
    14641613        /**
    14651614         * @ticket 33641
     1615         *
     1616         * @covers ::wp_calculate_image_srcset
    14661617         */
    14671618        function test_wp_calculate_image_srcset() {
    14681619                $_wp_additional_image_sizes = wp_get_additional_image_sizes();
     
    15101661
    15111662        /**
    15121663         * @ticket 33641
     1664         *
     1665         * @covers ::wp_calculate_image_srcset
    15131666         */
    15141667        function test_wp_calculate_image_srcset_no_date_uploads() {
    15151668                $_wp_additional_image_sizes = wp_get_additional_image_sizes();
     
    15661719
    15671720        /**
    15681721         * @ticket 33641
     1722         *
     1723         * @covers ::wp_calculate_image_srcset
    15691724         */
    15701725        function test_wp_calculate_image_srcset_with_edits() {
    15711726                // For this test we're going to mock metadata changes from an edit.
     
    15991754
    16001755        /**
    16011756         * @ticket 35106
     1757         *
     1758         * @covers ::wp_calculate_image_srcset
    16021759         */
    16031760        function test_wp_calculate_image_srcset_with_absolute_path_in_meta() {
    16041761                $_wp_additional_image_sizes = wp_get_additional_image_sizes();
     
    16501807
    16511808        /**
    16521809         * @ticket 33641
     1810         *
     1811         * @covers ::wp_calculate_image_srcset
    16531812         */
    16541813        function test_wp_calculate_image_srcset_false() {
    16551814                $sizes = wp_calculate_image_srcset( array( 400, 300 ), 'file.png', array() );
     
    16601819
    16611820        /**
    16621821         * @ticket 33641
     1822         *
     1823         * @covers ::wp_calculate_image_srcset
    16631824         */
    16641825        function test_wp_calculate_image_srcset_no_width() {
    16651826                $file       = get_attached_file( self::$large_id );
     
    16771838        /**
    16781839         * @ticket 34955
    16791840         * @ticket 33641
     1841         *
     1842         * @covers ::wp_calculate_image_srcset
    16801843         */
    16811844        function test_wp_calculate_image_srcset_ratio_variance() {
    16821845                // Mock data for this test.
     
    17261889        /**
    17271890         * @ticket 35108
    17281891         * @ticket 33641
     1892         *
     1893         * @covers ::wp_calculate_image_srcset
    17291894         */
    17301895        function test_wp_calculate_image_srcset_include_src() {
    17311896                // Mock data for this test.
     
    17751940
    17761941        /**
    17771942         * @ticket 35480
     1943         *
     1944         * @covers ::wp_calculate_image_srcset
    17781945         */
    17791946        function test_wp_calculate_image_srcset_corrupted_image_meta() {
    17801947                $size_array = array( 300, 150 );
     
    18492016        /**
    18502017         * @ticket 36549
    18512018         * @ticket 33641
     2019         *
     2020         * @covers ::wp_calculate_image_srcset
    18522021         */
    18532022        function test_wp_calculate_image_srcset_with_spaces_in_filenames() {
    18542023                // Mock data for this test.
     
    18962065
    18972066        /**
    18982067         * @ticket 33641
     2068         *
     2069         * @covers ::wp_calculate_image_srcset
    18992070         */
    19002071        function test_wp_get_attachment_image_srcset() {
    19012072                $_wp_additional_image_sizes = wp_get_additional_image_sizes();
     
    19352106
    19362107        /**
    19372108         * @ticket 33641
     2109         *
     2110         * @covers ::wp_calculate_image_srcset
    19382111         */
    19392112        function test_wp_get_attachment_image_srcset_single_srcset() {
    19402113                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    19502123
    19512124        /**
    19522125         * @ticket 33641
     2126         *
     2127         * @covers ::wp_calculate_image_srcset
    19532128         */
    19542129        function test_wp_get_attachment_image_srcset_invalidsize() {
    19552130                $image_meta    = wp_get_attachment_metadata( self::$large_id );
     
    19662141
    19672142        /**
    19682143         * @ticket 33641
     2144         *
     2145         * @covers ::wp_calculate_image_src
    19692146         */
    19702147        function test_wp_get_attachment_image_sizes() {
    19712148                // Test sizes against the default WP sizes.
     
    19862163
    19872164        /**
    19882165         * @ticket 33641
     2166         *
     2167         * @covers ::wp_calculate_image_sizes
    19892168         */
    19902169        function test_wp_calculate_image_sizes() {
    19912170                // Test sizes against the default WP sizes.
     
    20092188
    20102189        /**
    20112190         * @ticket 33641
     2191         *
     2192         * @covers ::wp_filter_content_tags
    20122193         */
    20132194        function test_wp_filter_content_tags_srcset_sizes() {
    20142195                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    20992280         *
    21002281         * @ticket 34898
    21012282         * @ticket 33641
     2283         *
     2284         * @covers ::wp_filter_content_tags
    21022285         */
    21032286        function test_wp_filter_content_tags_srcset_sizes_wrong() {
    21042287                $img = get_image_tag( self::$large_id, '', '', '', 'medium' );
     
    21122295
    21132296        /**
    21142297         * @ticket 33641
     2298         *
     2299         * @covers ::wp_filter_content_tags
    21152300         */
    21162301        function test_wp_filter_content_tags_srcset_sizes_with_preexisting_srcset() {
    21172302                // Generate HTML and add a dummy srcset attribute.
     
    21262311        /**
    21272312         * @ticket 33641
    21282313         * @ticket 34528
     2314         *
     2315         * @covers ::wp_calculate_image_srcset
    21292316         */
    21302317        function test_wp_calculate_image_srcset_animated_gifs() {
    21312318                // Mock meta for an animated gif.
     
    21702357        /**
    21712358         * @ticket 35045
    21722359         * @ticket 33641
     2360         *
     2361         * @covers ::wp_filter_content_tags
    21732362         */
    21742363        function test_wp_filter_content_tags_schemes() {
    21752364                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    22212410        /**
    22222411         * @ticket 34945
    22232412         * @ticket 33641
     2413         *
     2414         * @covers ::wp_calculate_image_srcset
    22242415         */
    22252416        function test_wp_get_attachment_image_with_https_on() {
    22262417                // Mock meta for the image.
     
    22662457
    22672458        /**
    22682459         * @ticket 36084
     2460         *
     2461         * @covers :get_image_send_to_editor:
    22692462         */
    22702463        function test_get_image_send_to_editor_defaults() {
    22712464                $id      = self::$large_id;
     
    22862479
    22872480        /**
    22882481         * @ticket 36084
     2482         *
     2483         * @covers ::get_image_send_to_editor
    22892484         */
    22902485        function test_get_image_send_to_editor_defaults_with_optional_params() {
    22912486                $id      = self::$large_id;
     
    23102505
    23112506        /**
    23122507         * @ticket 36084
     2508         *
     2509         * @covers ::get_image_send_to_editor
    23132510         */
    23142511        function test_get_image_send_to_editor_defaults_no_caption_no_rel() {
    23152512                $id      = self::$large_id;
     
    23412538         * used in the output of `wp_get_attachment_image()`.
    23422539         *
    23432540         * @ticket 36246
     2541         *
     2542         * @covers ::wp_get_attachment_image
    23442543         */
    23452544        function test_wp_get_attachment_image_should_use_wp_get_attachment_metadata() {
    23462545                add_filter( 'wp_get_attachment_metadata', array( $this, '_filter_36246' ), 10, 2 );
     
    23762575
    23772576        /**
    23782577         * @ticket 37813
     2578         *
     2579         * @covers ::wp_insert_attachment
    23792580         */
    23802581        public function test_return_type_when_inserting_attachment_with_error_in_data() {
    23812582                $data = array(
     
    23952596
    23962597        /**
    23972598         * @ticket 35218
     2599         *
     2600         * @covers ::wp_get_media_creation_timestamp
    23982601         */
    23992602        function test_wp_get_media_creation_timestamp_video_asf() {
    24002603                $metadata = array(
     
    24112614
    24122615        /**
    24132616         * @ticket 35218
     2617         *
     2618         * @covers ::wp_get_media_creation_timestamp
    24142619         */
    24152620        function test_wp_get_media_creation_timestamp_video_matroska() {
    24162621                $metadata = array(
     
    24292634
    24302635        /**
    24312636         * @ticket 35218
     2637         *
     2638         * @covers ::wp_get_media_creation_timestamp
    24322639         */
    24332640        function test_wp_get_media_creation_timestamp_video_quicktime() {
    24342641                $metadata = array(
     
    24482655        }
    24492656
    24502657        /**
    2451          * @ticket 35218
     2658         * @ticket
     2659         *
     2660         * @covers ::wp_get_media_creation_timestamp
    24522661         */
    24532662        function test_wp_get_media_creation_timestamp_video_webm() {
    24542663                $metadata = array(
     
    24722681         *`wp_read_audio_metadata()`.
    24732682         *
    24742683         * @ticket 42017
     2684         *
     2685         * @covers ::wp_read_audio_metadata
    24752686         */
    24762687        function test_wp_read_audio_metadata_adds_creation_date_with_mp4() {
    24772688                $video    = DIR_TESTDATA . '/uploads/small-video.mp4';
     
    24822693
    24832694        /**
    24842695         * @ticket 35218
     2696         *
     2697         * @covers ::wp_read_video_metadata
    24852698         */
    24862699        function test_wp_read_video_metadata_adds_creation_date_with_quicktime() {
    24872700                $video    = DIR_TESTDATA . '/uploads/small-video.mov';
     
    24922705
    24932706        /**
    24942707         * @ticket 35218
     2708         *
     2709         * @covers ::wp_read_video_metadata
    24952710         */
    24962711        function test_wp_read_video_metadata_adds_creation_date_with_mp4() {
    24972712                $video    = DIR_TESTDATA . '/uploads/small-video.mp4';
     
    25022717
    25032718        /**
    25042719         * @ticket 35218
     2720         *
     2721         * @covers ::wp_read_video_metadata
    25052722         */
    25062723        function test_wp_read_video_metadata_adds_creation_date_with_mkv() {
    25072724                $video    = DIR_TESTDATA . '/uploads/small-video.mkv';
     
    25122729
    25132730        /**
    25142731         * @ticket 35218
     2732         *
     2733         * @covers ::wp_read_video_metadata
    25152734         */
    25162735        function test_wp_read_video_metadata_adds_creation_date_with_webm() {
    25172736                $video    = DIR_TESTDATA . '/uploads/small-video.webm';
     
    25222741
    25232742        /**
    25242743         * @ticket 10752
     2744         *
     2745         * @covers ::media_handle_upload
    25252746         */
    25262747        public function test_media_handle_upload_uses_post_parent_for_directory_date() {
    25272748                $iptc_file = DIR_TESTDATA . '/images/test-image-iptc.jpg';
     
    25682789
    25692790        /**
    25702791         * @ticket 10752
     2792         *
     2793         * @covers ::media_handle_upload
    25712794         */
    25722795        public function test_media_handle_upload_ignores_page_parent_for_directory_date() {
    25732796                $iptc_file = DIR_TESTDATA . '/images/test-image-iptc.jpg';
     
    26202843
    26212844        /**
    26222845         * @ticket 50367
     2846         *
     2847         * @covers ::wp_filter_content_tags
    26232848         */
    26242849        function test_wp_filter_content_tags_width_height() {
    26252850                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    26652890        /**
    26662891         * @ticket 44427
    26672892         * @ticket 50367
     2893         *
     2894         * @covers ::wp_filter_content_tags
    26682895         */
    26692896        function test_wp_filter_content_tags_loading_lazy() {
    26702897                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    27132940
    27142941        /**
    27152942         * @ticket 44427
     2943         *
     2944         * @covers ::wp_filter_content_tags
    27162945         */
    27172946        function test_wp_filter_content_tags_loading_lazy_opted_in() {
    27182947                $img      = get_image_tag( self::$large_id, '', '', '', 'medium' );
     
    27382967
    27392968        /**
    27402969         * @ticket 44427
     2970         *
     2971         * @covers ::wp_filter_content_tags
    27412972         */
    27422973        function test_wp_filter_content_tags_loading_lazy_opted_out() {
    27432974                $img = get_image_tag( self::$large_id, '', '', '', 'medium' );
     
    27612992        /**
    27622993         * @ticket 44427
    27632994         * @ticket 50367
     2995         *
     2996         * @covers ::wp_img_tag_add_loading_attr
    27642997         */
    27652998        function test_wp_img_tag_add_loading_attr() {
    27662999                $img = '<img src="example.png" alt=" width="300" height="225" />';
     
    27723005        /**
    27733006         * @ticket 44427
    27743007         * @ticket 50367
     3008         *
     3009         * @covers ::wp_img_tag_add_loading_attr
    27753010         */
    27763011        function test_wp_img_tag_add_loading_attr_without_src() {
    27773012                $img = '<img alt=" width="300" height="225" />';
     
    27833018        /**
    27843019         * @ticket 44427
    27853020         * @ticket 50367
     3021         *
     3022         * @covers ::wp_img_tag_add_loading_attr
    27863023         */
    27873024        function test_wp_img_tag_add_loading_attr_with_single_quotes() {
    27883025                $img = "<img src='example.png' alt=' width='300' height='225' />";
     
    27983035        /**
    27993036         * @ticket 44427
    28003037         * @ticket 50425
     3038         *
     3039         * @covers ::wp_img_tag_add_loading_attr
    28013040         */
    28023041        function test_wp_img_tag_add_loading_attr_opt_out() {
    28033042                $img = '<img src="example.png" alt=" width="300" height="225" />';
     
    28093048        /**
    28103049         * @ticket 44427
    28113050         * @ticket 50425
     3051         *
     3052         * @covers ::wp_get_attachment_image
    28123053         */
    28133054        function test_wp_get_attachment_image_loading() {
    28143055                $img = wp_get_attachment_image( self::$large_id );
     
    28193060        /**
    28203061         * @ticket 44427
    28213062         * @ticket 50425
     3063         *
     3064         * @covers ::wp_get_attachment_image
    28223065         */
    28233066        function test_wp_get_attachment_image_loading_opt_out() {
    28243067                add_filter( 'wp_lazy_loading_enabled', '__return_false' );
     
    28313074        /**
    28323075         * @ticket 44427
    28333076         * @ticket 50425
     3077         *
     3078         * @covers ::wp_get_attachment_image
    28343079         */
    28353080        function test_wp_get_attachment_image_loading_opt_out_individual() {
    28363081                // The default is already tested above, the filter below ensures that
     
    28503095         *
    28513096         * @param string $tag_name Tag name.
    28523097         * @param bool   $expected Expected return value.
     3098         *
     3099         * @covers ::wp_lazy_loading_enabled
    28533100         */
    28543101        function test_wp_lazy_loading_enabled_tag_name_defaults( $tag_name, $expected ) {
    28553102                if ( $expected ) {
     
    28733120         *
    28743121         * @param string $context  Function context.
    28753122         * @param bool   $expected Expected return value.
     3123         *
     3124         * @covers ::wp_lazy_loading_enabled
    28763125         */
    28773126        function test_wp_lazy_loading_enabled_context_defaults( $context, $expected ) {
    28783127                if ( $expected ) {
     
    28953144
    28963145        /**
    28973146         * @ticket 50543
     3147         *
     3148         * @covers ::wp_image_file_matches_image_meta
    28983149         */
    28993150        function test_wp_image_file_matches_image_meta() {
    29003151                $image_meta       = wp_get_attachment_metadata( self::$large_id );
     
    29073158
    29083159        /**
    29093160         * @ticket 50543
     3161         *
     3162         * @covers ::wp_image_file_matches_image_meta
    29103163         */
    29113164        function test_wp_image_file_matches_image_meta_no_subsizes() {
    29123165                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    29193172
    29203173        /**
    29213174         * @ticket 50543
     3175         *
     3176         * @covers ::wp_image_file_matches_image_meta
    29223177         */
    29233178        function test_wp_image_file_matches_image_meta_invalid_meta() {
    29243179                $image_meta = ''; // Attachment is not an image.
     
    29293184
    29303185        /**
    29313186         * @ticket 50543
     3187         *
     3188         * @covers ::wp_image_file_matches_image_meta
    29323189         */
    29333190        function test_wp_image_file_matches_image_meta_different_meta() {
    29343191                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    29393196
    29403197        /**
    29413198         * @ticket 50543
     3199         *
     3200         * @covers ::wp_image_file_matches_image_meta
    29423201         */
    29433202        function test_wp_image_file_matches_image_meta_original_image() {
    29443203                $image_meta = wp_get_attachment_metadata( self::$large_id );
     
    29493208
    29503209        /**
    29513210         * @ticket 22101
     3211         *
     3212         * @covers ::gallery_shortcode
    29523213         */
    29533214        function test_gallery_shortcode_when_is_feed_true() {
    29543215
  • tests/phpunit/tests/meta.php

     
    1717                return 'sanitized';
    1818        }
    1919
     20        /**
     21         *
     22         * @covers ::sanitize_meta
     23         */
    2024        function test_sanitize_meta() {
    2125                $meta = sanitize_meta( 'some_meta', 'unsanitized', 'post' );
    2226                $this->assertEquals( 'unsanitized', $meta );
     
    2630                $this->assertEquals( 'sanitized', $meta );
    2731        }
    2832
     33        /**
     34         *
     35         * @covers ::delete_metadata_by_mid
     36         */
    2937        function test_delete_metadata_by_mid() {
    3038                // Let's try and delete a non-existing ID, non existing meta.
    3139                $this->assertFalse( delete_metadata_by_mid( 'user', 0 ) );
     
    4149                $this->assertFalse( (bool) get_user_meta( $this->author->ID, 'delete_meta_key' ) );
    4250        }
    4351
     52        /**
     53         *
     54         * @covers ::delete_metadata_by_mid
     55         */
    4456        function test_update_metadata_by_mid() {
    4557                // Setup.
    4658                $meta = get_metadata_by_mid( 'user', $this->meta_id );
     
    8092
    8193        /**
    8294         * @ticket 11683
     95         *
     96         * @covers ::add_metadata
    8397         */
    8498        public function test_update_metadata_hooks_for_multiple_updated_rows() {
    8599                add_metadata( 'post', 1, 'test_key', 'value_1' );
     
    104118                }
    105119        }
    106120
     121        /**
     122         *
     123         * @covers ::metadata_exists
     124         */
    107125        function test_metadata_exists() {
    108126                $this->assertFalse( metadata_exists( 'user', $this->author->ID, 'foobarbaz' ) );
    109127                $this->assertTrue( metadata_exists( 'user', $this->author->ID, 'meta_key' ) );
     
    113131
    114132        /**
    115133         * @ticket 22746
     134         *
     135         * @covers ::metadata_exists
    116136         */
    117137        function test_metadata_exists_with_filter() {
    118138                // Let's see if it returns the correct value when adding a filter.
     
    124144
    125145        /**
    126146         * @ticket 18158
     147         *
     148         * @covers ::get_users
    127149         */
    128150        function test_user_metadata_not_exists() {
    129151                $u = get_users(
     
    198220                );
    199221        }
    200222
     223        /**
     224         *
     225         * @covers ::get_metadata
     226         */
    201227        function test_metadata_slashes() {
    202228                $key       = __FUNCTION__;
    203229                $value     = 'Test\\singleslash';
     
    230256
    231257        /**
    232258         * @ticket 16814
     259         *
     260         * @covers ::add_post_meta
    233261         */
    234262        function test_meta_type_cast() {
    235263                $post_id1 = self::factory()->post->create();
     
    320348
    321349        /**
    322350         * @ticket 28315
     351         *
     352         * @covers ::add_post_meta
     353         * @covers ::update_metadata
     354         * @covers ::delete_metadata
     355         * @covers ::get_metadata
     356         * @covers ::metadata_exists
    323357         */
    324358        function test_non_numeric_object_id() {
    325359                $this->assertFalse( add_metadata( 'user', array( 1 ), 'meta_key', 'meta_value' ) );
     
    331365
    332366        /**
    333367         * @ticket 28315
     368         *
     369         * @covers ::add_post_meta
     370         * @covers ::update_metadata
     371         * @covers ::delete_metadata
    334372         */
    335373        function test_non_numeric_meta_id() {
    336374                $this->assertFalse( get_metadata_by_mid( 'user', array( 1 ) ) );
     
    340378
    341379        /**
    342380         * @ticket 37746
     381         *
     382         * @covers ::add_post_meta
     383         * @covers ::update_metadata
     384         * @covers ::delete_metadata
    343385         */
    344386        function test_negative_meta_id() {
    345387                $negative_mid = $this->meta_id * -1;
     
    352394
    353395        /**
    354396         * @ticket 37746
     397         *
     398         * @covers ::add_post_meta
     399         * @covers ::update_metadata
     400         * @covers ::delete_metadata
    355401         */
    356402        function test_floating_meta_id() {
    357403                $floating_mid = $this->meta_id + 0.1337;
     
    364410
    365411        /**
    366412         * @ticket 37746
     413         *
     414         * @covers ::add_post_meta
     415         * @covers ::update_metadata
     416         * @covers ::delete_metadata
    367417         */
    368418        function test_string_point_zero_meta_id() {
    369419                $meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value_2' );
     
    379429
    380430        /**
    381431         * @ticket 15030
     432         *
     433         * @covers ::get_metadata
    382434         */
    383435        public function test_get_metadata_with_empty_key_array_value() {
    384436                $data  = array( 1, 2 );
     
    391443
    392444        /**
    393445         * @ticket 15030
     446         *
     447         * @covers ::get_metadata
    394448         */
    395449        public function test_get_metadata_with_empty_key_object_value() {
    396450                $data      = new stdClass;
     
    404458
    405459        /**
    406460         * @ticket 15030
     461         *
     462         * @covers ::get_metadata
    407463         */
    408464        public function test_get_metadata_with_empty_key_nested_array_value() {
    409465                $data  = array(
  • tests/phpunit/tests/multisite.php

     
    2222                        $wpdb->suppress_errors( $this->suppress );
    2323                }
    2424
     25                /**
     26                 *
     27                 * @covers ::wpmu_log_new_registrations
     28                 */
    2529                function test_wpmu_log_new_registrations() {
    2630                        global $wpdb;
    2731
     
    3741
    3842                /**
    3943                 * @ticket 37392
     44                 *
     45                 * @covers ::wp_count_sites
    4046                 */
    4147                function test_wp_count_sites() {
    4248                        // Create a random number of sites with each status.
  • tests/phpunit/tests/pluggable.php

     
    1212         * @ticket 33867
    1313         *
    1414         * @dataProvider get_defined_pluggable_functions
     15         *
     16         * @covers ::wp_set_current_user
     17         * @covers ::wp_get_current_user
     18         * @covers ::get_userdata
     19         * @covers ::get_user_by
     20         * @covers ::cache_users
     21         * @covers ::wp_mail
     22         * @covers ::wp_authenticate
     23         * @covers ::wp_logout
     24         * @covers ::wp_validate_auth_cookie
     25         * @covers ::wp_generate_auth_cookie
     26         * @covers ::wp_parse_auth_cookie
     27         * @covers ::wp_set_auth_cookie
     28         * @covers ::wp_clear_auth_cookie
     29         * @covers ::is_user_logged_in
     30         * @covers ::auth_redirect
     31         * @covers ::check_admin_referer
     32         * @covers ::check_ajax_referer
     33         * @covers ::wp_redirect
     34         * @covers ::wp_sanitize_redirect
     35         * @covers ::_wp_sanitize_utf8_in_redirect
     36         * @covers ::wp_safe_redirect
     37         * @covers ::wp_validate_redirect
     38         * @covers ::wp_notify_postauthor
     39         * @covers ::wp_notify_moderator
     40         * @covers ::wp_password_change_notification
     41         * @covers ::wp_new_user_notification
     42         * @covers ::wp_nonce_tick
     43         * @covers ::wp_verify_nonce
     44         * @covers ::wp_create_nonce
     45         * @covers ::wp_salt
     46         * @covers ::wp_hash
     47         * @covers ::wp_hash_password
     48         * @covers ::wp_check_password
     49         * @covers ::wp_generate_password
     50         * @covers ::wp_rand
     51         * @covers ::wp_set_password
     52         * @covers ::get_avatar
     53         * @covers ::wp_text_diff
     54         * @covers ::install_network
     55         * @covers ::wp_install
     56         * @covers ::wp_install_defaults
     57         * @covers ::wp_new_blog_notification
     58         * @covers ::wp_upgrade
     59         * @covers ::install_global_terms
     60         * @covers ::wp_cache_add
     61         * @covers ::wp_cache_close
     62         * @covers ::wp_cache_decr
     63         * @covers ::wp_cache_delete
     64         * @covers ::wp_cache_flush
     65         * @covers ::wp_cache_get
     66         * @covers ::wp_cache_get_multiple
     67         * @covers ::wp_cache_incr
     68         * @covers ::wp_cache_init
     69         * @covers ::wp_cache_replace
     70         * @covers ::wp_cache_set
     71         * @covers ::wp_cache_switch_to_blog
     72         * @covers ::wp_cache_add_global_groups
     73         * @covers ::wp_cache_add_non_persistent_groups
     74         * @covers ::wp_cache_reset
    1575         */
    1676        public function test_pluggable_function_signatures_match( $function ) {
    1777
     
    53113         *
    54114         * @ticket 33654
    55115         * @ticket 33867
     116         *
     117         * @covers ::wp_set_current_user
     118         * @covers ::wp_get_current_user
     119         * @covers ::get_userdata
     120         * @covers ::get_user_by
     121         * @covers ::cache_users
     122         * @covers ::wp_mail
     123         * @covers ::wp_authenticate
     124         * @covers ::wp_logout
     125         * @covers ::wp_validate_auth_cookie
     126         * @covers ::wp_generate_auth_cookie
     127         * @covers ::wp_parse_auth_cookie
     128         * @covers ::wp_set_auth_cookie
     129         * @covers ::wp_clear_auth_cookie
     130         * @covers ::is_user_logged_in
     131         * @covers ::auth_redirect
     132         * @covers ::check_admin_referer
     133         * @covers ::check_ajax_referer
     134         * @covers ::wp_redirect
     135         * @covers ::wp_sanitize_redirect
     136         * @covers ::_wp_sanitize_utf8_in_redirect
     137         * @covers ::wp_safe_redirect
     138         * @covers ::wp_validate_redirect
     139         * @covers ::wp_notify_postauthor
     140         * @covers ::wp_notify_moderator
     141         * @covers ::wp_password_change_notification
     142         * @covers ::wp_new_user_notification
     143         * @covers ::wp_nonce_tick
     144         * @covers ::wp_verify_nonce
     145         * @covers ::wp_create_nonce
     146         * @covers ::wp_salt
     147         * @covers ::wp_hash
     148         * @covers ::wp_hash_password
     149         * @covers ::wp_check_password
     150         * @covers ::wp_generate_password
     151         * @covers ::wp_rand
     152         * @covers ::wp_set_password
     153         * @covers ::get_avatar
     154         * @covers ::wp_text_diff
     155         * @covers ::install_network
     156         * @covers ::wp_install
     157         * @covers ::wp_install_defaults
     158         * @covers ::wp_new_blog_notification
     159         * @covers ::wp_upgrade
     160         * @covers ::install_global_terms
     161         * @covers ::wp_cache_add
     162         * @covers ::wp_cache_close
     163         * @covers ::wp_cache_decr
     164         * @covers ::wp_cache_delete
     165         * @covers ::wp_cache_flush
     166         * @covers ::wp_cache_get
     167         * @covers ::wp_cache_get_multiple
     168         * @covers ::wp_cache_incr
     169         * @covers ::wp_cache_init
     170         * @covers ::wp_cache_replace
     171         * @covers ::wp_cache_set
     172         * @covers ::wp_cache_switch_to_blog
     173         * @covers ::wp_cache_add_global_groups
     174         * @covers ::wp_cache_add_non_persistent_groups
     175         * @covers ::wp_cache_reset
     176
    56177         */
    57178        public function test_all_pluggable_functions_exist() {
    58179
  • tests/phpunit/tests/post.php

     
    5858
    5959        /**
    6060         * Test simple valid behavior: insert and get a post.
     61         *
     62         * @covers ::wp_insert_post
     63         * @covers ::wp_delete_post
    6164         */
    6265        function test_vb_insert_get_delete() {
    6366                register_post_type( 'cpt', array( 'taxonomies' => array( 'post_tag', 'ctax' ) ) );
     
    119122
    120123        /**
    121124         * Insert a post with a future date, and make sure the status and cron schedule are correct.
     125         *
     126         * @covers ::wp_insert_post
    122127         */
    123128        function test_vb_insert_future() {
    124129                $future_date = strtotime( '+1 day' );
     
    153158
    154159        /**
    155160         * Insert a post with a future date, and make sure the status and cron schedule are correct.
     161         *
     162         * @covers ::wp_insert_post
    156163         */
    157164        function test_vb_insert_future_over_dst() {
    158165                // Some magic days - one DST one not.
     
    199206         * Future post bug: posts get published at the wrong time if you edit the timestamp.
    200207         *
    201208         * @ticket 4710
     209         *
     210         * @covers ::wp_insert_post
    202211         */
    203212        function test_vb_insert_future_edit_bug() {
    204213                $future_date_1 = strtotime( '+1 day' );
     
    242251
    243252        /**
    244253         * Insert a draft post with a future date, and make sure no cron schedule is set.
     254         *
     255         * @covers ::wp_insert_post
    245256         */
    246257        function test_vb_insert_future_draft() {
    247258                $future_date = strtotime( '+1 day' );
     
    277288
    278289        /**
    279290         * Insert a future post, then edit and change it to draft, and make sure cron gets it right.
     291         *
     292         * @covers ::wp_insert_post
    280293         */
    281294        function test_vb_insert_future_change_to_draft() {
    282295                $future_date_1 = strtotime( '+1 day' );
     
    318331
    319332        /**
    320333         * Insert a future post, then edit and change the status, and make sure cron gets it right.
     334         *
     335         * @covers ::wp_insert_post
    321336         */
    322337        function test_vb_insert_future_change_status() {
    323338                $future_date_1 = strtotime( '+1 day' );
     
    363378
    364379        /**
    365380         * Insert a draft post with a future date, and make sure no cron schedule is set.
     381         *
     382         * @covers ::wp_insert_post
    366383         */
    367384        function test_vb_insert_future_private() {
    368385                $future_date = strtotime( '+1 day' );
     
    399416         * Insert a post with an invalid date, make sure it fails.
    400417         *
    401418         * @ticket 17180
     419         *
     420         * @covers ::wp_insert_post
    402421         */
    403422        function test_vb_insert_invalid_date() {
    404423                $post = array(
     
    420439
    421440        /**
    422441         * Insert a future post, then edit and change it to private, and make sure cron gets it right.
     442         *
     443         * @covers ::wp_insert_post
    423444         */
    424445        function test_vb_insert_future_change_to_private() {
    425446                $future_date_1 = strtotime( '+1 day' );
     
    461482
    462483        /**
    463484         * @ticket 5305
     485         *
     486         * @covers ::wp_insert_post
    464487         */
    465488        public function test_wp_insert_post_should_not_allow_a_bare_numeric_slug_that_might_conflict_with_a_date_archive_when_generating_from_an_empty_post_title() {
    466489                $this->set_permalink_structure( '/%postname%/' );
     
    484507        /**
    485508         * @ticket 5305
    486509         * @ticket 33392
     510         *
     511         * @covers ::wp_insert_post
    487512         */
    488513        public function test_wp_insert_post_should_invalidate_post_cache_before_generating_guid_when_post_name_is_empty_and_is_generated_from_the_post_ID() {
    489514                register_post_type( 'wptests_pt' );
     
    503528
    504529        /**
    505530         * @ticket 20451
     531         *
     532         * @covers ::wp_insert_post
    506533         */
    507534        public function test_wp_insert_post_with_meta_input() {
    508535                $post_id = wp_insert_post(
     
    526553         * "When I delete a future post using wp_delete_post( $post->ID ) it does not update the cron correctly."
    527554         *
    528555         * @ticket 5364
     556         *
     557         * @covers ::wp_insert_post
    529558         */
    530559        function test_delete_future_post_cron() {
    531560                $future_date = strtotime( '+1 day' );
     
    557586         * Might only fail if the post ID is greater than four characters.
    558587         *
    559588         * @ticket 5305
     589         *
     590         * @covers ::wp_insert_post
    560591         */
    561592        function test_permalink_without_title() {
    562593                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
     
    593624
    594625        /**
    595626         * @ticket 22944
     627         *
     628         * @covers ::wp_insert_post
    596629         */
    597630        function test_wp_insert_post_and_wp_publish_post_with_future_date() {
    598631                $future_date = gmdate( 'Y-m-d H:i:s', time() + 10000000 );
     
    616649
    617650        /**
    618651         * @ticket 48145
     652         *
     653         * @covers ::wp_insert_post
    619654         */
    620655        function test_wp_insert_post_should_default_to_publish_if_post_date_is_within_59_seconds_from_current_time() {
    621656                $future_date = gmdate( 'Y-m-d H:i:s', time() + 59 );
     
    632667
    633668        /**
    634669         * @ticket 22944
     670         *
     671         * @covers ::wp_insert_post
     672         * @covers ::wp_update_post
    635673         */
    636674        function test_publish_post_with_content_filtering() {
    637675                kses_remove_filters();
     
    657695
    658696        /**
    659697         * @ticket 22944
     698         *
     699         * @covers ::wp_insert_post
     700         * @covers ::wp_update_post
    660701         */
    661702        function test_wp_publish_post_and_avoid_content_filtering() {
    662703                kses_remove_filters();
     
    677718
    678719        /**
    679720         * @ticket 23708
     721         *
     722         * @covers ::get_post_ancestors
    680723         */
    681724        function test_get_post_ancestors_within_loop() {
    682725                global $post;
     
    687730
    688731        /**
    689732         * @ticket 23474
     733         *
     734         * @covers ::wp_insert_post
     735         * @covers ::wp_update_post
    690736         */
    691737        function test_update_invalid_post_id() {
    692738                $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
     
    702748
    703749        }
    704750
     751        /**
     752         *
     753         * @covers ::setup_postdata
     754         */
    705755        function test_parse_post_content_single_page() {
    706756                global $multipage, $pages, $numpages;
    707757                $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0' ) );
     
    713763                $this->assertEquals( array( 'Page 0' ), $pages );
    714764        }
    715765
     766        /**
     767         *
     768         * @covers ::setup_postdata
     769         */
    716770        function test_parse_post_content_multi_page() {
    717771                global $multipage, $pages, $numpages;
    718772                $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
     
    724778                $this->assertEquals( array( 'Page 0', 'Page 1', 'Page 2', 'Page 3' ), $pages );
    725779        }
    726780
     781        /**
     782         *
     783         * @covers ::setup_postdata
     784         */
    727785        function test_parse_post_content_remaining_single_page() {
    728786                global $multipage, $pages, $numpages;
    729787                $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0' ) );
     
    735793                $this->assertEquals( array( 'Page 0' ), $pages );
    736794        }
    737795
     796        /**
     797         *
     798         * @covers ::setup_postdata
     799         */
    738800        function test_parse_post_content_remaining_multi_page() {
    739801                global $multipage, $pages, $numpages;
    740802                $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
     
    748810
    749811        /**
    750812         * @ticket 16746
     813         *
     814         * @covers ::setup_postdata
    751815         */
    752816        function test_parse_post_content_starting_with_nextpage() {
    753817                global $multipage, $pages, $numpages;
     
    762826
    763827        /**
    764828         * @ticket 16746
     829         *
     830         * @covers ::setup_postdata
    765831         */
    766832        function test_parse_post_content_starting_with_nextpage_multi() {
    767833                global $multipage, $pages, $numpages;
     
    776842
    777843        /**
    778844         * @ticket 19373
     845         *
     846         * @covers ::wp_insert_post
    779847         */
    780848        function test_insert_programmatic_sanitized() {
    781849                $this->_unset_current_user();
     
    802870
    803871        /**
    804872         * @ticket 24803
     873         *
     874         * @covers ::wp_count_posts
    805875         */
    806876        function test_wp_count_posts() {
    807877                $post_type = rand_str( 20 );
     
    818888                $this->assertEquals( new stdClass, wp_count_posts( $post_type, 'readable' ) );
    819889        }
    820890
     891        /**
     892         *
     893         * @covers ::wp_count_posts
     894         */
    821895        function test_wp_count_posts_filtered() {
    822896                $post_type = rand_str( 20 );
    823897                register_post_type( $post_type );
     
    843917                return $counts;
    844918        }
    845919
     920        /**
     921         *
     922         * @covers ::wp_count_posts
     923         */
    846924        function test_wp_count_posts_insert_invalidation() {
    847925                $post_ids       = self::factory()->post->create_many( 3 );
    848926                $initial_counts = wp_count_posts();
     
    861939                $this->assertNotEquals( $initial_counts->publish, $after_draft_counts->publish );
    862940        }
    863941
     942        /**
     943         *
     944         * @covers ::wp_count_posts
     945         */
    864946        function test_wp_count_posts_trash_invalidation() {
    865947                $post_ids       = self::factory()->post->create_many( 3 );
    866948                $initial_counts = wp_count_posts();
     
    881963
    882964        /**
    883965         * @ticket 49685
     966         *
     967         * @covers ::wp_count_posts
    884968         */
    885969        function test_wp_count_posts_status_changes_visible() {
    886970                self::factory()->post->create_many( 3 );
     
    897981
    898982        /**
    899983         * @ticket 13771
     984         *
     985         * @covers ::get_the_date
    900986         */
    901987        function test_get_the_date_with_id_returns_correct_time() {
    902988                $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     
    905991
    906992        /**
    907993         * @ticket 28310
     994         *
     995         * @covers ::get_the_date
    908996         */
    909997        function test_get_the_date_returns_false_with_null_or_non_existing_post() {
    910998                $this->assertFalse( get_the_date() );
     
    9151003
    9161004        /**
    9171005         * @ticket 28310
     1006         *
     1007         * @covers ::get_the_time
    9181008         */
    9191009        function test_get_the_time_with_id_returns_correct_time() {
    9201010                $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     
    9231013
    9241014        /**
    9251015         * @ticket 28310
     1016         *
     1017         * @covers ::get_the_time
    9261018         */
    9271019        function test_get_the_time_returns_false_with_null_or_non_existing_post() {
    9281020                $this->assertFalse( get_the_time() );
     
    9331025
    9341026        /**
    9351027         * @ticket 28310
     1028         *
     1029         * @covers ::get_post_time
    9361030         */
    9371031        function test_get_post_time_with_id_returns_correct_time() {
    9381032                $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     
    9411035
    9421036        /**
    9431037         * @ticket 28310
     1038         *
     1039         * @covers ::get_post_time
    9441040         */
    9451041        function test_get_post_time_returns_false_with_null_or_non_existing_post() {
    9461042                $this->assertFalse( get_post_time() );
     
    9511047
    9521048        /**
    9531049         * @ticket 28310
     1050         *
     1051         * @covers ::get_post_modified_time
    9541052         */
    9551053        function test_get_post_modified_time_with_id_returns_correct_time() {
    9561054                $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     
    9591057
    9601058        /**
    9611059         * @ticket 28310
     1060         *
     1061         * @covers ::get_post_modified_time
    9621062         */
    9631063        function test_get_post_modified_time_returns_false_with_null_or_non_existing_post() {
    9641064                $this->assertFalse( get_post_modified_time() );
     
    9691069
    9701070        /**
    9711071         * @ticket 28310
     1072         *
     1073         * @covers ::mysql2date
    9721074         */
    9731075        function test_mysql2date_returns_false_with_no_date() {
    9741076                $this->assertFalse( mysql2date( 'F j, Y H:i:s', '' ) );
     
    9761078
    9771079        /**
    9781080         * @ticket 28310
     1081         *
     1082         * @covers ::mysql2date
    9791083         */
    9801084        function test_mysql2date_returns_gmt_or_unix_timestamp() {
    9811085                $this->assertEquals( '441013392', mysql2date( 'G', '1983-12-23 07:43:12' ) );
     
    9841088
    9851089        /**
    9861090         * @ticket 25566
     1091         *
     1092         * @covers ::wp_tag_cloud
    9871093         */
    9881094        function test_wp_tag_cloud_link_with_post_type() {
    9891095                $post_type = 'new_post_type';
     
    10171123
    10181124        /**
    10191125         * @ticket 21212
     1126         *
     1127         * @covers ::edit_post
    10201128         */
    10211129        function test_utf8mb3_post_saves_with_emoji() {
    10221130                global $wpdb;
     
    10531161
    10541162        /**
    10551163         * @ticket 31168
     1164         *
     1165         * @covers ::wp_insert_post
    10561166         */
    10571167        function test_wp_insert_post_default_comment_ping_status_open() {
    10581168                $post_id = self::factory()->post->create(
     
    10711181
    10721182        /**
    10731183         * @ticket 31168
     1184         *
     1185         * @covers ::wp_insert_post
    10741186         */
    10751187        function test_wp_insert_post_page_default_comment_ping_status_closed() {
    10761188                $post_id = self::factory()->post->create(
     
    10901202
    10911203        /**
    10921204         * @ticket 31168
     1205         *
     1206         * @covers ::wp_insert_post
    10931207         */
    10941208        function test_wp_insert_post_cpt_default_comment_ping_status_open() {
    10951209                $post_type = rand_str( 20 );
     
    11121226
    11131227        /**
    11141228         * @ticket 31168
     1229         *
     1230         * @covers ::wp_insert_post
    11151231         */
    11161232        function test_wp_insert_post_cpt_default_comment_ping_status_closed() {
    11171233                $post_type = rand_str( 20 );
     
    11371253         * it should _stay_ sticky.
    11381254         *
    11391255         * @ticket 24153
     1256         *
     1257         * @covers ::stick_post
    11401258         */
    11411259        function test_user_without_publish_cannot_affect_sticky() {
    11421260                wp_set_current_user( self::$grammarian_id );
     
    11751293         * the sticky status of the post should not be changed.
    11761294         *
    11771295         * @ticket 24153
     1296         *
     1297         * @covers ::stick_post
    11781298         */
    11791299        function test_user_without_publish_cannot_affect_sticky_with_edit_post() {
    11801300                // Create a sticky post.
     
    12151335         * Test that hooks are fired when post gets stuck and unstuck.
    12161336         *
    12171337         * @ticket 35600
     1338         *
     1339         * @covers ::stick_post
    12181340         */
    12191341        function test_hooks_fire_when_post_gets_stuck_and_unstuck() {
    12201342                $post_id = self::factory()->post->create();
     
    12431365         * a new slug should not be generated.
    12441366         *
    12451367         * @ticket 34865
     1368         *
     1369         * @covers ::wp_insert_post
    12461370         */
    12471371        function test_post_updates_without_slug_provided() {
    12481372                $post_id = self::factory()->post->create(
     
    12661390
    12671391        /**
    12681392         * @ticket 32585
     1393         *
     1394         * @covers ::wp_insert_post
    12691395         */
    12701396        public function test_wp_insert_post_author_zero() {
    12711397                $post_id = self::factory()->post->create( array( 'post_author' => 0 ) );
     
    12751401
    12761402        /**
    12771403         * @ticket 32585
     1404         *
     1405         * @covers ::wp_insert_post
    12781406         */
    12791407        public function test_wp_insert_post_author_null() {
    12801408                $post_id = self::factory()->post->create( array( 'post_author' => null ) );
     
    12841412
    12851413        /**
    12861414         * @ticket 15946
     1415         *
     1416         * @covers ::wp_insert_post
    12871417         */
    12881418        function test_wp_insert_post_should_respect_post_date_gmt() {
    12891419                $post = array(
     
    13061436                $this->assertEquals( $post['post_date_gmt'], $out->post_date_gmt );
    13071437        }
    13081438
     1439        /**
     1440         *
     1441         * @covers ::wp_delete_post
     1442         */
    13091443        function test_wp_delete_post_reassign_hierarchical_post_type() {
    13101444                $grandparent_page_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    13111445                $parent_page_id      = self::factory()->post->create(
     
    13321466         *
    13331467         * @see _wp_customize_changeset_filter_insert_post_data()
    13341468         * @ticket 30937
     1469         *
     1470         * @covers ::wp_insert_post
    13351471         */
    13361472        function test_wp_insert_post_for_customize_changeset_should_not_drop_post_name() {
    13371473
     
    13851521         *
    13861522         * @see wp_unique_post_slug()
    13871523         * @ticket 21112
     1524         *
     1525         * @covers ::wp_insert_post
    13881526         */
    13891527        function test_pre_wp_unique_post_slug_filter() {
    13901528                add_filter( 'pre_wp_unique_post_slug', array( $this, 'filter_pre_wp_unique_post_slug' ), 10, 6 );
     
    14081546
    14091547        /**
    14101548         * @ticket 48113
     1549         *
     1550         * @covers ::wp_insert_post
    14111551         */
    14121552        public function test_insert_post_should_respect_date_floating_post_status_arg() {
    14131553                register_post_status( 'floating', array( 'date_floating' => true ) );
     
    14261566
    14271567        /**
    14281568         * @ticket 48113
     1569         *
     1570         * @covers ::wp_insert_post
    14291571         */
    14301572        public function test_insert_post_should_respect_date_floating_post_status_arg_not_set() {
    14311573                register_post_status( 'not-floating', array( 'date_floating' => false ) );
     
    14501592         * and is different from the existing tags.
    14511593         *
    14521594         * @ticket 45121
     1595         *
     1596         * @covers ::wp_update_post
    14531597         */
    14541598        public function test_update_post_should_only_modify_post_tags_if_different_tags_input_was_provided() {
    14551599                $tag_1 = wp_insert_term( 'wp_update_post_tag', 'post_tag', array( 'slug' => 'wp_update_post_tag_1' ) );
  • tests/phpunit/tests/query.php

     
    1111
    1212        /**
    1313         * @ticket 24785
     14         *
     15         * @covers WP_Query::reset_postdata
    1416         */
    1517        function test_nested_loop_reset_postdata() {
    1618                $post_id        = self::factory()->post->create();
     
    3133
    3234        /**
    3335         * @ticket 16471
     36         *
     37         * @covers WP_Query::get
    3438         */
    3539        function test_default_query_var() {
    3640                $query = new WP_Query;
     
    4145
    4246        /**
    4347         * @ticket 25380
     48         *
     49         * @covers WP_Query::get_posts
    4450         */
    4551        function test_pre_posts_per_page() {
    4652                self::factory()->post->create_many( 10 );
     
    5864
    5965        /**
    6066         * @ticket 26627
     67         *
     68         * @covers ::get_term_by
     69         * @covers ::get_query_var
     70         * @covers ::get_queried_object
    6171         */
    6272        function test_tag_queried_object() {
    6373                $slug = 'tag-slug-26627';
     
    8999
    90100        /**
    91101         * @ticket 31246
     102         *
     103         * @covers WP_Query::get_queried_object
    92104         */
    93105        public function test_get_queried_object_should_return_null_when_is_tax_is_true_but_the_taxonomy_args_have_been_removed_in_a_parse_query_callback() {
    94106                // Don't override the args provided below.
     
    125137
    126138        /**
    127139         * @ticket 37962
     140         *
     141         * @covers WP_Query::get_queried_object
    128142         */
    129143        public function test_get_queried_object_should_return_null_for_not_exists_tax_query() {
    130144                register_taxonomy( 'wptests_tax', 'post' );
     
    144158                $this->assertNull( $queried_object );
    145159        }
    146160
     161        /**
     162         *
     163         * @covers WP_Query::__construct
     164         */
    147165        public function test_orderby_space_separated() {
    148166                global $wpdb;
    149167
     
    157175                $this->assertContains( "ORDER BY $wpdb->posts.post_title DESC, $wpdb->posts.post_date DESC", $q->request );
    158176        }
    159177
     178        /**
     179         *
     180         * @covers ::wp_set_object_terms
     181         */
    160182        public function test_cat_querystring_single_term() {
    161183                $c1 = self::factory()->category->create(
    162184                        array(
     
    193215                $this->assertEqualSets( array( $p1, $p2 ), $matching_posts );
    194216        }
    195217
     218        /**
     219         *
     220         * @covers ::wp_set_object_terms
     221         */
    196222        public function test_category_querystring_multiple_terms_comma_separated() {
    197223                $c1 = self::factory()->category->create(
    198224                        array(
     
    239265
    240266        /**
    241267         * @ticket 33532
     268         *
     269         * @covers ::wp_set_object_terms
    242270         */
    243271        public function test_category_querystring_multiple_terms_formatted_as_array() {
    244272                $c1 = self::factory()->category->create(
     
    284312                $this->assertEqualSets( array( $p1, $p2, $p3 ), $matching_posts );
    285313        }
    286314
    287 
     315        /**
     316         *
     317         * @covers ::wp_set_object_terms
     318         */
    288319        public function test_tag_querystring_single_term() {
    289320                $t1 = self::factory()->tag->create_and_get(
    290321                        array(
     
    321352                $this->assertEqualSets( array( $p1, $p2 ), $matching_posts );
    322353        }
    323354
     355        /**
     356         *
     357         * @covers ::wp_set_object_terms
     358         */
    324359        public function test_tag_querystring_multiple_terms_comma_separated() {
    325360                $c1 = self::factory()->tag->create_and_get(
    326361                        array(
     
    367402
    368403        /**
    369404         * @ticket 33532
     405         *
     406         * @covers WP_Query::get_posts
    370407         */
    371408        public function test_tag_querystring_multiple_terms_formatted_as_array() {
    372409                $c1 = self::factory()->tag->create_and_get(
     
    412449                $this->assertEqualSets( array( $p1, $p2, $p3 ), $matching_posts );
    413450        }
    414451
     452        /**
     453         *
     454         * @covers WP_Query::get_posts
     455         */
    415456        public function test_custom_taxonomy_querystring_single_term() {
    416457                register_taxonomy( 'test_tax_cat', 'post' );
    417458
     
    439480                $this->assertEqualSets( array( $p1, $p2 ), wp_list_pluck( $GLOBALS['wp_query']->posts, 'ID' ) );
    440481        }
    441482
     483        /**
     484         *
     485         * @covers WP_Query::get_posts
     486         */
    442487        public function test_custom_taxonomy_querystring_multiple_terms_comma_separated() {
    443488                register_taxonomy( 'test_tax_cat', 'post' );
    444489
     
    470515
    471516        /**
    472517         * @ticket 32454
     518         *
     519         * @covers WP_Query::get_posts
    473520         */
    474521        public function test_custom_taxonomy_querystring_multiple_terms_formatted_as_array() {
    475522                register_taxonomy( 'test_tax_cat', 'post' );
     
    502549
    503550        /**
    504551         * @ticket 31355
     552         *
     553         * @covers WP_Query::is_404
    505554         */
    506555        public function test_pages_dont_404_when_queried_post_id_is_modified() {
    507556                $post_id = self::factory()->post->create(
     
    524573
    525574        /**
    526575         * @ticket 31355
     576         *
     577         * @covers WP_Query::is_404
    527578         */
    528579        public function test_custom_hierarchical_post_types_404_when_queried_post_id_is_modified() {
    529580                global $wp_rewrite;
     
    561612
    562613        /**
    563614         * @ticket 34060
     615         *
     616         * @covers WP_Query::__construct
    564617         */
    565618        public function test_offset_0_should_override_page() {
    566619                $q = new WP_Query(
     
    576629
    577630        /**
    578631         * @ticket 34060
     632         *
     633         * @covers WP_Query::__construct
    579634         */
    580635        public function test_offset_should_be_ignored_when_not_set() {
    581636                $q = new WP_Query(
     
    590645
    591646        /**
    592647         * @ticket 34060
     648         *
     649         * @covers WP_Query::__construct
    593650         */
    594651        public function test_offset_should_be_ignored_when_passed_a_non_numeric_value() {
    595652                $q = new WP_Query(
     
    605662
    606663        /**
    607664         * @ticket 35601
     665         *
     666         * @covers WP_Query::__construct
    608667         */
    609668        public function test_comment_status() {
    610669                $p1 = self::factory()->post->create( array( 'comment_status' => 'open' ) );
     
    622681
    623682        /**
    624683         * @ticket 35601
     684         *
     685         * @covers WP_Query::__construct
    625686         */
    626687        public function test_ping_status() {
    627688                $p1 = self::factory()->post->create( array( 'ping_status' => 'open' ) );
     
    639700
    640701        /**
    641702         * @ticket 35619
     703         *
     704         * @covers ::get_queried_object
    642705         */
    643706        public function test_get_queried_object_should_return_first_of_multiple_terms() {
    644707                register_taxonomy( 'tax1', 'post' );
     
    669732
    670733        /**
    671734         * @ticket 35619
     735         *
     736         * @covers ::get_queried_object
    672737         */
    673738        public function test_query_vars_should_match_first_of_multiple_terms() {
    674739                register_taxonomy( 'tax1', 'post' );
  • tests/phpunit/tests/rest-api.php

     
    2929
    3030        /**
    3131         * Checks that the main classes are loaded.
     32         *
     33         * @covers WP_REST_Server::__construct
     34         * @covers WP_REST_Request::__construct
     35         * @covers WP_REST_Response::__construct
     36         * @covers WP_REST_Posts_Controller::__construct
    3237         */
    3338        function test_rest_api_active() {
    3439                $this->assertTrue( class_exists( 'WP_REST_Server' ) );
     
    4045        /**
    4146         * The rest_api_init hook should have been registered with init, and should
    4247         * have a default priority of 10.
     48         *
     49         * @covers ::rest_api_init
    4350         */
    4451        function test_init_action_added() {
    4552                $this->assertEquals( 10, has_action( 'init', 'rest_api_init' ) );
    4653        }
    4754
     55        /**
     56         *
     57         * @covers ::create_initial_taxonomies
     58         */
    4859        public function test_add_extra_api_taxonomy_arguments() {
    4960                $taxonomy = get_taxonomy( 'category' );
    5061                $this->assertTrue( $taxonomy->show_in_rest );
     
    5768                $this->assertEquals( 'WP_REST_Terms_Controller', $taxonomy->rest_controller_class );
    5869        }
    5970
     71        /**
     72         *
     73         * @covers ::create_initial_post_types
     74         */
    6075        public function test_add_extra_api_post_type_arguments() {
    6176                $post_type = get_post_type_object( 'post' );
    6277                $this->assertTrue( $post_type->show_in_rest );
     
    7893         * Check that a single route is canonicalized.
    7994         *
    8095         * Ensures that single and multiple routes are handled correctly.
     96         *
     97         * @covers ::register_rest_route
    8198         */
    8299        public function test_route_canonicalized() {
    83100                register_rest_route(
     
    114131         * Check that a single route is canonicalized.
    115132         *
    116133         * Ensures that single and multiple routes are handled correctly.
     134         *
     135         * @covers ::register_rest_route
    117136         */
    118137        public function test_route_canonicalized_multiple() {
    119138                register_rest_route(
     
    157176
    158177        /**
    159178         * Check that routes are merged by default.
     179         *
     180         * @covers ::register_rest_route
    160181         */
    161182        public function test_route_merge() {
    162183                register_rest_route(
     
    186207
    187208        /**
    188209         * Check that we can override routes.
     210         *
     211         * @covers ::register_rest_route
    189212         */
    190213        public function test_route_override() {
    191214                register_rest_route(
     
    224247         * Test that we reject routes without namespaces
    225248         *
    226249         * @expectedIncorrectUsage register_rest_route
     250         *
     251         * @covers ::register_rest_route
    227252         */
    228253        public function test_route_reject_empty_namespace() {
    229254                register_rest_route(
     
    244269         * Test that we reject empty routes
    245270         *
    246271         * @expectedIncorrectUsage register_rest_route
     272         *
     273         * @covers ::register_rest_route
    247274         */
    248275        public function test_route_reject_empty_route() {
    249276                register_rest_route(
     
    262289
    263290        /**
    264291         * The rest_route query variable should be registered.
     292         *
     293         * @covers ::rest_api_init
    265294         */
    266295        function test_rest_route_query_var() {
    267296                rest_api_init();
     
    268297                $this->assertTrue( in_array( 'rest_route', $GLOBALS['wp']->public_query_vars, true ) );
    269298        }
    270299
     300        /**
     301         *
     302         * @covers ::register_rest_route
     303         */
    271304        public function test_route_method() {
    272305                register_rest_route(
    273306                        'test-ns',
     
    286319
    287320        /**
    288321         * The 'methods' arg should accept a single value as well as array.
     322         *
     323         * @covers ::register_rest_route
    289324         */
    290325        public function test_route_method_string() {
    291326                register_rest_route(
     
    305340
    306341        /**
    307342         * The 'methods' arg should accept a single value as well as array.
     343         *
     344         * @covers ::register_rest_route
    308345         */
    309346        public function test_route_method_array() {
    310347                register_rest_route(
     
    330367
    331368        /**
    332369         * The 'methods' arg should a comma-separated string.
     370         *
     371         * @covers ::register_rest_route
    333372         */
    334373        public function test_route_method_comma_separated() {
    335374                register_rest_route(
     
    353392                );
    354393        }
    355394
     395        /**
     396         *
     397         * @covers ::register_rest_route
     398         */
    356399        public function test_options_request() {
    357400                register_rest_route(
    358401                        'test-ns',
     
    375418
    376419        /**
    377420         * Ensure that the OPTIONS handler doesn't kick in for non-OPTIONS requests.
     421         *
     422         * @covers ::rest_handle_options_request
    378423         */
    379424        public function test_options_request_not_options() {
    380425                register_rest_route(
     
    395440
    396441        /**
    397442         * Ensure that result fields are not allowed if no request['_fields'] is present.
     443         *
     444         * @covers ::rest_filter_response_fields
    398445         */
    399446        public function test_rest_filter_response_fields_no_request_filter() {
    400447                $response = new WP_REST_Response();
     
    407454
    408455        /**
    409456         * Ensure that result fields are allowed if request['_fields'] is present.
     457         *
     458         * @covers ::rest_filter_response_fields
    410459         */
    411460        public function test_rest_filter_response_fields_single_field_filter() {
    412461                $response = new WP_REST_Response();
     
    427476
    428477        /**
    429478         * Ensure that multiple comma-separated fields may be allowed with request['_fields'].
     479         *
     480         * @covers ::rest_filter_response_fields
    430481         */
    431482        public function test_rest_filter_response_fields_multi_field_filter() {
    432483                $response = new WP_REST_Response();
     
    458509        /**
    459510         * Ensure that multiple comma-separated fields may be allowed
    460511         * with request['_fields'] using query parameter array syntax.
     512         *
     513         * @covers ::rest_filter_response_fields
    461514         */
    462515        public function test_rest_filter_response_fields_multi_field_filter_array() {
    463516                $response = new WP_REST_Response();
     
    489542
    490543        /**
    491544         * Ensure that request['_fields'] allowed list apply to items in response collections.
     545         *
     546         * @covers ::rest_filter_response_fields
    492547         */
    493548        public function test_rest_filter_response_fields_numeric_array() {
    494549                $response = new WP_REST_Response();
     
    539594         * Ensure that nested fields may be allowed with request['_fields'].
    540595         *
    541596         * @ticket 42094
     597         *
     598         * @covers ::rest_filter_response_fields
    542599         */
    543600        public function test_rest_filter_response_fields_nested_field_filter() {
    544601                $response = new WP_REST_Response();
     
    580637         * Ensure inclusion of deeply nested fields may be controlled with request['_fields'].
    581638         *
    582639         * @ticket 49648
     640         *
     641         * @covers ::rest_filter_response_fields
    583642         */
    584643        public function test_rest_filter_response_fields_deeply_nested_field_filter() {
    585644                $response = new WP_REST_Response();
     
    622681         * Ensure that specifying a single top-level key in _fields includes that field and all children.
    623682         *
    624683         * @ticket 48266
     684         *
     685         * @covers ::rest_filter_response_fields
    625686         */
    626687        public function test_rest_filter_response_fields_top_level_key() {
    627688                $response = new WP_REST_Response();
     
    654715         * Ensure that a top-level key in _fields supersedes any specified children of that field.
    655716         *
    656717         * @ticket 48266
     718         *
     719         * @covers ::rest_filter_response_fields
    657720         */
    658721        public function test_rest_filter_response_fields_child_after_parent() {
    659722                $response = new WP_REST_Response();
     
    686749         * Ensure that specifying two sibling properties in _fields causes both to be included.
    687750         *
    688751         * @ticket 48266
     752         *
     753         * @covers ::rest_filter_response_fields
    689754         */
    690755        public function test_rest_filter_response_fields_include_all_specified_siblings() {
    691756                $response = new WP_REST_Response();
     
    716781
    717782        /**
    718783         * @ticket 42094
     784         *
     785         * @covers ::rest_is_field_included
    719786         */
    720787        public function test_rest_is_field_included() {
    721788                $fields = array(
     
    741808        /**
    742809         * The get_rest_url function should return a URL consistently terminated with a "/",
    743810         * whether the blog is configured with pretty permalink support or not.
     811         *
     812         * @covers ::get_rest_url
    744813         */
    745814        public function test_rest_url_generation() {
    746815                // In pretty permalinks case, we expect a path of wp-json/ with no query.
     
    758827
    759828        /**
    760829         * @ticket 34299
     830         *
     831         * @covers ::get_rest_url
    761832         */
    762833        public function test_rest_url_scheme() {
    763834                $_SERVER['SERVER_NAME'] = parse_url( home_url(), PHP_URL_HOST );
     
    799870
    800871        /**
    801872         * @ticket 42452
     873         *
     874         * @covers ::get_rest_url
    802875         */
    803876        public function test_always_prepend_path_with_slash_in_rest_url_filter() {
    804877                $filter = new MockAction();
     
    844917
    845918        /**
    846919         * @dataProvider jsonp_callback_provider
     920         *
     921         * @covers ::wp_check_jsonp_callback
    847922         */
    848923        public function test_jsonp_callback_check( $callback, $valid ) {
    849924                $this->assertEquals( $valid, wp_check_jsonp_callback( $callback ) );
     
    876951
    877952        /**
    878953         * @dataProvider rest_date_provider
     954         *
     955         * @covers ::rest_parse_date
    879956         */
    880957        public function test_rest_parse_date( $string, $value ) {
    881958                $this->assertEquals( $value, rest_parse_date( $string ) );
     
    908985
    909986        /**
    910987         * @dataProvider rest_date_force_utc_provider
     988         *
     989         * @covers ::rest_parse_date
    911990         */
    912991        public function test_rest_parse_date_force_utc( $string, $value ) {
    913992                $this->assertEquals( $value, rest_parse_date( $string, true ) );
     
    917996                return 'Spy_REST_Server';
    918997        }
    919998
     999        /**
     1000         *
     1001         * @covers ::register_rest_route
     1002         */
    9201003        public function test_register_rest_route_without_server() {
    9211004                $GLOBALS['wp_rest_server'] = null;
    9221005                add_filter( 'wp_rest_server_class', array( $this, 'filter_wp_rest_server_class' ) );
     
    9351018                $this->assertEquals( $routes['/test-ns/test'][0]['methods'], array( 'GET' => true ) );
    9361019        }
    9371020
     1021        /**
     1022         *
     1023         */
    9381024        function test_rest_preload_api_request_with_method() {
    9391025                $rest_server               = $GLOBALS['wp_rest_server'];
    9401026                $GLOBALS['wp_rest_server'] = null;
     
    9581044
    9591045        /**
    9601046         * @ticket 40614
     1047         *
     1048         * @covers ::rest_ensure_request
    9611049         */
    9621050        function test_rest_ensure_request_accepts_path_string() {
    9631051                $request = rest_ensure_request( '/wp/v2/posts' );
     
    9681056
    9691057        /**
    9701058         * @dataProvider _dp_rest_parse_embed_param
     1059         *
     1060         * @covers ::rest_parse_embed_param
    9711061         */
    9721062        public function test_rest_parse_embed_param( $expected, $embed ) {
    9731063                $this->assertEquals( $expected, rest_parse_embed_param( $embed ) );
     
    9971087         * @ticket 48819
    9981088         *
    9991089         * @dataProvider _dp_rest_filter_response_by_context
     1090         *
     1091         * @covers ::rest_filter_response_by_context
    10001092         */
    10011093        public function test_rest_filter_response_by_context( $schema, $data, $expected ) {
    10021094                $this->assertEquals( $expected, rest_filter_response_by_context( $data, $schema, 'view' ) );
     
    10041096
    10051097        /**
    10061098         * @ticket 49749
     1099         *
     1100         * @covers ::register_rest_route
    10071101         */
    10081102        public function test_register_route_with_invalid_namespace() {
    10091103                $this->setExpectedIncorrectUsage( 'register_rest_route' );
     
    10251119
    10261120        /**
    10271121         * @ticket 50075
     1122         *
     1123         * @covers ::register_rest_route
    10281124         */
    10291125        public function test_register_route_with_missing_permission_callback_top_level_route() {
    10301126                $this->setExpectedIncorrectUsage( 'register_rest_route' );
     
    10421138
    10431139        /**
    10441140         * @ticket 50075
     1141         *
     1142         * @covers ::register_rest_route
    10451143         */
    10461144        public function test_register_route_with_missing_permission_callback_single_wrapped_route() {
    10471145                $this->setExpectedIncorrectUsage( 'register_rest_route' );
     
    10621160
    10631161        /**
    10641162         * @ticket 50075
     1163         *
     1164         * @covers ::register_rest_route
    10651165         */
    10661166        public function test_register_route_with_missing_permission_callback_multiple_wrapped_route() {
    10671167                $this->setExpectedIncorrectUsage( 'register_rest_route' );
     
    15141614                );
    15151615        }
    15161616
     1617        /**
     1618         *
     1619         * @covers ::rest_ensure_response
     1620         */
    15171621        function test_rest_ensure_response_accepts_wp_error_and_returns_wp_error() {
    15181622                $response = rest_ensure_response( new WP_Error() );
    15191623                $this->assertInstanceOf( 'WP_Error', $response );
     
    15241628         *
    15251629         * @param mixed $response      The response passed to rest_ensure_response().
    15261630         * @param mixed $expected_data The expected data a response should include.
     1631         *
     1632         * @covers ::rest_ensure_response
    15271633         */
    15281634        function test_rest_ensure_response_returns_instance_of_wp_rest_response( $response, $expected_data ) {
    15291635                $response_object = rest_ensure_response( $response );
     
    15501656
    15511657        /**
    15521658         * @ticket 49116
     1659         *
     1660         * @covers ::rest_get_route_for_post
    15531661         */
    15541662        public function test_rest_get_route_for_post_non_post() {
    15551663                $this->assertEquals( '', rest_get_route_for_post( 'garbage' ) );
     
    15571665
    15581666        /**
    15591667         * @ticket 49116
     1668         *
     1669         * @covers ::rest_get_route_for_post
    15601670         */
    15611671        public function test_rest_get_route_for_post_invalid_post_type() {
    15621672                register_post_type( 'invalid' );
     
    15681678
    15691679        /**
    15701680         * @ticket 49116
     1681         *
     1682         * @covers ::rest_get_route_for_post
    15711683         */
    15721684        public function test_rest_get_route_for_post_non_rest() {
    15731685                $post = self::factory()->post->create_and_get( array( 'post_type' => 'custom_css' ) );
     
    15761688
    15771689        /**
    15781690         * @ticket 49116
     1691         *
     1692         * @covers ::rest_get_route_for_post
    15791693         */
    15801694        public function test_rest_get_route_for_post_custom_controller() {
    15811695                $post = self::factory()->post->create_and_get( array( 'post_type' => 'wp_block' ) );
     
    15841698
    15851699        /**
    15861700         * @ticket 49116
     1701         *
     1702         * @covers ::rest_get_route_for_post
    15871703         */
    15881704        public function test_rest_get_route_for_post() {
    15891705                $post = self::factory()->post->create_and_get();
     
    15921708
    15931709        /**
    15941710         * @ticket 49116
     1711         *
     1712         * @covers ::rest_get_route_for_post
    15951713         */
    15961714        public function test_rest_get_route_for_media() {
    15971715                $post = self::factory()->attachment->create_and_get();
     
    16001718
    16011719        /**
    16021720         * @ticket 49116
     1721         *
     1722         * @covers ::rest_get_route_for_post
    16031723         */
    16041724        public function test_rest_get_route_for_post_id() {
    16051725                $post = self::factory()->post->create_and_get();
     
    16081728
    16091729        /**
    16101730         * @ticket 49116
     1731         *
     1732         * @covers ::rest_get_route_for_term
    16111733         */
    16121734        public function test_rest_get_route_for_term_non_term() {
    16131735                $this->assertEquals( '', rest_get_route_for_term( 'garbage' ) );
     
    16151737
    16161738        /**
    16171739         * @ticket 49116
     1740         *
     1741         * @covers ::rest_get_route_for_term
    16181742         */
    16191743        public function test_rest_get_route_for_term_invalid_term_type() {
    16201744                register_taxonomy( 'invalid', 'post' );
     
    16261750
    16271751        /**
    16281752         * @ticket 49116
     1753         *
     1754         * @covers ::rest_get_route_for_term
    16291755         */
    16301756        public function test_rest_get_route_for_term_non_rest() {
    16311757                $term = self::factory()->term->create_and_get( array( 'taxonomy' => 'post_format' ) );
     
    16341760
    16351761        /**
    16361762         * @ticket 49116
     1763         *
     1764         * @covers ::rest_get_route_for_term
    16371765         */
    16381766        public function test_rest_get_route_for_term() {
    16391767                $term = self::factory()->term->create_and_get();
     
    16421770
    16431771        /**
    16441772         * @ticket 49116
     1773         *
     1774         * @covers ::rest_get_route_for_term
    16451775         */
    16461776        public function test_rest_get_route_for_category() {
    16471777                $term = self::factory()->category->create_and_get();
     
    16501780
    16511781        /**
    16521782         * @ticket 49116
     1783         *
     1784         * @covers ::rest_get_route_for_term
    16531785         */
    16541786        public function test_rest_get_route_for_term_id() {
    16551787                $term = self::factory()->term->create_and_get();
     
    16631795         *
    16641796         * @param bool  $expected Expected result of the check.
    16651797         * @param mixed $value    The value to check.
     1798         *
     1799         * @covers ::rest_is_object
    16661800         */
    16671801        public function test_rest_is_object( $expected, $value ) {
    16681802                $is_object = rest_is_object( $value );
     
    17261860         *
    17271861         * @param array $expected Expected sanitized version.
    17281862         * @param mixed $value    The value to sanitize.
     1863         *
     1864         * @covers ::rest_sanitize_object
    17291865         */
    17301866        public function test_rest_sanitize_object( $expected, $value ) {
    17311867                $sanitized = rest_sanitize_object( $value );
     
    17841920         *
    17851921         * @param bool  $expected Expected result of the check.
    17861922         * @param mixed $value    The value to check.
     1923         *
     1924         * @covers ::rest_is_array
    17871925         */
    17881926        public function test_rest_is_array( $expected, $value ) {
    17891927                $is_array = rest_is_array( $value );
     
    18551993         *
    18561994         * @param array $expected Expected sanitized version.
    18571995         * @param mixed $value    The value to sanitize.
     1996         *
     1997         * @covers ::rest_sanitize_array
    18581998         */
    18591999        public function test_rest_sanitize_array( $expected, $value ) {
    18602000                $sanitized = rest_sanitize_array( $value );
     
    19262066         * @param string $expected The expected best type.
    19272067         * @param mixed  $value    The value to test.
    19282068         * @param array  $types    The list of available types.
     2069         *
     2070         * @covers ::rest_get_best_type_for_value
    19292071         */
    19302072        public function test_get_best_type_for_value( $expected, $value, $types ) {
    19312073                $this->assertEquals( $expected, rest_get_best_type_for_value( $value, $types ) );
  • tests/phpunit/tests/rewrite.php

     
    2727
    2828        /**
    2929         * @ticket 16840
     30         *
     31         * @covers ::add_rule
    3032         */
    3133        public function test_add_rule() {
    3234                global $wp_rewrite;
     
    4547
    4648        /**
    4749         * @ticket 16840
     50         *
     51         * @covers ::add_rule
    4852         */
    4953        public function test_add_rule_redirect_array() {
    5054                global $wp_rewrite;
     
    6973
    7074        /**
    7175         * @ticket 16840
     76         *
     77         * @covers ::add_rule
    7278         */
    7379        public function test_add_rule_top() {
    7480                global $wp_rewrite;
     
    8591                $this->assertContains( $redirect, $extra_rules_top[ $pattern ] );
    8692        }
    8793
     94        /**
     95         *
     96         * @covers ::url_to_postid
     97         */
    8898        function test_url_to_postid() {
    8999
    90100                $id = self::factory()->post->create();
     
    94104                $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
    95105        }
    96106
     107        /**
     108         *
     109         * @covers ::url_to_postid
     110         * @covers ::set_url_scheme
     111         */
    97112        function test_url_to_postid_set_url_scheme_https_to_http() {
    98113                $post_id   = self::factory()->post->create();
    99114                $permalink = get_permalink( $post_id );
     
    104119                $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) );
    105120        }
    106121
     122        /**
     123         *
     124         * @covers ::url_to_postid
     125         * @covers ::set_url_scheme
     126         */
    107127        function test_url_to_postid_set_url_scheme_http_to_https() {
    108128                $_SERVER['HTTPS'] = 'on';
    109129
     
    123143         * @ticket 35531
    124144         * @group multisite
    125145         * @group ms-required
     146         *
     147         * @covers ::url_to_postid
    126148         */
    127149        function test_url_to_postid_of_http_site_when_current_site_uses_https() {
    128150                $_SERVER['HTTPS'] = 'on';
     
    170192                return $url;
    171193        }
    172194
     195        /**
     196         *
     197         * @covers ::url_to_postid
     198         */
    173199        function test_url_to_postid_custom_post_type() {
    174200                delete_option( 'rewrite_rules' );
    175201
     
    182208                _unregister_post_type( $post_type );
    183209        }
    184210
     211        /**
     212         *
     213         * @covers ::url_to_postid
     214         */
    185215        function test_url_to_postid_hierarchical() {
    186216
    187217                $parent_id = self::factory()->post->create(
     
    202232                $this->assertEquals( $child_id, url_to_postid( get_permalink( $child_id ) ) );
    203233        }
    204234
     235        /**
     236         *
     237         * @covers ::url_to_postid
     238         */
    205239        function test_url_to_postid_hierarchical_with_matching_leaves() {
    206240
    207241                $parent_id       = self::factory()->post->create(
     
    245279                $this->assertEquals( $grandchild_id_2, url_to_postid( get_permalink( $grandchild_id_2 ) ) );
    246280        }
    247281
     282        /**
     283         *
     284         * @covers ::url_to_postid
     285         */
    248286        function test_url_to_postid_home_has_path() {
    249287
    250288                update_option( 'home', home_url( '/example/' ) );
     
    270308
    271309        /**
    272310         * @ticket 30438
     311         *
     312         * @covers ::home_url
    273313         */
    274314        function test_parse_request_home_path() {
    275315                $home_url = home_url( '/path/' );
     
    290330
    291331        /**
    292332         * @ticket 30438
     333         *
     334         * @covers ::home_url
    293335         */
    294336        function test_parse_request_home_path_with_regex_character() {
    295337                $home_url       = home_url( '/ma.ch/' );
     
    327369
    328370        /**
    329371         * @ticket 30018
     372         *
     373         * @covers ::home_url
    330374         */
    331375        function test_parse_request_home_path_non_public_type() {
    332376                register_post_type( 'foo', array( 'public' => false ) );
     
    340384                $this->assertEquals( array(), $GLOBALS['wp']->query_vars );
    341385        }
    342386
     387        /**
     388         *
     389         * @covers ::url_to_postid
     390         */
    343391        function test_url_to_postid_dupe_path() {
    344392                update_option( 'home', home_url( '/example/' ) );
    345393
     
    359407
    360408        /**
    361409         * Reveals bug introduced in WP 3.0
     410         *
     411         * @covers ::url_to_postid
    362412         */
    363413        function test_url_to_postid_home_url_collision() {
    364414                update_option( 'home', home_url( '/example' ) );
     
    380430         * Reveals bug introduced in WP 3.0
    381431         *
    382432         * @group ms-required
     433         *
     434         * @covers ::network_home_url
    383435         */
    384436        function test_url_to_postid_ms_home_url_collision() {
    385437                $blog_id = self::factory()->blog->create( array( 'path' => '/example' ) );
     
    401453
    402454        /**
    403455         * @ticket 21970
     456         *
     457         * @covers ::url_to_postid
    404458         */
    405459        function test_url_to_postid_with_post_slug_that_clashes_with_a_trashed_page() {
    406460                $this->set_permalink_structure( '/%postname%/' );
     
    418472
    419473        /**
    420474         * @ticket 34971
     475         *
     476         * @covers ::url_to_postid
    421477         */
    422478        function test_url_to_postid_static_front_page() {
    423479                $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
     
    438494
    439495        /**
    440496         * @ticket 39373
     497         *
     498         * @covers ::url_to_postid
    441499         */
    442500        public function test_url_to_postid_should_bail_when_host_does_not_match() {
    443501                $this->set_permalink_structure( '/%postname%/' );
     
    452510
    453511        /**
    454512         * @ticket 21970
     513         *
     514         * @covers ::get_permalink
    455515         */
    456516        function test_parse_request_with_post_slug_that_clashes_with_a_trashed_page() {
    457517                $this->set_permalink_structure( '/%postname%/' );
     
    472532
    473533        /**
    474534         * @ticket 29107
     535         *
     536         * @covers ::flush_rules
    475537         */
    476538        public function test_flush_rules_does_not_delete_option() {
    477539                $this->set_permalink_structure( '' );
  • tests/phpunit/tests/shortcode.php

     
    9595                return $out;
    9696        }
    9797
     98        /**
     99         *
     100         * @covers ::do_shortcode
     101         */
    98102        function test_noatts() {
    99103                do_shortcode( '[test-shortcode-tag /]' );
    100104                $this->assertEquals( '', $this->atts );
     
    101105                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    102106        }
    103107
     108        /**
     109         *
     110         * @covers ::do_shortcode
     111         */
    104112        function test_one_att() {
    105113                do_shortcode( '[test-shortcode-tag foo="asdf" /]' );
    106114                $this->assertEquals( array( 'foo' => 'asdf' ), $this->atts );
     
    107115                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    108116        }
    109117
     118        /**
     119         *
     120         * @covers ::do_shortcode
     121         */
    110122        function test_not_a_tag() {
    111123                $out = do_shortcode( '[not-a-shortcode-tag]' );
    112124                $this->assertEquals( '[not-a-shortcode-tag]', $out );
     
    114126
    115127        /**
    116128         * @ticket 17657
     129         *
     130         * @covers ::do_shortcode
    117131         */
    118132        function test_tag_hyphen_not_tag() {
    119133                $out = do_shortcode( '[dumptag-notreal]' );
     
    120134                $this->assertEquals( '[dumptag-notreal]', $out );
    121135        }
    122136
     137        /**
     138         *
     139         * @covers ::do_shortcode
     140         */
    123141        function test_tag_underscore_not_tag() {
    124142                $out = do_shortcode( '[dumptag_notreal]' );
    125143                $this->assertEquals( '[dumptag_notreal]', $out );
    126144        }
    127145
     146        /**
     147         *
     148         * @covers ::do_shortcode
     149         */
    128150        function test_tag_not_tag() {
    129151                $out = do_shortcode( '[dumptagnotreal]' );
    130152                $this->assertEquals( '[dumptagnotreal]', $out );
     
    132154
    133155        /**
    134156         * @ticket 17657
     157         *
     158         * @covers ::do_shortcode
    135159         */
    136160        function test_tag_hyphen() {
    137161                $this->assertEquals( '_shortcode_hyphen', do_shortcode( '[hyphen]' ) );
     
    143167
    144168        /**
    145169         * @ticket 9405
     170         *
     171         * @covers ::do_shortcode
    146172         */
    147173        function test_attr_hyphen() {
    148174                do_shortcode( '[test-shortcode-tag foo="foo" foo-bar="foo-bar" foo-bar-="foo-bar-" -foo-bar="-foo-bar" -foo-bar-="-foo-bar-" foo-bar-baz="foo-bar-baz" -foo-bar-baz="-foo-bar-baz" foo--bar="foo--bar" /]' );
     
    159185                $this->assertEquals( $expected_attrs, $this->atts );
    160186        }
    161187
     188        /**
     189         *
     190         * @covers ::do_shortcode
     191         */
    162192        function test_two_atts() {
    163193                do_shortcode( '[test-shortcode-tag foo="asdf" bar="bing" /]' );
    164194                $this->assertEquals(
     
    171201                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    172202        }
    173203
     204        /**
     205         *
     206         * @covers ::do_shortcode
     207         */
    174208        function test_noatts_enclosing() {
    175209                do_shortcode( '[test-shortcode-tag]content[/test-shortcode-tag]' );
    176210                $this->assertEquals( '', $this->atts );
     
    178212                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    179213        }
    180214
     215        /**
     216         *
     217         * @covers ::do_shortcode
     218         */
    181219        function test_one_att_enclosing() {
    182220                do_shortcode( '[test-shortcode-tag foo="bar"]content[/test-shortcode-tag]' );
    183221                $this->assertEquals( array( 'foo' => 'bar' ), $this->atts );
     
    185223                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    186224        }
    187225
     226        /**
     227         *
     228         * @covers ::do_shortcode
     229         */
    188230        function test_two_atts_enclosing() {
    189231                do_shortcode( '[test-shortcode-tag foo="bar" baz="bing"]content[/test-shortcode-tag]' );
    190232                $this->assertEquals(
     
    198240                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    199241        }
    200242
     243        /**
     244         *
     245         * @covers ::do_shortcode
     246         */
    201247        function test_unclosed() {
    202248                $out = do_shortcode( '[test-shortcode-tag]' );
    203249                $this->assertEquals( '', $out );
     
    205251                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    206252        }
    207253
     254        /**
     255         *
     256         * @covers ::do_shortcode
     257         */
    208258        function test_positional_atts_num() {
    209259                $out = do_shortcode( '[test-shortcode-tag 123]' );
    210260                $this->assertEquals( '', $out );
     
    212262                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    213263        }
    214264
     265        /**
     266         *
     267         * @covers ::do_shortcode
     268         */
    215269        function test_positional_atts_url() {
    216270                $out = do_shortcode( '[test-shortcode-tag http://www.youtube.com/watch?v=eBGIQ7ZuuiU]' );
    217271                $this->assertEquals( '', $out );
     
    219273                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    220274        }
    221275
     276        /**
     277         *
     278         * @covers ::do_shortcode
     279         */
    222280        function test_positional_atts_quotes() {
    223281                $out = do_shortcode( '[test-shortcode-tag "something in quotes" "something else"]' );
    224282                $this->assertEquals( '', $out );
     
    232290                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    233291        }
    234292
     293        /**
     294         *
     295         * @covers ::do_shortcode
     296         */
    235297        function test_positional_atts_mixed() {
    236298                $out = do_shortcode( '[test-shortcode-tag 123 https://wordpress.org/ 0 "foo" bar]' );
    237299                $this->assertEquals( '', $out );
     
    248310                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    249311        }
    250312
     313        /**
     314         *
     315         * @covers ::do_shortcode
     316         */
    251317        function test_positional_and_named_atts() {
    252318                $out = do_shortcode( '[test-shortcode-tag 123 url=https://wordpress.org/ foo bar="baz"]' );
    253319                $this->assertEquals( '', $out );
     
    263329                $this->assertEquals( 'test-shortcode-tag', $this->tagname );
    264330        }
    265331
     332        /**
     333         *
     334         * @covers ::do_shortcode
     335         */
    266336        function test_footag_default() {
    267337                $out = do_shortcode( '[footag]' );
    268338                $this->assertEquals( 'foo = ', $out );
    269339        }
    270340
     341        /**
     342         *
     343         * @covers ::do_shortcode
     344         */
    271345        function test_footag_val() {
    272346                $val = rand_str();
    273347                $out = do_shortcode( '[footag foo="' . $val . '"]' );
     
    274348                $this->assertEquals( 'foo = ' . $val, $out );
    275349        }
    276350
     351        /**
     352         *
     353         * @covers ::do_shortcode
     354         */
    277355        function test_nested_tags() {
    278356                $out      = do_shortcode( '[baztag][dumptag abc="foo" def=123 https://wordpress.org/][/baztag]' );
    279357                $expected = "content = abc = foo\ndef = 123\n0 = https://wordpress.org\n";
     
    282360
    283361        /**
    284362         * @ticket 6518
     363         *
     364         * @covers ::do_shortcode
    285365         */
    286366        function test_tag_escaped() {
    287367                $out = do_shortcode( '[[footag]] [[bartag foo="bar"]]' );
     
    298378                $this->assertEquals( '[[footag]] [[bartag foo="bar"]]', $out );
    299379        }
    300380
     381        /**
     382         *
     383         * @covers ::do_shortcode
     384         */
    301385        function test_tag_not_escaped() {
    302386                // These have square brackets on either end but aren't actually escaped.
    303387                $out = do_shortcode( '[[footag] [bartag foo="bar"]]' );
     
    316400                $this->assertEquals( '[[foo =  foo = bar]]', $out );
    317401        }
    318402
     403        /**
     404         *
     405         * @covers ::do_shortcode
     406         */
    319407        function test_mixed_tags() {
    320408                $in       = <<<EOF
    321409So this is a post with [footag foo="some stuff"] and a bunch of tags.
     
    355443
    356444        /**
    357445         * @ticket 6562
     446         *
     447         * @covers ::do_shortcode
    358448         */
    359449        function test_utf8_whitespace_1() {
    360450                // NO-BREAK SPACE: U+00A0.
     
    371461
    372462        /**
    373463         * @ticket 6562
     464         *
     465         * @covers ::do_shortcode
    374466         */
    375467        function test_utf8_whitespace_2() {
    376468                // ZERO WIDTH SPACE: U+200B.
     
    387479
    388480        /**
    389481         * @ticket 14050
     482         *
     483         * @covers ::shortcode_unautop
    390484         */
    391485        function test_shortcode_unautop() {
    392486                // A blank line is added at the end, so test with it already there.
     
    416510         *
    417511         * @param string $expected  Expected output.
    418512         * @param string $content   Content to run strip_shortcodes() on.
     513         *
     514         * @covers ::strip_shortcodes
    419515         */
    420516        function test_strip_shortcodes( $expected, $content ) {
    421517                $this->assertEquals( $expected, strip_shortcodes( $content ) );
     
    458554                return $out;
    459555        }
    460556
     557        /**
     558         *
     559         * @covers ::do_shortcode
     560         */
    461561        function test_shortcode_atts_filter_passes_original_arguments() {
    462562                add_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts' ), 10, 3 );
    463563
     
    481581                remove_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts' ), 10, 3 );
    482582        }
    483583
     584        /**
     585         *
     586         * @covers ::do_shortcode
     587         */
    484588        function test_shortcode_atts_filtering() {
    485589                add_filter( 'shortcode_atts_bartag', array( $this, '_filter_atts2' ), 10, 3 );
    486590
     
    498602         * Check that shortcode_unautop() will always recognize spaces around shortcodes.
    499603         *
    500604         * @ticket 22692
     605         *
     606         * @covers ::shortcode_unautop
    501607         */
    502608        function test_spaces_around_shortcodes() {
    503609                $nbsp = "\xC2\xA0";
     
    520626         * Check for bugginess using normal input with latest patches.
    521627         *
    522628         * @dataProvider data_escaping
     629         *
     630         * @covers ::do_shortcode
    523631         */
    524632        function test_escaping( $input, $output ) {
    525633                return $this->assertEquals( $output, do_shortcode( $input ) );
     
    598706         * Check for bugginess using normal input with latest patches.
    599707         *
    600708         * @dataProvider data_escaping2
     709         *
     710         * @covers ::strip_shortcodes
    601711         */
    602712        function test_escaping2( $input, $output ) {
    603713                return $this->assertEquals( $output, strip_shortcodes( $input ) );
     
    638748
    639749        /**
    640750         * @ticket 26343
     751         *
     752         * @covers ::has_shortcode
    641753         */
    642754        function test_has_shortcode() {
    643755                $content = 'This is a blob with [gallery] in it';
     
    654766         *
    655767         * @dataProvider data_registration_bad
    656768         * @expectedIncorrectUsage add_shortcode
     769         *
     770         * @covers ::shortcode_exists
    657771         */
    658772        function test_registration_bad( $input, $expected ) {
    659773                return $this->sub_registration( $input, $expected );
     
    663777         * Make sure valid shortcode names are allowed.
    664778         *
    665779         * @dataProvider data_registration_good
     780         *
     781         * @covers ::shortcode_exists
    666782         */
    667783        function test_registration_good( $input, $expected ) {
    668784                return $this->sub_registration( $input, $expected );
     
    732848         * Automated performance testing of the main regex.
    733849         *
    734850         * @dataProvider data_whole_posts
     851         *
     852         * @covers ::get_shortcode_regex
    735853         */
    736854        function test_pcre_performance( $input ) {
    737855                $regex  = '/' . get_shortcode_regex() . '/';
     
    744862                return data_whole_posts();
    745863        }
    746864
     865        /**
     866         *
     867         * @covers ::get_shortcode_regex
     868         */
    747869        function test_php_and_js_shortcode_attribute_regexes_match() {
    748870
    749871                $file    = file_get_contents( ABSPATH . WPINC . '/js/shortcode.js' );
     
    761883         * @ticket 34939
    762884         *
    763885         * Test the (not recommended) [shortcode=XXX] format
     886         *
     887         * @covers ::do_shortcode
    764888         */
    765889        function test_unnamed_attribute() {
    766890                $out      = do_shortcode( '[dumptag=https://wordpress.org/]' );
     
    770894
    771895        /**
    772896         * @ticket 36306
     897         *
     898         * @covers ::the_content
    773899         */
    774900        function test_smilies_arent_converted() {
    775901                $out      = apply_filters( 'the_content', '[img alt="Hello :-) World"]' );
     
    779905
    780906        /**
    781907         * @ticket 37906
     908         *
     909         * @covers ::do_shortcode
    782910         */
    783911        public function test_pre_do_shortcode_tag() {
    784912                // Does nothing if no filters are set up.
     
    849977
    850978        /**
    851979         * @ticket 32790
     980         *
     981         * @covers ::do_shortcode
    852982         */
    853983        public function test_do_shortcode_tag_filter() {
    854984                // Does nothing if no filters are set up.
     
    9211051         * @ticket 37304
    9221052         *
    9231053         * Test 'value' syntax for empty attributes
     1054         *
     1055         * @covers ::do_shortcode
    9241056         */
    9251057        function test_empty_single_quote_attribute() {
    9261058                $out = do_shortcode( '[test-shortcode-tag a="foo" b=\'bar\' c=baz foo \'bar\' "baz" ]test empty atts[/test-shortcode-tag]' );
     
    9391071
    9401072        /**
    9411073         * @ticket 37304
     1074         *
     1075         * @covers ::do_shortcode
    9421076         */
    9431077        function test_positional_atts_single_quotes() {
    9441078                $out = do_shortcode( "[test-shortcode-tag 'something in quotes' 'something else']" );
     
    9551089
    9561090        /**
    9571091         * @ticket 37304
     1092         *
     1093         * @covers ::do_shortcode
    9581094         */
    9591095        function test_positional_atts_mixed_quotes() {
    9601096                $out = do_shortcode( "[test-shortcode-tag 'something in quotes' \"something else\" 123 foo bar='baz' example=\"test\" ]" );
  • tests/phpunit/tests/site-health.php

     
    1313         * Ensure Site Health reports correctly cron job reports.
    1414         *
    1515         * @ticket 47223
     16         *
     17         * @covers WP_Site_Health::get_test_scheduled_events
    1618         */
    1719        function test_cron_health_checks_critical() {
    1820                $wp_site_health = new WP_Site_Health();
     
    3335         *
    3436         * @dataProvider data_cron_health_checks
    3537         * @ticket 47223
     38         *
     39         * @covers WP_Site_Health::get_test_scheduled_events
    3640         */
    3741        function test_cron_health_checks( $times, $expected_status, $expected_label, $expected_late, $expected_missed ) {
    3842                $wp_site_health = new WP_Site_Health();
  • tests/phpunit/tests/taxonomy.php

     
    44 * @group taxonomy
    55 */
    66class Tests_Taxonomy extends WP_UnitTestCase {
     7
     8        /**
     9         *
     10         * @covers ::get_object_taxonomies
     11         */
    712        function test_get_post_taxonomies() {
    813                $this->assertEquals( array( 'category', 'post_tag', 'post_format' ), get_object_taxonomies( 'post' ) );
    914        }
    1015
     16        /**
     17         *
     18         * @covers ::get_object_taxonomies
     19         */
    1120        function test_get_link_taxonomies() {
    1221                $this->assertEquals( array( 'link_category' ), get_object_taxonomies( 'link' ) );
    1322        }
     
    1423
    1524        /**
    1625         * @ticket 5417
     26         *
     27         * @covers ::get_object_taxonomies
    1728         */
    1829        function test_get_unknown_taxonomies() {
    1930                // Taxonomies for an unknown object type.
     
    2334                $this->assertEquals( array(), get_object_taxonomies( null ) );
    2435        }
    2536
     37        /**
     38         *
     39         * @covers ::get_object_taxonomies
     40         */
    2641        function test_get_post_taxonomy() {
    2742                foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) {
    2843                        $tax = get_taxonomy( $taxonomy );
     
    3348                }
    3449        }
    3550
     51        /**
     52         *
     53         * @covers ::get_the_taxonomies
     54         */
    3655        function test_get_the_taxonomies() {
    3756                $post_id = self::factory()->post->create();
    3857
     
    5170
    5271        /**
    5372         * @ticket 27238
     73         *
     74         * @covers ::get_the_taxonomies
    5475         */
    5576        public function test_get_the_taxonomies_term_template() {
    5677                $post_id = self::factory()->post->create();
     
    6384                $this->assertEquals( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $taxes['category'] );
    6485        }
    6586
     87        /**
     88         *
     89         * @covers ::the_taxonomies
     90         */
    6691        function test_the_taxonomies() {
    6792                $post_id = self::factory()->post->create();
    6893
     
    77102
    78103        /**
    79104         * @ticket 27238
     105         *
     106         * @covers ::get_category_link
    80107         */
    81108        function test_the_taxonomies_term_template() {
    82109                $post_id = self::factory()->post->create();
     
    105132                $this->assertEquals( 'Categories: <span class="foo"><a href="' . $link . '">Uncategorized</a></span>.', $output );
    106133        }
    107134
     135        /**
     136         *
     137         * @covers ::create_initial_taxonomies
     138         */
    108139        function test_get_link_taxonomy() {
    109140                foreach ( get_object_taxonomies( 'link' ) as $taxonomy ) {
    110141                        $tax = get_taxonomy( $taxonomy );
     
    115146                }
    116147        }
    117148
     149        /**
     150         *
     151         * @covers ::create_initial_taxonomies
     152         * @covers ::taxonomy_exists
     153         */
    118154        function test_taxonomy_exists_known() {
    119155                $this->assertTrue( taxonomy_exists( 'category' ) );
    120156                $this->assertTrue( taxonomy_exists( 'post_tag' ) );
     
    121157                $this->assertTrue( taxonomy_exists( 'link_category' ) );
    122158        }
    123159
     160        /**
     161         *
     162         * @covers ::create_initial_taxonomies
     163         * @covers ::taxonomy_exists
     164         */
    124165        function test_taxonomy_exists_unknown() {
    125166                $this->assertFalse( taxonomy_exists( rand_str() ) );
    126167                $this->assertFalse( taxonomy_exists( '' ) );
     
    128169                $this->assertFalse( taxonomy_exists( null ) );
    129170        }
    130171
     172        /**
     173         *
     174         * @covers ::create_initial_taxonomies
     175         * @covers ::is_taxonomy_hierarchical
     176         */
    131177        function test_is_taxonomy_hierarchical() {
    132178                $this->assertTrue( is_taxonomy_hierarchical( 'category' ) );
    133179                $this->assertFalse( is_taxonomy_hierarchical( 'post_tag' ) );
     
    134180                $this->assertFalse( is_taxonomy_hierarchical( 'link_category' ) );
    135181        }
    136182
     183        /**
     184         *
     185         * @covers ::create_initial_taxonomies
     186         * @covers ::is_taxonomy_hierarchical
     187         */
    137188        function test_is_taxonomy_hierarchical_unknown() {
    138189                $this->assertFalse( is_taxonomy_hierarchical( rand_str() ) );
    139190                $this->assertFalse( is_taxonomy_hierarchical( '' ) );
     
    141192                $this->assertFalse( is_taxonomy_hierarchical( null ) );
    142193        }
    143194
     195        /**
     196         *
     197         * @covers ::register_taxonomy
     198         */
    144199        function test_register_taxonomy() {
    145200
    146201                // Make up a new taxonomy name, and ensure it's unused.
     
    155210                unset( $GLOBALS['wp_taxonomies'][ $tax ] );
    156211        }
    157212
     213        /**
     214         *
     215         * @covers ::register_taxonomy
     216         */
    158217        function test_register_hierarchical_taxonomy() {
    159218
    160219                // Make up a new taxonomy name, and ensure it's unused.
     
    171230
    172231        /**
    173232         * @ticket 48558
     233         *
     234         * @covers ::register_taxonomy
    174235         */
    175236        function test_register_taxonomy_return_value() {
    176237                $this->assertInstanceOf( 'WP_Taxonomy', register_taxonomy( 'foo', 'post' ) );
     
    180241         * @ticket 21593
    181242         *
    182243         * @expectedIncorrectUsage register_taxonomy
     244         *
     245         * @covers ::register_taxonomy
    183246         */
    184247        function test_register_taxonomy_with_too_long_name() {
    185248                $this->assertInstanceOf( 'WP_Error', register_taxonomy( 'abcdefghijklmnopqrstuvwxyz0123456789', 'post', array() ) );
     
    189252         * @ticket 31135
    190253         *
    191254         * @expectedIncorrectUsage register_taxonomy
     255         *
     256         * @covers ::register_taxonomy
    192257         */
    193258        function test_register_taxonomy_with_empty_name() {
    194259                $this->assertInstanceOf( 'WP_Error', register_taxonomy( '', 'post', array() ) );
     
    196261
    197262        /**
    198263         * @ticket 26948
     264         *
     265         * @covers ::register_taxonomy
    199266         */
    200267        public function test_register_taxonomy_show_in_quick_edit_should_default_to_value_of_show_ui() {
    201268                register_taxonomy(
     
    223290
    224291        /**
    225292         * @ticket 11058
     293         *
     294         * @covers ::register_taxonomy
    226295         */
    227296        function test_registering_taxonomies_to_object_types() {
    228297                // Create a taxonomy to test with.
     
    272341
    273342        /**
    274343         * @ticket 32590
     344         *
     345         * @covers ::register_taxonomy
    275346         */
    276347        public function test_register_taxonomy_for_post_type_for_taxonomy_with_no_object_type_should_filter_out_empty_object_types() {
    277348                register_taxonomy( 'wptests_tax', '' );
     
    282353                $this->assertEqualSets( $expected, $tax->object_type );
    283354        }
    284355
     356        /**
     357         *
     358         * @covers ::get_objects_in_term
     359         */
    285360        public function test_get_objects_in_term_should_return_invalid_taxonomy_error() {
    286361                $terms = get_objects_in_term( 1, 'invalid_taxonomy' );
    287362                $this->assertInstanceOf( 'WP_Error', $terms );
     
    288363                $this->assertEquals( 'invalid_taxonomy', $terms->get_error_code() );
    289364        }
    290365
     366        /**
     367         *
     368         * @covers ::get_objects_in_term
     369         */
    291370        public function test_get_objects_in_term_should_return_empty_array() {
    292371                $this->assertEquals( array(), get_objects_in_term( 1, 'post_tag' ) );
    293372        }
    294373
     374        /**
     375         *
     376         * @covers ::get_objects_in_term
     377         */
    295378        public function test_get_objects_in_term_should_return_objects_ids() {
    296379                $tag_id              = self::factory()->tag->create();
    297380                $cat_id              = self::factory()->category->create();
     
    324407
    325408        /**
    326409         * @ticket 37094
     410         *
     411         * @covers ::wp_set_object_terms
    327412         */
    328413        public function test_term_assignment_should_invalidate_get_objects_in_term_cache() {
    329414                register_taxonomy( 'wptests_tax', 'post' );
     
    349434
    350435        /**
    351436         * @ticket 37094
     437         *
     438         * @covers ::wp_delete_term
    352439         */
    353440        public function test_term_deletion_should_invalidate_get_objects_in_term_cache() {
    354441                register_taxonomy( 'wptests_tax', 'post' );
     
    374461
    375462        /**
    376463         * @ticket 37094
     464         *
     465         * @covers ::wp_delete_term
    377466         */
    378467        public function test_post_deletion_should_invalidate_get_objects_in_term_cache() {
    379468                register_taxonomy( 'wptests_tax', 'post' );
     
    399488
    400489        /**
    401490         * @ticket 25706
     491         *
     492         * @covers ::in_category
    402493         */
    403494        function test_in_category() {
    404495                $post = self::factory()->post->create_and_get();
     
    414505                $this->assertTrue( in_category( $term['term_id'], $post ) );
    415506        }
    416507
     508        /**
     509         *
     510         * @covers ::wp_insert_category
     511         */
    417512        function test_insert_category_create() {
    418513                $cat = array(
    419514                        'cat_ID'   => 0,
     
    423518                $this->assertTrue( is_numeric( wp_insert_category( $cat, true ) ) );
    424519        }
    425520
     521        /**
     522         *
     523         * @covers ::wp_insert_category
     524         */
    426525        function test_insert_category_update() {
    427526                $cat = array(
    428527                        'cat_ID'   => 1,
     
    432531                $this->assertEquals( 1, wp_insert_category( $cat ) );
    433532        }
    434533
     534        /**
     535         *
     536         * @covers ::wp_insert_category
     537         */
    435538        function test_insert_category_force_error_handle() {
    436539                $cat = array(
    437540                        'cat_ID'   => 0,
     
    441544                $this->assertTrue( is_a( wp_insert_category( $cat, true ), 'WP_Error' ) );
    442545        }
    443546
     547        /**
     548         *
     549         * @covers ::wp_insert_category
     550         */
    444551        function test_insert_category_force_error_no_handle() {
    445552                $cat = array(
    446553                        'cat_ID'   => 0,
     
    450557                $this->assertEquals( 0, wp_insert_category( $cat, false ) );
    451558        }
    452559
     560        /**
     561         *
     562         * @covers ::get_ancestors
     563         */
    453564        public function test_get_ancestors_taxonomy_non_hierarchical() {
    454565                register_taxonomy( 'wptests_tax', 'post' );
    455566                $t = self::factory()->term->create(
     
    462573                _unregister_taxonomy( 'wptests_tax' );
    463574        }
    464575
     576        /**
     577         *
     578         * @covers ::get_ancestors
     579         */
    465580        public function test_get_ancestors_taxonomy() {
    466581                register_taxonomy(
    467582                        'wptests_tax',
     
    509624                $this->assertEqualSets( array(), get_ancestors( $p, 'wptests_tax' ) );
    510625        }
    511626
     627        /**
     628         *
     629         * @covers ::get_ancestors
     630         */
    512631        public function test_get_ancestors_post_type() {
    513632                register_post_type(
    514633                        'wptests_pt',
     
    546665
    547666        /**
    548667         * @ticket 15029
     668         *
     669         * @covers ::get_ancestors
    549670         */
    550671        public function test_get_ancestors_taxonomy_post_type_conflict_resource_type_taxonomy() {
    551672                register_post_type(
     
    593714
    594715        /**
    595716         * @ticket 21949
     717         *
     718         * @covers ::is_tax
    596719         */
    597720        public function test_nonpublicly_queryable_taxonomy_should_not_be_queryable_using_taxname_query_var() {
    598721                register_taxonomy(
     
    619742
    620743        /**
    621744         * @ticket 21949
     745         *
     746         * @covers ::register_taxonomy
    622747         */
    623748        public function test_it_should_be_possible_to_register_a_query_var_that_matches_the_name_of_a_nonpublicly_queryable_taxonomy() {
    624749                global $wp;
     
    660785
    661786        /**
    662787         * @ticket 21949
     788         *
     789         * @covers ::register_taxonomy
    663790         */
    664791        public function test_nonpublicly_queryable_taxonomy_should_not_be_queryable_using_taxonomy_and_term_vars() {
    665792                register_taxonomy(
     
    686813
    687814        /**
    688815         * @ticket 34491
     816         *
     817         * @covers ::register_taxonomy
    689818         */
    690819        public function test_public_taxonomy_should_be_publicly_queryable() {
    691820                register_taxonomy(
     
    714843
    715844        /**
    716845         * @ticket 34491
     846         *
     847         * @covers ::register_taxonomy
    717848         */
    718849        public function test_private_taxonomy_should_not_be_publicly_queryable() {
    719850                register_taxonomy(
     
    742873
    743874        /**
    744875         * @ticket 34491
     876         *
     877         * @covers ::register_taxonomy
    745878         */
    746879        public function test_private_taxonomy_should_be_overridden_by_publicly_queryable() {
    747880                register_taxonomy(
     
    771904
    772905        /**
    773906         * @ticket 35089
     907         *
     908         * @covers ::register_taxonomy
    774909         */
    775910        public function test_query_var_should_be_forced_to_false_for_non_public_taxonomy() {
    776911                register_taxonomy(
     
    788923
    789924        /**
    790925         * @ticket 35227
     926         *
     927         * @covers ::unregister_taxonomy
    791928         */
    792929        public function test_unregister_taxonomy_unknown_taxonomy() {
    793930                $this->assertWPError( unregister_taxonomy( 'foo' ) );
     
    795932
    796933        /**
    797934         * @ticket 35227
     935         *
     936         * @covers ::unregister_taxonomy
    798937         */
    799938        public function test_unregister_taxonomy_twice() {
    800939                register_taxonomy( 'foo', 'post' );
     
    804943
    805944        /**
    806945         * @ticket 35227
     946         *
     947         * @covers ::unregister_taxonomy
    807948         */
    808949        public function test_unregister_taxonomy_disallow_builtin_taxonomy() {
    809950                $this->assertWPError( unregister_taxonomy( 'post_tag' ) );
     
    812953
    813954        /**
    814955         * @ticket 35227
     956         *
     957         * @covers ::unregister_taxonomy
    815958         */
    816959        public function test_unregister_taxonomy_removes_query_vars() {
    817960                global $wp;
     
    825968
    826969        /**
    827970         * @ticket 35227
     971         *
     972         * @covers ::unregister_taxonomy
    828973         */
    829974        public function test_unregister_taxonomy_removes_permastruct() {
    830975                $this->set_permalink_structure( '/%postname%' );
     
    847992
    848993        /**
    849994         * @ticket 35227
     995         *
     996         * @covers ::unregister_taxonomy
    850997         */
    851998        public function test_unregister_taxonomy_removes_rewrite_rules() {
    852999                $this->set_permalink_structure( '/%postname%' );
     
    8671014
    8681015        /**
    8691016         * @ticket 35227
     1017         *
     1018         * @covers ::unregister_taxonomy
    8701019         */
    8711020        public function test_unregister_taxonomy_removes_taxonomy_from_global() {
    8721021                global $wp_taxonomies;
     
    8841033
    8851034        /**
    8861035         * @ticket 35227
     1036         *
     1037         * @covers ::unregister_taxonomy
    8871038         */
    8881039        public function test_unregister_taxonomy_removes_meta_box_callback() {
    8891040                global $wp_filter;
     
    8981049
    8991050        /**
    9001051         * @ticket 35227
     1052         *
     1053         * @covers ::unregister_taxonomy
    9011054         */
    9021055        public function test_taxonomy_does_not_exist_after_unregister_taxonomy() {
    9031056                register_taxonomy( 'foo', 'post' );
     
    9081061
    9091062        /**
    9101063         * @ticket 39308
     1064         *
     1065         * @covers ::unregister_taxonomy
    9111066         */
    9121067        public function test_taxonomy_name_property_should_not_get_overridden_by_passed_args() {
    9131068                register_taxonomy( 'foo', 'post', array( 'name' => 'bar' ) );
     
    9201075
    9211076        /**
    9221077         * @ticket 36514
     1078         *
     1079         * @covers ::edit_post
    9231080         */
    9241081        public function test_edit_post_hierarchical_taxonomy() {
    9251082
     
    9701127         * Test default term for custom taxonomy.
    9711128         *
    9721129         * @ticket 43517
     1130         *
     1131         * @covers ::register_taxonomy
    9731132         */
    9741133        function test_default_term_for_custom_taxonomy() {
    9751134
  • tests/phpunit/tests/template.php

     
    8989                parent::tearDown();
    9090        }
    9191
    92 
     92        /**
     93         *
     94         * @covers ::get_404_template
     95         */
    9396        public function test_404_template_hierarchy() {
    9497                $url = add_query_arg(
    9598                        array(
     
    106109                );
    107110        }
    108111
     112        /**
     113         *
     114         * @covers ::get_author_template
     115         */
    109116        public function test_author_template_hierarchy() {
    110117                $author = self::factory()->user->create_and_get(
    111118                        array(
     
    124131                );
    125132        }
    126133
     134        /**
     135         *
     136         * @covers ::get_category_template
     137         */
    127138        public function test_category_template_hierarchy() {
    128139                $term = self::factory()->term->create_and_get(
    129140                        array(
     
    144155                );
    145156        }
    146157
     158        /**
     159         *
     160         * @covers ::get_tag_template
     161         */
    147162        public function test_tag_template_hierarchy() {
    148163                $term = self::factory()->term->create_and_get(
    149164                        array(
     
    164179                );
    165180        }
    166181
     182        /**
     183         *
     184         * @covers ::get_taxonomy_template
     185         */
    167186        public function test_taxonomy_template_hierarchy() {
    168187                $term = self::factory()->term->create_and_get(
    169188                        array(
     
    184203                );
    185204        }
    186205
     206        /**
     207         *
     208         * @covers ::get_date_template
     209         */
    187210        public function test_date_template_hierarchy_for_year() {
    188211                $this->assertTemplateHierarchy(
    189212                        get_year_link( 1984 ),
     
    194217                );
    195218        }
    196219
     220        /**
     221         *
     222         * @covers ::get_date_template
     223         */
    197224        public function test_date_template_hierarchy_for_month() {
    198225                $this->assertTemplateHierarchy(
    199226                        get_month_link( 1984, 2 ),
     
    204231                );
    205232        }
    206233
     234        /**
     235         *
     236         * @covers ::get_date_template
     237         */
    207238        public function test_date_template_hierarchy_for_day() {
    208239                $this->assertTemplateHierarchy(
    209240                        get_day_link( 1984, 2, 25 ),
     
    214245                );
    215246        }
    216247
     248        /**
     249         *
     250         * @covers ::get_search_template
     251         */
    217252        public function test_search_template_hierarchy() {
    218253                $url = add_query_arg(
    219254                        array(
     
    230265                );
    231266        }
    232267
     268        /**
     269         *
     270         * @covers ::get_front_page_template
     271         */
    233272        public function test_front_page_template_hierarchy_with_posts_on_front() {
    234273                $this->assertEquals( 'posts', get_option( 'show_on_front' ) );
    235274                $this->assertTemplateHierarchy(
     
    242281                );
    243282        }
    244283
     284        /**
     285         *
     286         * @covers ::get_front_page_template
     287         */
    245288        public function test_front_page_template_hierarchy_with_page_on_front() {
    246289                update_option( 'show_on_front', 'page' );
    247290                update_option( 'page_on_front', self::$page_on_front->ID );
     
    260303                );
    261304        }
    262305
     306        /**
     307         *
     308         * @covers ::get_home_template
     309         */
    263310        public function test_home_template_hierarchy_with_page_on_front() {
    264311                update_option( 'show_on_front', 'page' );
    265312                update_option( 'page_on_front', self::$page_on_front->ID );
     
    274321                );
    275322        }
    276323
     324        /**
     325         *
     326         * @covers ::get_page_template
     327         */
    277328        public function test_page_template_hierarchy() {
    278329                $this->assertTemplateHierarchy(
    279330                        get_permalink( self::$page ),
     
    291342        /**
    292343         * @ticket 44005
    293344         * @group privacy
     345         *
     346         * @covers ::get_privacy_policy_template
    294347         */
    295348        public function test_privacy_template_hierarchy() {
    296349                update_option( 'wp_page_for_privacy_policy', self::$page_for_privacy_policy->ID );
     
    309362
    310363        /**
    311364         * @ticket 18375
     365         *
     366         * @covers ::get_single_template
    312367         */
    313368        public function test_single_template_hierarchy_for_post() {
    314369                $this->assertTemplateHierarchy(
     
    324379                );
    325380        }
    326381
     382        /**
     383         *
     384         * @covers ::get_single_template
     385         */
    327386        public function test_single_template_hierarchy_for_custom_post_type() {
    328387                $cpt = self::factory()->post->create_and_get(
    329388                        array(
     
    346405
    347406        /**
    348407         * @ticket 18375
     408         *
     409         * @covers ::get_single_template
    349410         */
    350411        public function test_single_template_hierarchy_for_custom_post_type_with_template() {
    351412                $cpt = self::factory()->post->create_and_get(
     
    369430                );
    370431        }
    371432
     433        /**
     434         *
     435         * @covers ::get_attachment_template
     436         */
    372437        public function test_attachment_template_hierarchy() {
    373438                $attachment = self::factory()->attachment->create_and_get(
    374439                        array(
     
    395460
    396461        /**
    397462         * @ticket 18375
     463         *
     464         * @covers ::get_attachment_template
    398465         */
    399466        public function test_attachment_template_hierarchy_with_template() {
    400467                $attachment = self::factory()->attachment->create_and_get(
     
    423490                );
    424491        }
    425492
     493        /**
     494         *
     495         * @covers ::get_embed_template
     496         */
    426497        public function test_embed_template_hierarchy_for_post() {
    427498                $this->assertTemplateHierarchy(
    428499                        get_post_embed_url( self::$post ),
     
    440511                );
    441512        }
    442513
     514        /**
     515         *
     516         * @covers ::get_embed_template
     517         */
    443518        public function test_embed_template_hierarchy_for_page() {
    444519                $this->assertTemplateHierarchy(
    445520                        get_post_embed_url( self::$page ),
  • tests/phpunit/tests/term.php

     
    1313
    1414        /**
    1515         * @ticket 29911
     16         *
     17         * @covers ::wp_delete_term
    1618         */
    1719        public function test_wp_delete_term_should_invalidate_cache_for_child_terms() {
    1820                register_taxonomy(
     
    4850
    4951        /**
    5052         * @ticket 5381
     53         *
     54         * @covers ::wp_insert_term
    5155         */
    5256        function test_is_term_type() {
    5357                // Insert a term.
     
    6367
    6468        /**
    6569         * @ticket 15919
     70         *
     71         * @covers ::wp_count_terms
    6672         */
    6773        function test_wp_count_terms() {
    6874                $count = wp_count_terms( 'category', array( 'hide_empty' => true ) );
     
    7278
    7379        /**
    7480         * @ticket 15475
     81         *
     82         * @covers ::wp_add_object_terms
     83         * @covers ::wp_remove_object_terms
    7584         */
    7685        function test_wp_add_remove_object_terms() {
    7786                $posts = self::$post_ids;
     
    103112
    104113        /**
    105114         * @group category.php
     115         *
     116         * @covers ::wp_insert_term
    106117         */
    107118        function test_term_is_ancestor_of() {
    108119                $term  = rand_str();
     
    123134                wp_delete_term( $t2['term_id'], 'category' );
    124135        }
    125136
     137        /**
     138         *
     139         * @covers ::wp_insert_category
     140         * @covers ::wp_delete_category
     141         */
    126142        function test_wp_insert_delete_category() {
    127143                $term = rand_str();
    128144                $this->assertNull( category_exists( $term ) );
     
    148164
    149165        /**
    150166         * @ticket 16550
     167         *
     168         * @covers ::wp_set_post_categories
    151169         */
    152170        function test_wp_set_post_categories() {
    153171                $post_id = self::$post_ids[0];
     
    187205
    188206        /**
    189207         * @ticket 43516
     208         *
     209         * @covers ::wp_set_post_categories
    190210         */
    191211        function test_wp_set_post_categories_sets_default_category_for_custom_post_types() {
    192212                add_filter( 'default_category_post_types', array( $this, 'filter_default_category_post_types' ) );
     
    216236
    217237        /**
    218238         * @ticket 25852
     239         *
     240         * @covers ::sanitize_term_field
    219241         */
    220242        function test_sanitize_term_field() {
    221243                $term = wp_insert_term( 'foo', $this->taxonomy );
     
    228250
    229251        /**
    230252         * @ticket 19205
     253         *
     254         * @covers ::wp_insert_term
    231255         */
    232256        function test_orphan_category() {
    233257                $cat_id1 = self::factory()->category->create();
  • tests/phpunit/tests/theme.php

     
    4646                parent::tearDown();
    4747        }
    4848
     49        /**
     50         *
     51         * @covers ::wp_get_themes
     52         */
    4953        function test_wp_get_themes_default() {
    5054                $themes = wp_get_themes();
    5155                $this->assertInstanceOf( 'WP_Theme', $themes[ $this->theme_slug ] );
     
    5963        /**
    6064         * @expectedDeprecated get_theme
    6165         * @expectedDeprecated get_themes
     66         *
     67         * @covers ::get_themes
    6268         */
    6369        function test_get_themes_default() {
    6470                $themes = get_themes();
     
    7379        /**
    7480         * @expectedDeprecated get_theme
    7581         * @expectedDeprecated get_themes
     82         *
     83         * @covers ::get_themes
    7684         */
    7785        function test_get_theme() {
    7886                $themes = get_themes();
     
    8593                }
    8694        }
    8795
     96        /**
     97         *
     98         * @covers ::wp_get_themes
     99         */
    88100        function test_wp_get_theme() {
    89101                $themes = wp_get_themes();
    90102                foreach ( $themes as $theme ) {
     
    99111
    100112        /**
    101113         * @expectedDeprecated get_themes
     114         *
     115         * @covers ::get_themes
    102116         */
    103117        function test_get_themes_contents() {
    104118                $themes = get_themes();
     
    169183                }
    170184        }
    171185
     186        /**
     187         *
     188         * @covers ::wp_get_themes
     189         */
    172190        function test_wp_get_theme_contents() {
    173191                $theme = wp_get_theme( $this->theme_slug );
    174192
     
    193211         * Make sure we update the default theme list to include the latest default theme.
    194212         *
    195213         * @ticket 29925
     214         *
     215         * @covers WP_Theme::get_core_default_theme
    196216         */
    197217        function test_default_theme_in_default_theme_list() {
    198218                $latest_default_theme = WP_Theme::get_core_default_theme();
     
    202222                $this->assertContains( $latest_default_theme->get_stylesheet(), $this->default_themes );
    203223        }
    204224
     225        /**
     226         *
     227         * @covers WP_Theme::wp_get_theme
     228         */
    205229        function test_default_themes_have_textdomain() {
    206230                foreach ( $this->default_themes as $theme ) {
    207231                        if ( wp_get_theme( $theme )->exists() ) {
     
    212236
    213237        /**
    214238         * @ticket 48566
     239         *
     240         * @covers WP_Theme::wp_get_theme
    215241         */
    216242        function test_year_in_readme() {
    217243                // This test is designed to only run on trunk/master.
     
    240266        /**
    241267         * @ticket 20897
    242268         * @expectedDeprecated get_theme_data
     269         *
     270         * @covers ::wp_get_theme
     271         * @covers ::get_theme_data
    243272         */
    244273        function test_extra_theme_headers() {
    245274                $wp_theme = wp_get_theme( $this->theme_slug );
     
    260289        /**
    261290         * @expectedDeprecated get_themes
    262291         * @expectedDeprecated get_current_theme
     292         *
     293         * @covers ::get_themes
     294         * @covers ::get_current_theme
    263295         */
    264296        function test_switch_theme() {
    265297                $themes = get_themes();
     
    332364                }
    333365        }
    334366
     367        /**
     368         *
     369         * @covers WP_Theme::errors
     370         * @covers WP_Theme::exists
     371         * @covers ::get_template
     372         * @covers ::get_stylesheet
     373         */
    335374        function test_switch_theme_bogus() {
    336375                // Try switching to a theme that doesn't exist.
    337376                $template = rand_str();
     
    352391        /**
    353392         * Test _wp_keep_alive_customize_changeset_dependent_auto_drafts.
    354393         *
    355          * @covers ::_wp_keep_alive_customize_changeset_dependent_auto_drafts()
     394         * @covers ::_wp_keep_alive_customize_changeset_dependent_auto_drafts
    356395         */
    357396        function test_wp_keep_alive_customize_changeset_dependent_auto_drafts() {
    358397                $nav_created_post_ids = $this->factory()->post->create_many(
     
    418457
    419458        /**
    420459         * @ticket 49406
     460         *
     461         * @covers ::register_theme_feature
    421462         */
    422463        public function test_register_theme_support_defaults() {
    423464                $registered = register_theme_feature( 'test-feature' );
     
    434475
    435476        /**
    436477         * @ticket 49406
     478         *
     479         * @covers ::register_theme_feature
    437480         */
    438481        public function test_register_theme_support_explicit() {
    439482                $args = array(
     
    460503
    461504        /**
    462505         * @ticket 49406
     506         *
     507         * @covers ::register_theme_feature
    463508         */
    464509        public function test_register_theme_support_upgrades_show_in_rest() {
    465510                register_theme_feature( 'test-feature', array( 'show_in_rest' => true ) );
     
    480525
    481526        /**
    482527         * @ticket 49406
     528         *
     529         * @covers ::register_theme_feature
    483530         */
    484531        public function test_register_theme_support_fills_schema() {
    485532                register_theme_feature(
     
    514561
    515562        /**
    516563         * @ticket 49406
     564         *
     565         * @covers ::register_theme_feature
    517566         */
    518567        public function test_register_theme_support_does_not_add_boolean_type_if_non_bool_default() {
    519568                register_theme_feature(
     
    537586
    538587        /**
    539588         * @ticket 49406
     589         *
     590         * @covers ::register_theme_feature
    540591         */
    541592        public function test_register_theme_support_defaults_additional_properties_to_false() {
    542593                register_theme_feature(
     
    564615
    565616        /**
    566617         * @ticket 49406
     618         *
     619         * @covers ::register_theme_feature
    567620         */
    568621        public function test_register_theme_support_with_additional_properties() {
    569622                register_theme_feature(
     
    592645
    593646        /**
    594647         * @ticket 49406
     648         *
     649         * @covers ::register_theme_feature
    595650         */
    596651        public function test_register_theme_support_defaults_additional_properties_to_false_in_array() {
    597652                register_theme_feature(
     
    627682         *
    628683         * @param string $error_code The error code expected.
    629684         * @param array  $args       The args to register.
     685         *
     686         * @covers ::register_theme_feature
    630687         */
    631688        public function test_register_theme_support_validation( $error_code, $args ) {
    632689                $registered = register_theme_feature( 'test-feature', $args );
  • tests/phpunit/tests/upload.php

     
    1919                update_option( 'uploads_use_yearmonth_folders', 1 );
    2020        }
    2121
     22        /**
     23         *
     24         * @covers ::wp_upload_dir
     25         */
    2226        function test_upload_dir_default() {
    2327                // wp_upload_dir() with default parameters.
    2428                $info   = wp_upload_dir();
     
    3034                $this->assertEquals( false, $info['error'] );
    3135        }
    3236
     37        /**
     38         *
     39         * @covers ::wp_upload_dir
     40         */
    3341        function test_upload_dir_relative() {
    3442                // wp_upload_dir() with a relative upload path that is not 'wp-content/uploads'.
    3543                update_option( 'upload_path', 'foo/bar' );
     
    4452
    4553        /**
    4654         * @ticket 5953
     55         *
     56         * @covers ::wp_upload_dir
    4757         */
    4858        function test_upload_dir_absolute() {
    4959                $path = get_temp_dir() . 'wp-unit-test';
     
    6575                $this->assertEquals( false, $info['error'] );
    6676        }
    6777
     78        /**
     79         *
     80         * @covers ::wp_upload_dir
     81         */
    6882        function test_upload_dir_no_yearnum() {
    6983                update_option( 'uploads_use_yearmonth_folders', 0 );
    7084
     
    7791                $this->assertEquals( false, $info['error'] );
    7892        }
    7993
     94        /**
     95         *
     96         * @covers ::wp_upload_dir
     97         */
    8098        function test_upload_path_absolute() {
    8199                update_option( 'upload_url_path', 'http://' . WP_TESTS_DOMAIN . '/asdf' );
    82100
     
    91109                $this->assertEquals( false, $info['error'] );
    92110        }
    93111
     112        /**
     113         *
     114         * @covers ::wp_upload_dir
     115         */
    94116        function test_upload_dir_empty() {
    95117                // Upload path setting is empty - it should default to 'wp-content/uploads'.
    96118                update_option( 'upload_path', '' );
  • tests/phpunit/tests/url.php

     
    4747                );
    4848        }
    4949
     50        /**
     51         *
     52         * @covers ::is_ssl
     53         */
    5054        function test_is_ssl_by_port() {
    5155                unset( $_SERVER['HTTPS'] );
    5256                $_SERVER['SERVER_PORT'] = '443';
     
    5559                $this->assertTrue( $is_ssl );
    5660        }
    5761
     62        /**
     63         *
     64         * @covers ::is_ssl
     65         */
    5866        function test_is_ssl_with_no_value() {
    5967                unset( $_SERVER['HTTPS'] );
    6068
     
    6775         *
    6876         * @param string $url      Test URL.
    6977         * @param string $expected Expected result.
     78         *
     79         * @covers ::admin_url
    7080         */
    7181        function test_admin_url( $url, $expected ) {
    7282                $siteurl_http   = get_option( 'siteurl' );
     
    135145         *
    136146         * @param string $url      Test URL.
    137147         * @param string $expected Expected result.
     148         *
     149         * @covers ::home_url
    138150         */
    139151        function test_home_url( $url, $expected ) {
    140152                $homeurl_http  = get_option( 'home' );
     
    198210                );
    199211        }
    200212
     213        /**
     214         *
     215         * @covers ::home_url
     216         */
    201217        function test_home_url_from_admin() {
    202218                $screen = get_current_screen();
    203219
     
    246262                $GLOBALS['current_screen'] = $screen;
    247263        }
    248264
     265        /**
     266         *
     267         * @covers ::network_home_url
     268         */
    249269        function test_network_home_url_from_admin() {
    250270                $screen = get_current_screen();
    251271
     
    271291                $GLOBALS['current_screen'] = $screen;
    272292        }
    273293
     294        /**
     295         *
     296         * @covers ::set_url_scheme
     297         */
    274298        function test_set_url_scheme() {
    275299                if ( ! function_exists( 'set_url_scheme' ) ) {
    276300                        return;
     
    335359                force_ssl_admin( $forced_admin );
    336360        }
    337361
     362        /**
     363         *
     364         * @covers ::get_adjacent_post
     365         */
    338366        public function test_get_adjacent_post() {
    339367                $now      = time();
    340368                $post_id  = self::factory()->post->create( array( 'post_date' => gmdate( 'Y-m-d H:i:s', $now - 1 ) ) );
     
    369397         * Test get_adjacent_post returns the next private post when the author is the currently logged in user.
    370398         *
    371399         * @ticket 30287
     400         *
     401         * @covers ::get_adjacent_post
    372402         */
    373403        public function test_get_adjacent_post_should_return_private_posts_belonging_to_the_current_user() {
    374404                $u       = self::factory()->user->create( array( 'role' => 'author' ) );
     
    406436
    407437        /**
    408438         * @ticket 30287
     439         *
     440         * @covers ::get_adjacent_post
    409441         */
    410442        public function test_get_adjacent_post_should_return_private_posts_belonging_to_other_users_if_the_current_user_can_read_private_posts() {
    411443                $u1      = self::factory()->user->create( array( 'role' => 'author' ) );
     
    444476
    445477        /**
    446478         * @ticket 30287
     479         *
     480         * @covers ::get_adjacent_post
    447481         */
    448482        public function test_get_adjacent_post_should_not_return_private_posts_belonging_to_other_users_if_the_current_user_cannot_read_private_posts() {
    449483                $u1      = self::factory()->user->create( array( 'role' => 'author' ) );
     
    490524         * Test that *_url functions handle paths with ".."
    491525         *
    492526         * @ticket 19032
     527         *
     528         * @covers ::site_url
     529         * @covers ::home_url
     530         * @covers ::admin_url
     531         * @covers ::network_admin_url
     532         * @covers ::user_admin_url
     533         * @covers ::includes_url
     534         * @covers ::network_site_url
     535         * @covers ::network_home_url
     536         * @covers ::content_url
     537         * @covers ::plugins_url
    493538         */
    494539        public function test_url_functions_for_dots_in_paths() {
    495540                $functions = array(
  • tests/phpunit/tests/user.php

     
    6666                $this->author = clone self::$_author;
    6767        }
    6868
     69        /**
     70         *
     71         * @covers ::get_users
     72         */
    6973        function test_get_users_of_blog() {
    7074                // Add one of each user role.
    7175                $nusers = array(
     
    9195                $this->assertEqualSets( $nusers, $found );
    9296        }
    9397
    94         // Simple get/set tests for user_option functions.
     98        /**
     99         *Simple get/set tests for user_option functions.
     100         *
     101         * @covers ::get_user_option
     102         */
    95103        function test_user_option() {
    96104                $key = rand_str();
    97105                $val = rand_str();
     
    111119
    112120        /**
    113121         * Simple tests for usermeta functions.
     122         *
     123         * @covers ::get_user_meta
    114124         */
    115125        function test_usermeta() {
    116126                $key = 'key';
     
    145155
    146156        /**
    147157         * Test usermeta functions in array mode.
     158         *
     159         * @covers ::get_user_meta
    148160         */
    149161        function test_usermeta_array() {
    150162                // Some values to set.
     
    185197
    186198        /**
    187199         * Test property magic functions for property get/set/isset.
     200         *
     201         * @covers WP_User::data
     202         * @covers WP_User::$key
    188203         */
    189204        function test_user_properties() {
    190205                $user = new WP_User( self::$author_id );
     
    209224         * Test the magic __unset() method.
    210225         *
    211226         * @ticket 20043
     227         *
     228         * @covers WP_User::__unset
    212229         */
    213230        public function test_user_unset() {
    214231                // phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
     
    229246         * @depends test_user_unset
    230247         * @expectedDeprecated WP_User->id
    231248         * @ticket 20043
     249         *
     250         * @covers WP_User::id
    232251         */
    233252        function test_user_unset_lowercase_id( $user ) {
    234253                $id = $user->id;
     
    242261         *
    243262         * @depends test_user_unset_lowercase_id
    244263         * @ticket 20043
     264         *
     265         * @covers WP_User::ID
    245266         */
    246267        function test_user_unset_uppercase_id( $user ) {
    247268                $this->assertNotEmpty( $user->ID );
     
    251272
    252273        /**
    253274         * Test meta property magic functions for property get/set/isset.
     275         *
     276         * @covers WP_User::get
     277         * @covers WP_User::set
     278         * @covers WP_User::isset
    254279         */
    255280        function test_user_meta_properties() {
    256281                $user = new WP_User( self::$author_id );
     
    264289
    265290        /**
    266291         * @expectedDeprecated WP_User->id
     292         *
     293         * @covers WP_User::id
    267294         */
    268295        function test_id_property_back_compat() {
    269296                $user = new WP_User( self::$author_id );
     
    276303
    277304        /**
    278305         * ticket 19265
     306         *
     307         * @covers WP_User::user_level
    279308         */
    280309        function test_user_level_property_back_compat() {
    281310                $roles = array(
     
    294323                }
    295324        }
    296325
     326        /**
     327         *
     328         * @covers WP_User::__construct
     329         */
    297330        function test_construction() {
    298331                $user = new WP_User( self::$author_id );
    299332                $this->assertInstanceOf( 'WP_User', $user );
     
    333366                $this->assertEquals( $user->user_login, $user7->user_login );
    334367        }
    335368
     369        /**
     370         *
     371         * @covers WP_User::get
     372         */
    336373        function test_get() {
    337374                $user = new WP_User( self::$author_id );
    338375                $this->assertEquals( 'author_login', $user->get( 'user_login' ) );
     
    344381                $this->assertEquals( 'abcdefg', $user->get( 'dashed-key' ) );
    345382        }
    346383
     384        /**
     385         *
     386         * @covers WP_User::has_prop
     387         */
    347388        function test_has_prop() {
    348389                $user = new WP_User( self::$author_id );
    349390                $this->assertTrue( $user->has_prop( 'user_email' ) );
     
    354395                $this->assertTrue( $user->has_prop( 'dashed-key' ) );
    355396        }
    356397
     398        /**
     399         *
     400         * @covers ::wp_update_user
     401         */
    357402        function test_update_user() {
    358403                $user = new WP_User( self::$author_id );
    359404
     
    411456
    412457        /**
    413458         * ticket 19595
     459         *
     460         * @covers WP_User::__construct
    414461         */
    415462        function test_global_userdata() {
    416463                global $userdata, $wpdb;
     
    427474
    428475        /**
    429476         * ticket 19769
     477         *
     478         * @covers WP_User::__construct
    430479         */
    431480        function test_global_userdata_is_null_when_logged_out() {
    432481                global $userdata;
     
    448497                $this->assertFalse( $user->exists() );
    449498        }
    450499
     500        /**
     501         *
     502         * @covers WP_User::__construct
     503         */
    451504        function test_global_authordata() {
    452505                global $authordata, $id;
    453506
     
    480533
    481534        /**
    482535         * @ticket 13317
     536         *
     537         * @covers ::get_userdata
    483538         */
    484539        function test_get_userdata() {
    485540                $this->assertFalse( get_userdata( 0 ) );
     
    490545
    491546        /**
    492547         * @ticket 23480
     548         *
     549         * @covers WP_User::get_data_by
    493550         */
    494551        function test_user_get_data_by_id() {
    495552                $user = WP_User::get_data_by( 'id', self::$author_id );
     
    521578
    522579        /**
    523580         * @ticket 33869
     581         *
     582         * @covers WP_User::get_data_by
    524583         */
    525584        public function test_user_get_data_by_ID_should_alias_to_id() {
    526585                $user = WP_User::get_data_by( 'ID', self::$author_id );
     
    529588
    530589        /**
    531590         * @ticket 21431
     591         *
     592         * @covers ::count_many_users_posts
    532593         */
    533594        function test_count_many_users_posts() {
    534595                $user_id_b = self::factory()->user->create( array( 'role' => 'author' ) );
     
    562623
    563624        /**
    564625         * @ticket 22858
     626         *
     627         * @covers ::wp_update_user
    565628         */
    566629        function test_wp_update_user_on_nonexistent_users() {
    567630                $user_id = 1;
     
    576639
    577640        /**
    578641         * @ticket 28435
     642         *
     643         * @covers ::wp_update_user
    579644         */
    580645        function test_wp_update_user_should_not_change_password_when_passed_WP_User_instance() {
    581646                $testuserid = 1;
     
    591656        /**
    592657         * @ticket 45747
    593658         * @group ms-excluded
     659         *
     660         * @covers ::wp_update_user
    594661         */
    595662        function test_wp_update_user_should_not_mark_user_as_spam_on_single_site() {
    596663                $u = wp_update_user(
     
    615682
    616683        /**
    617684         * @ticket 28315
     685         *
     686         * @covers ::update_user_meta
    618687         */
    619688        function test_user_meta_error() {
    620689                $id1 = wp_insert_user(
     
    646715
    647716        /**
    648717         * @ticket 30647
     718         *
     719         * @covers ::update_user_meta
    649720         */
    650721        function test_user_update_email_error() {
    651722                $id1 = wp_insert_user(
     
    691762        /**
    692763         * @ticket 27317
    693764         * @dataProvider _illegal_user_logins_data
     765         *
     766         * @covers ::wp_insert_user
    694767         */
    695768        function test_illegal_user_logins_single( $user_login ) {
    696769                $user_data = array(
     
    715788        /**
    716789         * @ticket 27317
    717790         * @dataProvider _illegal_user_logins_data
     791         *
     792         * @covers ::register_new_user
    718793         */
    719794        function test_illegal_user_logins_single_wp_create_user( $user_login ) {
    720795                $user_email = 'testuser-' . $user_login . '@example.com';
     
    735810        /**
    736811         * @ticket 27317
    737812         * @group ms-required
     813         *
     814         * @covers ::wpmu_validate_user_signup
    738815         */
    739816        function test_illegal_user_logins_multisite() {
    740817                $user_data = array(
     
    773850
    774851        /**
    775852         * @ticket 24618
     853         *
     854         * @covers ::validate_username
    776855         */
    777856        public function test_validate_username_string() {
    778857                $this->assertTrue( validate_username( 'johndoe' ) );
     
    781860
    782861        /**
    783862         * @ticket 24618
     863         *
     864         * @covers ::validate_username
    784865         */
    785866        public function test_validate_username_contains_uppercase_letters() {
    786867                if ( is_multisite() ) {
     
    792873
    793874        /**
    794875         * @ticket 24618
     876         *
     877         * @covers ::validate_username
    795878         */
    796879        public function test_validate_username_empty() {
    797880                $this->assertFalse( validate_username( '' ) );
     
    799882
    800883        /**
    801884         * @ticket 24618
     885         *
     886         * @covers ::validate_username
    802887         */
    803888        public function test_validate_username_invalid() {
    804889                $this->assertFalse( validate_username( '@#&99sd' ) );
     
    806891
    807892        /**
    808893         * @ticket 29880
     894         *
     895         * @covers ::wp_insert_user
    809896         */
    810897        public function test_wp_insert_user_should_not_wipe_existing_password() {
    811898                $user_details = array(
     
    828915
    829916        /**
    830917         * @ticket 29696
     918         *
     919         * @covers ::wp_insert_user
    831920         */
    832921        public function test_wp_insert_user_should_sanitize_user_nicename_parameter() {
    833922                $user = $this->author;
     
    843932
    844933        /**
    845934         * @ticket 33793
     935         *
     936         * @covers ::wp_insert_user
    846937         */
    847938        public function test_wp_insert_user_should_accept_user_login_with_60_characters() {
    848939                $user_login = str_repeat( 'a', 60 );
     
    864955
    865956        /**
    866957         * @ticket 33793
     958         *
     959         * @covers ::wp_insert_user
    867960         */
    868961        public function test_wp_insert_user_should_reject_user_login_over_60_characters() {
    869962                $user_login = str_repeat( 'a', 61 );
     
    882975
    883976        /**
    884977         * @ticket 33793
     978         *
     979         * @covers ::wp_insert_user
    885980         */
    886981        public function test_wp_insert_user_should_reject_user_nicename_over_50_characters() {
    887982                $user_nicename = str_repeat( 'a', 51 );
     
    900995
    901996        /**
    902997         * @ticket 33793
     998         *
     999         * @covers ::wp_insert_user
    9031000         */
    9041001        public function test_wp_insert_user_should_not_generate_user_nicename_longer_than_50_chars() {
    9051002                $user_login = str_repeat( 'a', 55 );
     
    9191016
    9201017        /**
    9211018         * @ticket 33793
     1019         *
     1020         * @covers ::wp_insert_user
    9221021         */
    9231022        public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename() {
    9241023                $u1 = self::factory()->user->create(
     
    9491048
    9501049        /**
    9511050         * @ticket 33793
     1051         *
     1052         * @covers ::wp_insert_user
    9521053         */
    9531054        public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename_when_suffix_has_more_than_one_character() {
    9541055                $user_ids = self::factory()->user->create_many(
     
    9851086
    9861087        /**
    9871088         * @ticket 28004
     1089         *
     1090         * @covers ::wp_insert_user
    9881091         */
    9891092        public function test_wp_insert_user_with_invalid_user_id() {
    9901093                global $wpdb;
     
    10051108
    10061109        /**
    10071110         * @ticket 47902
     1111         *
     1112         * @covers ::wp_insert_user
    10081113         */
    10091114        public function test_wp_insert_user_with_empty_data() {
    10101115                add_filter( 'wp_pre_insert_user_data', '__return_empty_array' );
     
    10191124
    10201125        /**
    10211126         * @ticket 35750
     1127         *
     1128         * @covers ::wp_update_user
    10221129         */
    10231130        public function test_wp_update_user_should_delete_userslugs_cache() {
    10241131                $u    = self::factory()->user->create();
     
    10361143                $this->assertEquals( $u, wp_cache_get( $updated_user->user_nicename, 'userslugs' ) );
    10371144        }
    10381145
     1146        /**
     1147         *
     1148         * @covers ::wp_update_user
     1149         */
    10391150        public function test_changing_email_invalidates_password_reset_key() {
    10401151                global $wpdb;
    10411152
     
    10881199                $this->assertEmpty( $user->user_activation_key );
    10891200        }
    10901201
     1202        /**
     1203         *
     1204         * @covers ::get_users
     1205         */
    10911206        public function test_search_users_login() {
    10921207                $users = get_users(
    10931208                        array(
     
    10991214                $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    11001215        }
    11011216
     1217        /**
     1218         *
     1219         * @covers ::get_users
     1220         */
    11021221        public function test_search_users_url() {
    11031222                $users = get_users(
    11041223                        array(
     
    11101229                $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    11111230        }
    11121231
     1232        /**
     1233         *
     1234         * @covers ::get_users
     1235         */
    11131236        public function test_search_users_email() {
    11141237                $users = get_users(
    11151238                        array(
     
    11211244                $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    11221245        }
    11231246
     1247        /**
     1248         *
     1249         * @covers ::get_users
     1250         */
    11241251        public function test_search_users_nicename() {
    11251252                $users = get_users(
    11261253                        array(
     
    11321259                $this->assertTrue( in_array( (string) self::$contrib_id, $users, true ) );
    11331260        }
    11341261
     1262        /**
     1263         *
     1264         * @covers ::get_users
     1265         */
    11351266        public function test_search_users_display_name() {
    11361267                $users = get_users(
    11371268                        array(
     
    11451276
    11461277        /**
    11471278         * @ticket 32158
     1279         *
     1280         * @covers ::wp_update_user
    11481281         */
    11491282        function test_email_case() {
    11501283                // Alter the case of the email address (which stays the same).
     
    11591292
    11601293        /**
    11611294         * @ticket 32158
     1295         *
     1296         * @covers ::wp_update_user
    11621297         */
    11631298        function test_email_change() {
    11641299                // Change the email address.
     
    11821317         * @dataProvider data_wp_new_user_notifications
    11831318         * @ticket 33654
    11841319         * @ticket 36009
     1320         *
     1321         * @covers ::wp_new_user_notification
    11851322         */
    11861323        function test_wp_new_user_notification( $notify, $admin_email_sent_expected, $user_email_sent_expected ) {
    11871324                reset_phpmailer_instance();
     
    12621399         *
    12631400         * @ticket 33654
    12641401         * @expectedDeprecated wp_new_user_notification
     1402         *
     1403         * @covers ::wp_new_user_notification
    12651404         */
    12661405        function test_wp_new_user_notification_old_signature_throws_deprecated_warning_but_sends() {
    12671406                reset_phpmailer_instance();
     
    12871426         * Set up a user and try sending a notification using `wp_new_user_notification( $user );`.
    12881427         *
    12891428         * @ticket 34377
     1429         *
     1430         * @covers ::wp_new_user_notification
    12901431         */
    12911432        function test_wp_new_user_notification_old_signature_no_password() {
    12921433                reset_phpmailer_instance();
     
    13121453         * Ensure blog's admin email change notification emails do not contain encoded HTML entities
    13131454         *
    13141455         * @ticket 40015
     1456         *
     1457         * @covers ::update_option_new_admin_email
    13151458         */
    13161459        function test_new_admin_email_notification_html_entities_decoded() {
    13171460                reset_phpmailer_instance();
     
    13451488         * - is not a valid email
    13461489         *
    13471490         * @dataProvider data_user_admin_email_confirmation_emails
     1491         *
     1492         * @covers ::update_option_new_admin_email
    13481493         */
    13491494        function test_new_admin_email_confirmation_not_sent_when_email_invalid( $email, $message ) {
    13501495                reset_phpmailer_instance();
     
    13861531         * - Matches another user's email
    13871532         *
    13881533         * @dataProvider data_user_change_email_confirmation_emails
     1534         *
     1535         * @covers ::send_confirmation_on_profile_email
    13891536         */
    13901537        function test_profile_email_confirmation_not_sent_invalid_email( $email, $message ) {
    13911538
     
    14511598         * Checks that calling edit_user() with no password returns an error when adding, and doesn't when updating.
    14521599         *
    14531600         * @ticket 35715
     1601         *
     1602         * @covers ::edit_user
    14541603         */
    14551604        function test_edit_user_blank_pw() {
    14561605                $_POST                 = array();
     
    15201669
    15211670        /**
    15221671         * @ticket 16470
     1672         *
     1673         * @covers ::wp_set_current_user
    15231674         */
    15241675        function test_send_confirmation_on_profile_email() {
    15251676                reset_phpmailer_instance();
     
    15551706
    15561707        /**
    15571708         * @ticket 16470
     1709         *
     1710         * @covers ::wp_set_current_user
    15581711         */
    15591712        function test_remove_send_confirmation_on_profile_email() {
    15601713                remove_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
     
    15951748         *
    15961749         * @ticket 16470
    15971750         * @ticket 40015
     1751         *
     1752         * @covers ::send_confirmation_on_profile_email
    15981753         */
    15991754        function test_send_confirmation_on_profile_email_html_entities_decoded() {
    16001755                $user_id = self::factory()->user->create(
     
    16311786
    16321787        /**
    16331788         * @ticket 42564
     1789         *
     1790         * @covers ::edit_user
    16341791         */
    16351792        function test_edit_user_role_update() {
    16361793                $_POST    = array();
     
    16741831         * Testing the `wp_user_personal_data_exporter()` function when no user exists.
    16751832         *
    16761833         * @ticket 43547
     1834         *
     1835         * @covers ::wp_user_personal_data_exporter
    16771836         */
    16781837        function test_wp_user_personal_data_exporter_no_user() {
    16791838                $actual = wp_user_personal_data_exporter( 'not-a-user-email@test.com' );
     
    16911850         * user exists.
    16921851         *
    16931852         * @ticket 43547
     1853         *
     1854         * @covers ::wp_user_personal_data_exporter
    16941855         */
    16951856        function test_wp_user_personal_data_exporter() {
    16961857                $test_user = new WP_User( self::$contrib_id );
     
    17111872         * with Community Events Location IP data.
    17121873         *
    17131874         * @ticket 43921
     1875         *
     1876         * @covers ::wp_user_personal_data_exporter
    17141877         */
    17151878        function test_wp_community_events_location_ip_personal_data_exporter() {
    17161879                $test_user = new WP_User( self::$contrib_id );
     
    17351898         * with Community Events Location city data.
    17361899         *
    17371900         * @ticket 43921
     1901         *
     1902         * @covers ::wp_user_personal_data_exporter
    17381903         */
    17391904        function test_wp_community_events_location_city_personal_data_exporter() {
    17401905                $test_user = new WP_User( self::$contrib_id );
     
    17771942         * with Session Tokens data.
    17781943         *
    17791944         * @ticket 45889
     1945         *
     1946         * @covers ::wp_user_personal_data_exporter
    17801947         */
    17811948        function test_wp_session_tokens_personal_data_exporter() {
    17821949                $test_user = new WP_User( self::$contrib_id );
     
    18211988         * @since 5.4.0
    18221989         *
    18231990         * @ticket 47509
     1991         *
     1992         * @covers ::wp_user_personal_data_exporter
    18241993         */
    18251994        function test_filter_wp_privacy_additional_user_profile_data() {
    18261995                $test_user = new WP_User( self::$contrib_id );
  • tests/phpunit/tests/walker.php

     
    1616
    1717        }
    1818
     19        /**
     20         *
     21         * @covers Walker::walk
     22         */
    1923        function test_single_item() {
    2024
    2125                $items  = array(
     
    3135
    3236        }
    3337
     38        /**
     39         *
     40         * @covers Walker::walk
     41         */
    3442        function test_single_item_flat() {
    3543
    3644                $items  = array(
     
    4654
    4755        }
    4856
     57        /**
     58         *
     59         * @covers Walker::walk
     60         */
    4961        function test_single_item_depth_1() {
    5062
    5163                $items  = array(
     
    6173
    6274        }
    6375
     76        /**
     77         *
     78         * @covers Walker::walk
     79         */
    6480        function test_multiple_items_single_level() {
    6581
    6682                $items = array(
     
    8197
    8298        }
    8399
     100        /**
     101         *
     102         * @covers Walker::walk
     103         */
    84104        function test_multiple_items_multiple_levels() {
    85105
    86106                $items = array(
     
    101121
    102122        }
    103123
     124        /**
     125         *
     126         * @covers Walker::walk
     127         */
    104128        function test_multiple_items_multiple_levels_flat() {
    105129
    106130                $items = array(
     
    121145
    122146        }
    123147
     148        /**
     149         *
     150         * @covers Walker::walk
     151         */
    124152        function test_multiple_items_multiple_levels_depth_1() {
    125153
    126154                $items = array(
     
    141169
    142170        }
    143171
     172        /**
     173         *
     174         * @covers Walker::walk
     175         */
    144176        function test_multiple_items_multiple_levels_depth_2() {
    145177
    146178                $items = array(
     
    165197
    166198        }
    167199
     200        /**
     201         *
     202         * @covers Walker::walk
     203         */
    168204        function test_multiple_items_recursive() {
    169205
    170206                $items = array(
     
    185221
    186222        }
    187223
     224        /**
     225         *
     226         * @covers Walker::walk
     227         */
    188228        function test_single_item_child() {
    189229
    190230                $items = array(
     
    201241
    202242        }
    203243
     244        /**
     245         *
     246         * @covers Walker::walk
     247         */
    204248        function test_single_item_missing_parent_depth_1() {
    205249
    206250                $items = array(
     
    224268
    225269        }
    226270
     271        /**
     272         *
     273         * @covers Walker::walk
     274         */
    227275        function test_multiple_items_missing_parents() {
    228276
    229277                $items = array(
     
    248296
    249297        }
    250298
     299        /**
     300         *
     301         * @covers Walker::walk
     302         */
    251303        function test_multiple_items_missing_parents_depth_1() {
    252304
    253305                $items = array(
  • tests/phpunit/tests/widgets.php

     
    3131        /**
    3232         * @see register_widget()
    3333         * @see unregister_widget()
     34         *
     35         * @covers ::register_widget
     36         * @covers ::unregister_widget
    3437         */
    3538        function test_register_and_unregister_widget_core_widget() {
    3639                global $wp_widget_factory;
     
    3942                register_widget( $widget_class );
    4043                $this->assertArrayHasKey( $widget_class, $wp_widget_factory->widgets );
    4144
    42                 unregister_widget( $widget_class );
     45                ( $widget_class );
    4346                $this->assertArrayNotHasKey( $widget_class, $wp_widget_factory->widgets );
    4447        }
    4548
     
    4952         * @see register_widget()
    5053         * @see unregister_widget()
    5154         * @ticket 28216
     55         *
     56         * @covers ::register_widget
     57         * @covers ::unregister_widget
    5258         */
    5359        function test_register_and_unregister_widget_instance() {
    5460                global $wp_widget_factory, $wp_registered_widgets;
     
    125131
    126132        /**
    127133         * @group sidebar
     134         *
     135         * @covers ::register_sidebars
    128136         */
    129137        function test_register_sidebars_single() {
    130138
     
    138146
    139147        /**
    140148         * @group sidebar
     149         *
     150         * @covers ::register_sidebars
    141151         */
    142152        function test_register_sidebars_multiple() {
    143153
     
    161171
    162172        /**
    163173         * @group sidebar
     174         *
     175         * @covers ::register_sidebars
    164176         */
    165177        function test_register_sidebar_with_no_id() {
    166178                global $wp_registered_sidebars;
     
    178190
    179191        /**
    180192         * @group sidebar
     193         *
     194         * @covers ::register_sidebars
    181195         */
    182196        function test_unregister_sidebar_registered_with_no_id() {
    183197                global $wp_registered_sidebars;
     
    197211
    198212        /**
    199213         * @group sidebar
     214         *
     215         * @covers ::register_sidebars
    200216         */
    201217        function test_register_sidebar_with_string_id() {
    202218
     
    210226
    211227        /**
    212228         * @group sidebar
     229         *
     230         * @covers ::unregister_sidebar
    213231         */
    214232        function test_unregister_sidebar_with_string_id() {
    215233                global $wp_registered_sidebars;
     
    223241
    224242        /**
    225243         * @group sidebar
     244         *
     245         * @covers ::register_sidebars
    226246         */
    227247        function test_register_sidebar_with_numeric_id() {
    228248                global $wp_registered_sidebars;
     
    235255
    236256        /**
    237257         * @group sidebar
     258         *
     259         * @covers ::unregister_sidebar
    238260         */
    239261        function test_unregister_sidebar_with_numeric_id() {
    240262                global $wp_registered_sidebars;
     
    256278
    257279        /**
    258280         * @group sidebar
     281         *
     282         * @covers ::dynamic_sidebar
    259283         */
    260284        function test_dynamic_sidebar_using_sidebar_registered_with_no_id() {
    261285                $this->setExpectedIncorrectUsage( 'register_sidebar' );
     
    275299
    276300        /**
    277301         * @group sidebar
     302         *
     303         * @covers ::dynamic_sidebar
    278304         */
    279305        function test_dynamic_sidebar_using_invalid_sidebar_id() {
    280306                register_sidebar( array( 'id' => 'wp-unit-text' ) );
     
    293319
    294320        /**
    295321         * @group sidebar
     322         *
     323         * @covers ::dynamic_sidebar
    296324         */
    297325        function test_dynamic_sidebar_numeric_id() {
    298326                $sidebar_id = 2;
     
    307335
    308336        /**
    309337         * @group sidebar
     338         *
     339         * @covers ::dynamic_sidebar
    310340         */
    311341        function test_dynamic_sidebar_string_id() {
    312342                $sidebar_id = 'wp-unit-tests';
     
    321351
    322352        /**
    323353         * @see WP_Widget_Search::form()
     354         *
     355         * @covers WP_Widget_Search::form
    324356         */
    325357        function test_wp_widget_search_form() {
    326358                $widget = new WP_Widget_Search( 'foo', 'Foo' );
     
    343375
    344376        /**
    345377         * @see WP_Widget::form()
     378         *
     379         * @covers WP_Widget_Search::form
    346380         */
    347381        function test_wp_widget_form() {
    348382                $widget = new WP_Widget( 'foo', 'Foo' );
     
    355389
    356390        /**
    357391         * @see WP_Widget::__construct()
     392         *
     393         * @covers WP_Widget::__construct
    358394         */
    359395        function test_wp_widget_constructor() {
    360396                $id_base    = 'foo';
     
    385421        /**
    386422         * @see WP_Widget::get_field_name()
    387423         * @dataProvider data_wp_widget_get_field_name
     424         *
     425         * @covers WP_Widget::get_field_name
    388426         */
    389427        function test_wp_widget_get_field_name( $expected, $value_to_test ) {
    390428                $widget = new WP_Widget( 'foo', 'Foo' );
     
    435473        /**
    436474         * @see WP_Widget::get_field_id()
    437475         * @dataProvider data_wp_widget_get_field_id
     476         *
     477         * @covers WP_Widget::get_field_id
    438478         */
    439479        function test_wp_widget_get_field_id( $expected, $value_to_test ) {
    440480                $widget = new WP_Widget( 'foo', 'Foo' );
     
    484524
    485525        /**
    486526         * @see WP_Widget::_register()
     527         *
     528         * @covers WP_Widget::_register
     529         * @covers ::wp_widgets_init
    487530         */
    488531        function test_wp_widget__register() {
    489532                global $wp_registered_widgets;
     
    506549
    507550        /**
    508551         * @see WP_Widget::is_preview()
     552         *
     553         * @covers WP_Widget::is_preview
    509554         */
    510555        function test_wp_widget_is_preview() {
    511556                global $wp_customize;
     
    529574
    530575        /**
    531576         * @see WP_Widget::get_settings()
     577         *
     578         * @covers WP_Widget::get_settings
    532579         */
    533580        function test_wp_widget_get_settings() {
    534581                global $wp_registered_widgets;
     
    566613
    567614        /**
    568615         * @see WP_Widget::save_settings()
     616         *
     617         * @covers WP_Widget::save_settings
    569618         */
    570619        function test_wp_widget_save_settings() {
    571620                global $wp_registered_widgets;
     
    597646
    598647        /**
    599648         * @see WP_Widget::save_settings()
     649         *
     650         * @covers WP_Widget::save_settings
    600651         */
    601652        function test_wp_widget_save_settings_delete() {
    602653                global $wp_registered_widgets;
     
    614665
    615666        /**
    616667         * @see wp_widget_control()
     668         *
     669         * @covers ::wp_widget_control
    617670         */
    618671        function test_wp_widget_control() {
    619672                global $wp_registered_widgets;
     
    676729                }
    677730        }
    678731
     732        /**
     733         *
     734         * @covers ::the_widget
     735         */
    679736        function test_the_widget_custom_before_title_arg() {
    680737                register_widget( 'WP_Widget_Text' );
    681738
     
    704761         * display an unregistered widget.
    705762         *
    706763         * @see \the_widget()
     764         *
     765         * @covers ::the_widget
    707766         */
    708767        function test_the_widget_with_unregistered_widget() {
    709768                $this->setExpectedIncorrectUsage( 'the_widget' );
     
    712771
    713772        /**
    714773         * @ticket 34226
     774         *
     775         * @covers ::the_widget
    715776         */
    716777        public function test_the_widget_should_short_circuit_with_widget_display_callback() {
    717778                add_filter( 'widget_display_callback', '__return_false' );
     
    740801        /**
    741802         * Tests for when 'sidebars_widgets' theme mod is populated.
    742803         *
    743          * @covers ::retrieve_widgets()
     804         * @covers ::retrieve_widgets
    744805         */
    745806        function test_retrieve_widgets_with_theme_mod() {
    746807                global $sidebars_widgets, $_wp_sidebars_widgets;
     
    804865        /**
    805866         * Tests for when sidebars widgets matches registered sidebars.
    806867         *
    807          * @covers ::retrieve_widgets()
     868         * @covers ::retrieve_widgets
    808869         */
    809870        function test_retrieve_widgets_with_sidebars_widgets_matching_registered_sidebars() {
    810871                global $sidebars_widgets;
     
    842903        /**
    843904         * Tests for when sidebars widgets doesn't match registered sidebars.
    844905         *
    845          * @covers ::retrieve_widgets()
     906         * @covers ::retrieve_widgets
    846907         */
    847908        function test_retrieve_widgets_with_sidebars_widgets_not_matching_registered_sidebars() {
    848909                global $sidebars_widgets, $_wp_sidebars_widgets;
     
    936997        /**
    937998         * Tests for Customizer mode.
    938999         *
    939          * @covers ::retrieve_widgets()
     1000         * @covers ::retrieve_widgets
    9401001         */
    9411002        function test_retrieve_widgets_for_customizer() {
    9421003                global $sidebars_widgets, $_wp_sidebars_widgets;
     
    9831044                $this->assertNotEquals( $sidebars_widgets, wp_get_sidebars_widgets() );
    9841045        }
    9851046
     1047        /**
     1048         *
     1049         * @covers ::retrieve_widgets
     1050         */
    9861051        function test_retreive_widgets_with_single_widget() {
    9871052                global $sidebars_widgets;
    9881053
     
    10081073        /**
    10091074         * Tests for orphaned widgets being moved into inactive widgets.
    10101075         *
    1011          * @covers ::retrieve_widgets()
     1076         * @covers ::retrieve_widgets
    10121077         */
    10131078        function test_retrieve_widgets_move_orphaned_widgets_to_inactive() {
    10141079                global $sidebars_widgets;
     
    10431108        /**
    10441109         * Test _wp_remove_unregistered_widgets.
    10451110         *
    1046          * @covers ::_wp_remove_unregistered_widgets()
     1111         * @covers ::_wp_remove_unregistered_widgets
    10471112         */
    10481113        public function test__wp_remove_unregistered_widgets() {
    10491114                $widgets = array(
     
    10731138        /**
    10741139         * Two themes with one sidebar each should just map, switching to a theme not previously-active.
    10751140         *
    1076          * @covers ::wp_map_sidebars_widgets()
     1141         * @covers ::wp_map_sidebars_widgets
    10771142         */
    10781143        public function test_one_sidebar_each() {
    10791144                $this->register_sidebars( array( 'primary' ) );
     
    10931158        /**
    10941159         * Sidebars with the same name should map, switching to a theme not previously-active.
    10951160         *
    1096          * @covers ::wp_map_sidebars_widgets()
     1161         * @covers ::wp_map_sidebars_widgets
    10971162         */
    10981163        public function test_sidebars_with_same_slug() {
    10991164                $this->register_sidebars( array( 'primary', 'secondary' ) );
     
    11111176        /**
    11121177         * Make educated guesses on theme sidebars.
    11131178         *
    1114          * @covers ::wp_map_sidebars_widgets()
     1179         * @covers ::wp_map_sidebars_widgets
    11151180         */
    11161181        public function test_sidebar_guessing() {
    11171182                $this->register_sidebars( array( 'primary', 'secondary' ) );
     
    11341199        /**
    11351200         * Make sure two sidebars that fall in the same group don't get the same menu assigned.
    11361201         *
    1137          * @covers ::wp_map_sidebars_widgets()
     1202         * @covers ::wp_map_sidebars_widgets
    11381203         */
    11391204        public function test_sidebar_guessing_one_menu_per_group() {
    11401205                $this->register_sidebars( array( 'primary' ) );
     
    11551220        /**
    11561221         * Make sure two sidebars that fall in the same group get menus assigned from the same group.
    11571222         *
    1158          * @covers ::wp_map_sidebars_widgets()
     1223         * @covers ::wp_map_sidebars_widgets
    11591224         */
    11601225        public function test_sidebar_guessing_one_menu_per_sidebar() {
    11611226                $this->register_sidebars( array( 'primary', 'main' ) );
  • tests/phpunit/tests/wp.php

     
    1414                $this->wp = new WP();
    1515        }
    1616
     17        /**
     18         *
     19         * @covers WP::add_query_var
     20         */
    1721        public function test_add_query_var() {
    1822                $public_qv_count = count( $this->wp->public_query_vars );
    1923
     
    2630                $this->assertTrue( in_array( 'test2', $this->wp->public_query_vars, true ) );
    2731        }
    2832
     33        /**
     34         *
     35         * @covers WP::remove_query_var
     36         */
    2937        public function test_remove_query_var() {
    3038                $public_qv_count = count( $this->wp->public_query_vars );
    3139