Make WordPress Core

Changeset 53561


Ignore:
Timestamp:
06/23/2022 07:45:24 PM (2 years ago)
Author:
azaozz
Message:

Build/Test Tools: Add missing @covers tags for the AJAX test group.

Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.

Location:
trunk/tests/phpunit/tests/ajax
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/AddMeta.php

    r48937 r53561  
    1414    /**
    1515     * @ticket 43559
     16     *
     17     * @covers ::add_post_meta
     18     * @covers ::wp_ajax_add_meta
    1619     */
    1720    public function test_post_add_meta_empty_is_allowed_ajax() {
    18         $p = self::factory()->post->create();
     21        $post = self::factory()->post->create();
    1922
    2023        // Become an administrator.
     
    2225
    2326        $_POST = array(
    24             'post_id'              => $p,
     27            'post_id'              => $post,
    2528            'metakeyinput'         => 'testkey',
    2629            'metavalue'            => '',
     
    3538        }
    3639
    37         $this->assertSame( '', get_post_meta( $p, 'testkey', true ) );
     40        $this->assertSame( '', get_post_meta( $post, 'testkey', true ) );
    3841    }
    3942
    4043    /**
    4144     * @ticket 43559
     45     *
     46     * @covers ::update_metadata_by_mid
     47     * @covers ::wp_ajax_add_meta
    4248     */
    43     public function test_post_update_meta_empty_is_allowed_ajax() {
    44         $p = self::factory()->post->create();
     49    public function test_update_metadata_by_mid_allows_empty_values_ajax() {
     50        $post = self::factory()->post->create();
    4551
    46         $m = add_post_meta( $p, 'testkey', 'hello' );
     52        $meta_id = add_post_meta( $post, 'testkey', 'hello' );
    4753
    4854        // Become an administrator.
     
    5157        $_POST = array(
    5258            '_ajax_nonce-add-meta' => wp_create_nonce( 'add-meta' ),
    53             'post_id'              => $p,
     59            'post_id'              => $post,
    5460            'meta'                 => array(
    55                 $m => array(
     61                $meta_id => array(
    5662                    'key'   => 'testkey',
    5763                    'value' => '',
     
    6773        }
    6874
    69         $this->assertSame( '', get_post_meta( $p, 'testkey', true ) );
     75        $this->assertSame( '', get_post_meta( $post, 'testkey', true ) );
    7076    }
    7177}
  • trunk/tests/phpunit/tests/ajax/AddTag.php

    r53159 r53561  
    1717     *
    1818     * @ticket 42937
     19     *
     20     * @covers ::wp_ajax_add_tag
     21     * @covers ::wp_insert_term
    1922     *
    2023     * @param array                 $post_data Data to populate $_POST.
     
    9194    /**
    9295     * @ticket 42937
     96     *
     97     * @covers ::wp_ajax_add_tag
    9398     */
    9499    public function test_adding_category_without_capability_should_error() {
     
    109114    /**
    110115     * @ticket 42937
     116     *
     117     * @covers ::wp_ajax_add_tag
     118     * @covers ::wp_insert_term
    111119     */
    112120    public function test_adding_existing_category_should_error() {
  • trunk/tests/phpunit/tests/ajax/Attachments.php

    r51870 r53561  
    1313    /**
    1414     * @ticket 36578
     15     *
     16     * @covers ::wp_ajax_send_attachment_to_editor
     17     * @covers ::get_image_send_to_editor
    1518     */
    1619    public function test_wp_ajax_send_attachment_to_editor_should_return_an_image() {
     
    6568     * @ticket 36578
    6669     * @group ms-excluded
     70     *
     71     * @covers ::wp_ajax_send_attachment_to_editor
    6772     */
    6873    public function test_wp_ajax_send_attachment_to_editor_should_return_a_link() {
     74        $this->skipWithMultisite();
     75
    6976        // Become an administrator.
    7077        $post    = $_POST;
  • trunk/tests/phpunit/tests/ajax/Autosave.php

    r51451 r53561  
    4444    /**
    4545     * Tests autosaving a post.
     46     *
     47     * @covers ::wp_ajax_heartbeat
    4648     */
    4749    public function test_autosave_post() {
     
    8587    /**
    8688     * Tests autosaving a locked post.
     89     *
     90     * @covers ::wp_ajax_heartbeat
    8791     */
    8892    public function test_autosave_locked_post() {
     
    136140    /**
    137141     * Tests with an invalid nonce.
     142     *
     143     * @covers ::wp_ajax_heartbeat
    138144     */
    139145    public function test_with_invalid_nonce() {
  • trunk/tests/phpunit/tests/ajax/Compression.php

    r51462 r53561  
    1818    /**
    1919     * Test as a logged out user
     20     *
     21     * @covers ::wp_ajax_wp_compression_test
    2022     */
    2123    public function test_logged_out() {
     
    3335    /**
    3436     * Fetch the test text
     37     *
     38     * @covers ::wp_ajax_wp_compression_test
    3539     */
    3640    public function test_text() {
     
    5761     *
    5862     * @requires function gzdeflate
     63     *
     64     * @covers ::wp_ajax_wp_compression_test
    5965     */
    6066    public function test_gzdeflate() {
     
    8288     *
    8389     * @requires function gzencode
     90     *
     91     * @covers ::wp_ajax_wp_compression_test
    8492     */
    8593    public function test_gzencode() {
     
    105113    /**
    106114     * Fetch the test text (unknown encoding)
     115     *
     116     * @covers ::wp_ajax_wp_compression_test
    107117     */
    108118    public function test_unknown_encoding() {
     
    123133    /**
    124134     * Set the 'can_compress_scripts' site option to true
     135     *
     136     * @covers ::wp_ajax_wp_compression_test
    125137     */
    126138    public function test_set_yes() {
     
    161173    /**
    162174     * Set the 'can_compress_scripts' site option to false
     175     *
     176     * @covers ::wp_ajax_wp_compression_test
    163177     */
    164178    public function test_set_no() {
  • trunk/tests/phpunit/tests/ajax/CustomizeManager.php

    r52371 r53561  
    104104     *
    105105     * @ticket 30937
     106     *
    106107     * @covers WP_Customize_Manager::save
    107108     */
     
    271272     *
    272273     * @ticket 30937
     274     *
    273275     * @covers WP_Customize_Manager::save
    274276     */
     
    300302     *
    301303     * @ticket 30937
     304     *
    302305     * @covers WP_Customize_Manager::save
    303306     */
     
    339342     *
    340343     * @ticket 38943
     344     *
    341345     * @covers WP_Customize_Manager::save
    342346     */
     
    437441     *
    438442     * @ticket 39896
     443     *
    439444     * @covers WP_Customize_Manager::save
    440445     */
     
    483488     *
    484489     * @ticket 39896
     490     *
    485491     * @covers WP_Customize_Manager::handle_changeset_trash_request
    486492     */
  • trunk/tests/phpunit/tests/ajax/CustomizeMenus.php

    r52010 r53561  
    8080     * @param string $role              The role we're checking caps against.
    8181     * @param array  $expected_results  Expected results.
     82     *
     83     * @covers WP_Customize_Nav_Menus::ajax_load_available_items
    8284     */
    8385    public function test_ajax_load_available_items_cap_check( $role, $expected_results ) {
     
    158160     * @param array $post_args POST args.
    159161     * @param mixed $expected_results Expected results.
     162     *
     163     * @covers WP_Customize_Nav_Menus::ajax_load_available_items
    160164     */
    161165    public function test_ajax_load_available_items_error_messages( $post_args, $expected_results ) {
     
    268272     * @param array $post_args       POST args.
    269273     * @param array $success_status  Success status.
     274     *
     275     * @covers WP_Customize_Nav_Menus::ajax_load_available_items
    270276     */
    271277    public function test_ajax_load_available_items_success_status( $post_args, $success_status ) {
     
    358364     *
    359365     * @param array $post_args POST args.
     366     *
     367     * @covers WP_Customize_Nav_Menus::ajax_load_available_items
    360368     */
    361369    public function test2_ajax_load_available_items_structure( $post_args ) {
     
    467475     * @param string $role             Role.
    468476     * @param array  $expected_results Expected results.
     477     *
     478     * @covers WP_Customize_Nav_Menus::ajax_search_available_items
     479     * @covers WP_Customize_Nav_Menus::search_available_items_query
    469480     */
    470481    public function test_ajax_search_available_items_caps_check( $role, $expected_results ) {
     
    546557     * @param array $post_args        POST args.
    547558     * @param array $expected_results Expected results.
     559     *
     560     * @covers WP_Customize_Nav_Menus::ajax_search_available_items
     561     * @covers WP_Customize_Nav_Menus::search_available_items_query
    548562     */
    549563    public function test_ajax_search_available_items_results( $post_args, $expected_results ) {
     
    639653     *
    640654     * @covers WP_Customize_Nav_Menus::ajax_insert_auto_draft_post
     655     * @covers WP_Customize_Nav_Menus::insert_auto_draft_post
    641656     */
    642657    public function test_ajax_insert_auto_draft_post_success() {
  • trunk/tests/phpunit/tests/ajax/DeleteComment.php

    r51438 r53561  
    6060     * @param WP_Comment $comment Comment object.
    6161     * @param string     $action  Action: 'trash', 'untrash', etc.
     62     *
     63     * @covers ::wp_ajax_delete_comment
     64     * @covers ::_wp_ajax_delete_comment_response
    6265     */
    6366    public function _test_as_admin( $comment, $action ) {
     
    119122     * @param WP_Comment $comment Comment object.
    120123     * @param string     $action  Action: 'trash', 'untrash', etc.
     124     *
     125     * @covers ::wp_ajax_delete_comment
    121126     */
    122127    public function _test_as_subscriber( $comment, $action ) {
     
    151156     * @param WP_Comment $comment Comment object.
    152157     * @param string     $action  Action: 'trash', 'untrash', etc.
     158     *
     159     * @covers ::wp_ajax_delete_comment
    153160     */
    154161    public function _test_with_bad_nonce( $comment, $action ) {
     
    182189     * @param WP_Comment $comment Comment object.
    183190     * @param string     $action  Action: 'trash', 'untrash', etc.
     191     *
     192     * @covers ::wp_ajax_delete_comment
    184193     */
    185194    public function _test_with_bad_id( $comment, $action ) {
     
    219228     * @param WP_Comment $comment Comment object.
    220229     * @param string     $action  Action: 'trash', 'untrash', etc.
     230     *
     231     * @covers ::wp_ajax_delete_comment
    221232     */
    222233    public function _test_double_action( $comment, $action ) {
     
    264275    /**
    265276     * Deletes a comment as an administrator (expects success).
     277     *
     278     * @covers ::wp_ajax_delete_comment
     279     * @covers ::_wp_ajax_delete_comment_response
    266280     */
    267281    public function test_ajax_comment_trash_actions_as_administrator() {
     
    280294    /**
    281295     * Deletes a comment as a subscriber (expects permission denied).
     296     *
     297     * @covers ::wp_ajax_delete_comment
    282298     */
    283299    public function test_ajax_comment_trash_actions_as_subscriber() {
     
    296312    /**
    297313     * Deletes a comment with no ID.
     314     *
     315     * @covers ::wp_ajax_delete_comment
     316     * @covers ::_wp_ajax_delete_comment_response
    298317     */
    299318    public function test_ajax_trash_comment_no_id() {
     
    312331    /**
    313332     * Deletes a comment with a bad nonce.
     333     *
     334     * @covers ::wp_ajax_delete_comment
    314335     */
    315336    public function test_ajax_trash_comment_bad_nonce() {
     
    328349    /**
    329350     * Tests trashing an already trashed comment, etc.
     351     *
     352     * @covers ::wp_ajax_delete_comment
    330353     */
    331354    public function test_ajax_trash_double_action() {
  • trunk/tests/phpunit/tests/ajax/DeletePlugin.php

    r51870 r53561  
    99 *
    1010 * @group ajax
     11 *
     12 * @covers ::wp_ajax_delete_plugin
    1113 */
    1214class Tests_Ajax_Delete_Plugin extends WP_Ajax_UnitTestCase {
     
    128130    /**
    129131     * @group ms-excluded
     132     *
     133     * @covers ::wp_ajax_delete_plugin
     134     * @covers ::delete_plugins
    130135     */
    131136    public function test_delete_plugin() {
  • trunk/tests/phpunit/tests/ajax/DimComment.php

    r51568 r53561  
    1313 * @since      3.4.0
    1414 * @group      ajax
     15 *
     16 * @covers ::wp_ajax_dim_comment
    1517 */
    1618class Tests_Ajax_DimComment extends WP_Ajax_UnitTestCase {
  • trunk/tests/phpunit/tests/ajax/EditComment.php

    r52010 r53561  
    1313 * @since      3.4.0
    1414 * @group      ajax
     15 *
     16 * @covers ::wp_ajax_edit_comment
    1517 */
    1618class Tests_Ajax_EditComment extends WP_Ajax_UnitTestCase {
  • trunk/tests/phpunit/tests/ajax/GetComments.php

    r49603 r53561  
    1313 * @since      3.4.0
    1414 * @group      ajax
     15 *
     16 * @covers ::wp_ajax_get_comments
    1517 */
    1618class Tests_Ajax_GetComments extends WP_Ajax_UnitTestCase {
  • trunk/tests/phpunit/tests/ajax/ManageThemes.php

    r52010 r53561  
    99 *
    1010 * @group ajax
     11 *
     12 * @covers ::wp_ajax_update_theme
    1113 */
    1214class Tests_Ajax_Manage_Themes extends WP_Ajax_UnitTestCase {
  • trunk/tests/phpunit/tests/ajax/MediaEdit.php

    r51568 r53561  
    2828    /**
    2929     * @ticket 22985
     30     * @requires function imagejpeg
     31     *
     32     * @covers ::wp_insert_attachment
     33     * @covers ::wp_save_image
    3034     */
    3135    public function testCropImageThumbnail() {
     
    5761    /**
    5862     * @ticket 32171
     63     * @requires function imagejpeg
     64     *
     65     * @covers ::wp_insert_attachment
     66     * @covers ::wp_save_image
    5967     */
    6068    public function testImageEditOverwriteConstant() {
  • trunk/tests/phpunit/tests/ajax/QuickEdit.php

    r48939 r53561  
    1515    /**
    1616     * @ticket 26948
     17     *
     18     * @covers ::wp_ajax_inline_save
     19     * @covers ::edit_post
    1720     */
    1821    public function test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit() {
  • trunk/tests/phpunit/tests/ajax/ReplytoComment.php

    r53337 r53561  
    1313 * @since      3.4.0
    1414 * @group      ajax
     15 *
     16 * @covers ::wp_ajax_replyto_comment
    1517 */
    1618class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase {
     
    187189        // Make the request.
    188190        $this->expectException( 'WPAjaxDieStopException' );
    189         $this->expectExceptionMessage( 'You cannot reply to a comment on a draft post.' );
     191        $this->expectExceptionMessage( 'Error: You cannot reply to a comment on a draft post.' );
    190192        $this->_handleAjax( 'replyto-comment' );
    191193    }
  • trunk/tests/phpunit/tests/ajax/Response.php

    r51568 r53561  
    77 * @since      3.5.0
    88 * @group      ajax
     9 *
     10 * @covers WP_Ajax_Response::send
    911 */
    1012class Tests_Ajax_Response extends WP_UnitTestCase {
  • trunk/tests/phpunit/tests/ajax/TagSearch.php

    r49603 r53561  
    1313 * @since      3.4.0
    1414 * @group      ajax
     15 *
     16 * @covers ::wp_ajax_ajax_tag_search
    1517 */
    1618class Tests_Ajax_TagSearch extends WP_Ajax_UnitTestCase {
  • trunk/tests/phpunit/tests/ajax/UpdatePlugin.php

    r51870 r53561  
    99 *
    1010 * @group ajax
     11 *
     12 * @covers ::wp_ajax_update_plugin
    1113 */
    1214class Tests_Ajax_Update_Plugin extends WP_Ajax_UnitTestCase {
Note: See TracChangeset for help on using the changeset viewer.