Changeset 53561
- Timestamp:
- 06/23/2022 07:45:24 PM (2 years ago)
- Location:
- trunk/tests/phpunit/tests/ajax
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/AddMeta.php
r48937 r53561 14 14 /** 15 15 * @ticket 43559 16 * 17 * @covers ::add_post_meta 18 * @covers ::wp_ajax_add_meta 16 19 */ 17 20 public function test_post_add_meta_empty_is_allowed_ajax() { 18 $p = self::factory()->post->create();21 $post = self::factory()->post->create(); 19 22 20 23 // Become an administrator. … … 22 25 23 26 $_POST = array( 24 'post_id' => $p ,27 'post_id' => $post, 25 28 'metakeyinput' => 'testkey', 26 29 'metavalue' => '', … … 35 38 } 36 39 37 $this->assertSame( '', get_post_meta( $p , 'testkey', true ) );40 $this->assertSame( '', get_post_meta( $post, 'testkey', true ) ); 38 41 } 39 42 40 43 /** 41 44 * @ticket 43559 45 * 46 * @covers ::update_metadata_by_mid 47 * @covers ::wp_ajax_add_meta 42 48 */ 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(); 45 51 46 $m = add_post_meta( $p, 'testkey', 'hello' );52 $meta_id = add_post_meta( $post, 'testkey', 'hello' ); 47 53 48 54 // Become an administrator. … … 51 57 $_POST = array( 52 58 '_ajax_nonce-add-meta' => wp_create_nonce( 'add-meta' ), 53 'post_id' => $p ,59 'post_id' => $post, 54 60 'meta' => array( 55 $m => array(61 $meta_id => array( 56 62 'key' => 'testkey', 57 63 'value' => '', … … 67 73 } 68 74 69 $this->assertSame( '', get_post_meta( $p , 'testkey', true ) );75 $this->assertSame( '', get_post_meta( $post, 'testkey', true ) ); 70 76 } 71 77 } -
trunk/tests/phpunit/tests/ajax/AddTag.php
r53159 r53561 17 17 * 18 18 * @ticket 42937 19 * 20 * @covers ::wp_ajax_add_tag 21 * @covers ::wp_insert_term 19 22 * 20 23 * @param array $post_data Data to populate $_POST. … … 91 94 /** 92 95 * @ticket 42937 96 * 97 * @covers ::wp_ajax_add_tag 93 98 */ 94 99 public function test_adding_category_without_capability_should_error() { … … 109 114 /** 110 115 * @ticket 42937 116 * 117 * @covers ::wp_ajax_add_tag 118 * @covers ::wp_insert_term 111 119 */ 112 120 public function test_adding_existing_category_should_error() { -
trunk/tests/phpunit/tests/ajax/Attachments.php
r51870 r53561 13 13 /** 14 14 * @ticket 36578 15 * 16 * @covers ::wp_ajax_send_attachment_to_editor 17 * @covers ::get_image_send_to_editor 15 18 */ 16 19 public function test_wp_ajax_send_attachment_to_editor_should_return_an_image() { … … 65 68 * @ticket 36578 66 69 * @group ms-excluded 70 * 71 * @covers ::wp_ajax_send_attachment_to_editor 67 72 */ 68 73 public function test_wp_ajax_send_attachment_to_editor_should_return_a_link() { 74 $this->skipWithMultisite(); 75 69 76 // Become an administrator. 70 77 $post = $_POST; -
trunk/tests/phpunit/tests/ajax/Autosave.php
r51451 r53561 44 44 /** 45 45 * Tests autosaving a post. 46 * 47 * @covers ::wp_ajax_heartbeat 46 48 */ 47 49 public function test_autosave_post() { … … 85 87 /** 86 88 * Tests autosaving a locked post. 89 * 90 * @covers ::wp_ajax_heartbeat 87 91 */ 88 92 public function test_autosave_locked_post() { … … 136 140 /** 137 141 * Tests with an invalid nonce. 142 * 143 * @covers ::wp_ajax_heartbeat 138 144 */ 139 145 public function test_with_invalid_nonce() { -
trunk/tests/phpunit/tests/ajax/Compression.php
r51462 r53561 18 18 /** 19 19 * Test as a logged out user 20 * 21 * @covers ::wp_ajax_wp_compression_test 20 22 */ 21 23 public function test_logged_out() { … … 33 35 /** 34 36 * Fetch the test text 37 * 38 * @covers ::wp_ajax_wp_compression_test 35 39 */ 36 40 public function test_text() { … … 57 61 * 58 62 * @requires function gzdeflate 63 * 64 * @covers ::wp_ajax_wp_compression_test 59 65 */ 60 66 public function test_gzdeflate() { … … 82 88 * 83 89 * @requires function gzencode 90 * 91 * @covers ::wp_ajax_wp_compression_test 84 92 */ 85 93 public function test_gzencode() { … … 105 113 /** 106 114 * Fetch the test text (unknown encoding) 115 * 116 * @covers ::wp_ajax_wp_compression_test 107 117 */ 108 118 public function test_unknown_encoding() { … … 123 133 /** 124 134 * Set the 'can_compress_scripts' site option to true 135 * 136 * @covers ::wp_ajax_wp_compression_test 125 137 */ 126 138 public function test_set_yes() { … … 161 173 /** 162 174 * Set the 'can_compress_scripts' site option to false 175 * 176 * @covers ::wp_ajax_wp_compression_test 163 177 */ 164 178 public function test_set_no() { -
trunk/tests/phpunit/tests/ajax/CustomizeManager.php
r52371 r53561 104 104 * 105 105 * @ticket 30937 106 * 106 107 * @covers WP_Customize_Manager::save 107 108 */ … … 271 272 * 272 273 * @ticket 30937 274 * 273 275 * @covers WP_Customize_Manager::save 274 276 */ … … 300 302 * 301 303 * @ticket 30937 304 * 302 305 * @covers WP_Customize_Manager::save 303 306 */ … … 339 342 * 340 343 * @ticket 38943 344 * 341 345 * @covers WP_Customize_Manager::save 342 346 */ … … 437 441 * 438 442 * @ticket 39896 443 * 439 444 * @covers WP_Customize_Manager::save 440 445 */ … … 483 488 * 484 489 * @ticket 39896 490 * 485 491 * @covers WP_Customize_Manager::handle_changeset_trash_request 486 492 */ -
trunk/tests/phpunit/tests/ajax/CustomizeMenus.php
r52010 r53561 80 80 * @param string $role The role we're checking caps against. 81 81 * @param array $expected_results Expected results. 82 * 83 * @covers WP_Customize_Nav_Menus::ajax_load_available_items 82 84 */ 83 85 public function test_ajax_load_available_items_cap_check( $role, $expected_results ) { … … 158 160 * @param array $post_args POST args. 159 161 * @param mixed $expected_results Expected results. 162 * 163 * @covers WP_Customize_Nav_Menus::ajax_load_available_items 160 164 */ 161 165 public function test_ajax_load_available_items_error_messages( $post_args, $expected_results ) { … … 268 272 * @param array $post_args POST args. 269 273 * @param array $success_status Success status. 274 * 275 * @covers WP_Customize_Nav_Menus::ajax_load_available_items 270 276 */ 271 277 public function test_ajax_load_available_items_success_status( $post_args, $success_status ) { … … 358 364 * 359 365 * @param array $post_args POST args. 366 * 367 * @covers WP_Customize_Nav_Menus::ajax_load_available_items 360 368 */ 361 369 public function test2_ajax_load_available_items_structure( $post_args ) { … … 467 475 * @param string $role Role. 468 476 * @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 469 480 */ 470 481 public function test_ajax_search_available_items_caps_check( $role, $expected_results ) { … … 546 557 * @param array $post_args POST args. 547 558 * @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 548 562 */ 549 563 public function test_ajax_search_available_items_results( $post_args, $expected_results ) { … … 639 653 * 640 654 * @covers WP_Customize_Nav_Menus::ajax_insert_auto_draft_post 655 * @covers WP_Customize_Nav_Menus::insert_auto_draft_post 641 656 */ 642 657 public function test_ajax_insert_auto_draft_post_success() { -
trunk/tests/phpunit/tests/ajax/DeleteComment.php
r51438 r53561 60 60 * @param WP_Comment $comment Comment object. 61 61 * @param string $action Action: 'trash', 'untrash', etc. 62 * 63 * @covers ::wp_ajax_delete_comment 64 * @covers ::_wp_ajax_delete_comment_response 62 65 */ 63 66 public function _test_as_admin( $comment, $action ) { … … 119 122 * @param WP_Comment $comment Comment object. 120 123 * @param string $action Action: 'trash', 'untrash', etc. 124 * 125 * @covers ::wp_ajax_delete_comment 121 126 */ 122 127 public function _test_as_subscriber( $comment, $action ) { … … 151 156 * @param WP_Comment $comment Comment object. 152 157 * @param string $action Action: 'trash', 'untrash', etc. 158 * 159 * @covers ::wp_ajax_delete_comment 153 160 */ 154 161 public function _test_with_bad_nonce( $comment, $action ) { … … 182 189 * @param WP_Comment $comment Comment object. 183 190 * @param string $action Action: 'trash', 'untrash', etc. 191 * 192 * @covers ::wp_ajax_delete_comment 184 193 */ 185 194 public function _test_with_bad_id( $comment, $action ) { … … 219 228 * @param WP_Comment $comment Comment object. 220 229 * @param string $action Action: 'trash', 'untrash', etc. 230 * 231 * @covers ::wp_ajax_delete_comment 221 232 */ 222 233 public function _test_double_action( $comment, $action ) { … … 264 275 /** 265 276 * Deletes a comment as an administrator (expects success). 277 * 278 * @covers ::wp_ajax_delete_comment 279 * @covers ::_wp_ajax_delete_comment_response 266 280 */ 267 281 public function test_ajax_comment_trash_actions_as_administrator() { … … 280 294 /** 281 295 * Deletes a comment as a subscriber (expects permission denied). 296 * 297 * @covers ::wp_ajax_delete_comment 282 298 */ 283 299 public function test_ajax_comment_trash_actions_as_subscriber() { … … 296 312 /** 297 313 * Deletes a comment with no ID. 314 * 315 * @covers ::wp_ajax_delete_comment 316 * @covers ::_wp_ajax_delete_comment_response 298 317 */ 299 318 public function test_ajax_trash_comment_no_id() { … … 312 331 /** 313 332 * Deletes a comment with a bad nonce. 333 * 334 * @covers ::wp_ajax_delete_comment 314 335 */ 315 336 public function test_ajax_trash_comment_bad_nonce() { … … 328 349 /** 329 350 * Tests trashing an already trashed comment, etc. 351 * 352 * @covers ::wp_ajax_delete_comment 330 353 */ 331 354 public function test_ajax_trash_double_action() { -
trunk/tests/phpunit/tests/ajax/DeletePlugin.php
r51870 r53561 9 9 * 10 10 * @group ajax 11 * 12 * @covers ::wp_ajax_delete_plugin 11 13 */ 12 14 class Tests_Ajax_Delete_Plugin extends WP_Ajax_UnitTestCase { … … 128 130 /** 129 131 * @group ms-excluded 132 * 133 * @covers ::wp_ajax_delete_plugin 134 * @covers ::delete_plugins 130 135 */ 131 136 public function test_delete_plugin() { -
trunk/tests/phpunit/tests/ajax/DimComment.php
r51568 r53561 13 13 * @since 3.4.0 14 14 * @group ajax 15 * 16 * @covers ::wp_ajax_dim_comment 15 17 */ 16 18 class Tests_Ajax_DimComment extends WP_Ajax_UnitTestCase { -
trunk/tests/phpunit/tests/ajax/EditComment.php
r52010 r53561 13 13 * @since 3.4.0 14 14 * @group ajax 15 * 16 * @covers ::wp_ajax_edit_comment 15 17 */ 16 18 class Tests_Ajax_EditComment extends WP_Ajax_UnitTestCase { -
trunk/tests/phpunit/tests/ajax/GetComments.php
r49603 r53561 13 13 * @since 3.4.0 14 14 * @group ajax 15 * 16 * @covers ::wp_ajax_get_comments 15 17 */ 16 18 class Tests_Ajax_GetComments extends WP_Ajax_UnitTestCase { -
trunk/tests/phpunit/tests/ajax/ManageThemes.php
r52010 r53561 9 9 * 10 10 * @group ajax 11 * 12 * @covers ::wp_ajax_update_theme 11 13 */ 12 14 class Tests_Ajax_Manage_Themes extends WP_Ajax_UnitTestCase { -
trunk/tests/phpunit/tests/ajax/MediaEdit.php
r51568 r53561 28 28 /** 29 29 * @ticket 22985 30 * @requires function imagejpeg 31 * 32 * @covers ::wp_insert_attachment 33 * @covers ::wp_save_image 30 34 */ 31 35 public function testCropImageThumbnail() { … … 57 61 /** 58 62 * @ticket 32171 63 * @requires function imagejpeg 64 * 65 * @covers ::wp_insert_attachment 66 * @covers ::wp_save_image 59 67 */ 60 68 public function testImageEditOverwriteConstant() { -
trunk/tests/phpunit/tests/ajax/QuickEdit.php
r48939 r53561 15 15 /** 16 16 * @ticket 26948 17 * 18 * @covers ::wp_ajax_inline_save 19 * @covers ::edit_post 17 20 */ 18 21 public function test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit() { -
trunk/tests/phpunit/tests/ajax/ReplytoComment.php
r53337 r53561 13 13 * @since 3.4.0 14 14 * @group ajax 15 * 16 * @covers ::wp_ajax_replyto_comment 15 17 */ 16 18 class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase { … … 187 189 // Make the request. 188 190 $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.' ); 190 192 $this->_handleAjax( 'replyto-comment' ); 191 193 } -
trunk/tests/phpunit/tests/ajax/Response.php
r51568 r53561 7 7 * @since 3.5.0 8 8 * @group ajax 9 * 10 * @covers WP_Ajax_Response::send 9 11 */ 10 12 class Tests_Ajax_Response extends WP_UnitTestCase { -
trunk/tests/phpunit/tests/ajax/TagSearch.php
r49603 r53561 13 13 * @since 3.4.0 14 14 * @group ajax 15 * 16 * @covers ::wp_ajax_ajax_tag_search 15 17 */ 16 18 class Tests_Ajax_TagSearch extends WP_Ajax_UnitTestCase { -
trunk/tests/phpunit/tests/ajax/UpdatePlugin.php
r51870 r53561 9 9 * 10 10 * @group ajax 11 * 12 * @covers ::wp_ajax_update_plugin 11 13 */ 12 14 class Tests_Ajax_Update_Plugin extends WP_Ajax_UnitTestCase {
Note: See TracChangeset
for help on using the changeset viewer.