Ticket #39265: root.2.patch
File root.2.patch, 260.0 KB (added by , 3 years ago) |
---|
-
tests/phpunit/tests/actions.php
7 7 */ 8 8 class Tests_Actions extends WP_UnitTestCase { 9 9 10 /** 11 * 12 * @covers ::do_action 13 */ 10 14 function test_simple_action() { 11 15 $a = new MockAction(); 12 16 $tag = __FUNCTION__; … … 24 28 $this->assertEquals( array( '' ), $args ); 25 29 } 26 30 31 /** 32 * @covers ::remove_action 33 */ 27 34 function test_remove_action() { 28 35 $a = new MockAction(); 29 36 $tag = __FUNCTION__; … … 43 50 44 51 } 45 52 53 /** 54 * @covers ::has_action 55 */ 46 56 function test_has_action() { 47 57 $tag = __FUNCTION__; 48 58 $func = __FUNCTION__ . '_func'; … … 57 67 $this->assertFalse( has_action( $tag ) ); 58 68 } 59 69 60 // One tag with multiple actions. 70 /** 71 * One tag with multiple actions. 72 * 73 * @covers ::add_action 74 */ 61 75 function test_multiple_actions() { 62 76 $a1 = new MockAction(); 63 77 $a2 = new MockAction(); … … 74 88 $this->assertEquals( 1, $a2->get_call_count() ); 75 89 } 76 90 91 /** 92 * One tag with multiple actions. 93 * 94 * @covers ::do_action 95 */ 77 96 function test_action_args_1() { 78 97 $a = new MockAction(); 79 98 $tag = __FUNCTION__; … … 89 108 $this->assertEquals( array( $val ), array_pop( $argsvar ) ); 90 109 } 91 110 111 /** 112 * One tag with multiple actions. 113 * 114 * @covers ::do_action 115 */ 92 116 function test_action_args_2() { 93 117 $a1 = new MockAction(); 94 118 $a2 = new MockAction(); … … 120 144 * 121 145 * @see https://core.trac.wordpress.org/ticket/17817#comment:72 122 146 * @ticket 17817 147 * 148 * @covers ::do_action 123 149 */ 124 150 function test_action_args_3() { 125 151 $a1 = new MockAction(); … … 157 183 * Tests PHP 4 notation for calling actions while passing in an object by reference. 158 184 * 159 185 * @ticket 48312 186 * 187 * @covers ::do_action 160 188 */ 161 189 function test_action_args_with_php4_syntax() { 162 190 $a = new MockAction(); … … 201 229 $this->assertEquals( $expected, $a->get_events() ); 202 230 } 203 231 232 /** 233 * @covers ::did_action 234 */ 204 235 function test_did_action() { 205 236 $tag1 = 'action1'; 206 237 $tag2 = 'action2'; … … 222 253 223 254 } 224 255 256 /** 257 * @covers ::add_action 258 */ 225 259 function test_all_action() { 226 260 $a = new MockAction(); 227 261 $tag1 = __FUNCTION__ . '_1'; … … 246 280 247 281 } 248 282 283 /** 284 * @covers ::remove_action 285 */ 249 286 function test_remove_all_action() { 250 287 $a = new MockAction(); 251 288 $tag = __FUNCTION__; … … 266 303 $this->assertEquals( array( $tag ), $a->get_tags() ); 267 304 } 268 305 306 /** 307 * @covers ::do_action_ref_array 308 */ 269 309 function test_action_ref_array() { 270 310 $obj = new stdClass(); 271 311 $a = new MockAction(); … … 284 324 285 325 /** 286 326 * @ticket 11241 327 * 328 * @covers ::add_action 287 329 */ 288 330 function test_action_keyed_array() { 289 331 $a = new MockAction(); … … 309 351 310 352 } 311 353 354 /** 355 * @covers ::do_action 356 */ 312 357 function test_action_self_removal() { 313 358 add_action( 'test_action_self_removal', array( $this, 'action_self_removal' ) ); 314 359 do_action( 'test_action_self_removal' ); … … 321 366 322 367 /** 323 368 * @ticket 17817 369 * 370 * @covers ::do_action 324 371 */ 325 372 function test_action_recursion() { 326 373 $tag = __FUNCTION__; … … 336 383 $this->assertEquals( 2, $b->get_call_count(), 'recursive actions should call callbacks with later priority' ); 337 384 } 338 385 386 /** 387 * @covers ::do_action 388 */ 339 389 function action_that_causes_recursion( $tag ) { 340 390 static $recursing = false; 341 391 if ( ! $recursing ) { … … 348 398 /** 349 399 * @ticket 9968 350 400 * @ticket 17817 401 * 402 * @covers ::add_action 351 403 */ 352 404 function test_action_callback_manipulation_while_running() { 353 405 $tag = __FUNCTION__; … … 383 435 * 384 436 * This specificaly addresses the concern raised at 385 437 * https://core.trac.wordpress.org/ticket/17817#comment:52 438 * 439 * @covers ::remove_filter 386 440 */ 387 441 function test_remove_anonymous_callback() { 388 442 $tag = __FUNCTION__; … … 416 470 * Test the ArrayAccess methods of WP_Hook 417 471 * 418 472 * @ticket 17817 473 * 474 * @covers ::has_action 419 475 */ 420 476 function test_array_access_of_wp_filter_global() { 421 477 global $wp_filter; … … 442 498 * Make sure current_action() behaves as current_filter() 443 499 * 444 500 * @ticket 14994 501 * 502 * @covers ::current_action 445 503 */ 446 504 function test_current_action() { 447 505 global $wp_current_filter; … … 453 511 454 512 /** 455 513 * @ticket 14994 514 * 515 * @covers ::doing_filter 456 516 */ 457 517 function test_doing_filter() { 458 518 global $wp_current_filter; … … 472 532 473 533 /** 474 534 * @ticket 14994 535 * 536 * @covers ::doing_filter 475 537 */ 476 538 function test_doing_action() { 477 539 global $wp_current_filter; … … 491 553 492 554 /** 493 555 * @ticket 14994 556 * 557 * @covers ::doing_filter 494 558 */ 495 559 function test_doing_filter_real() { 496 560 $this->assertFalse( doing_filter() ); // No filter is passed in, and no filter is being processed. … … 509 573 $this->assertFalse( doing_filter( 'testing' ) ); // No longer doing this filter. 510 574 } 511 575 576 /** 577 * @covers ::doing_filter 578 */ 512 579 function apply_testing_filter() { 513 580 $this->apply_testing_filter = true; 514 581 … … 530 597 $this->assertFalse( doing_filter( 'testing_nested' ) ); 531 598 } 532 599 600 /** 601 * @covers ::doing_filter 602 */ 533 603 function apply_testing_nested_filter() { 534 604 $this->apply_testing_nested_filter = true; 535 605 $this->assertTrue( doing_filter() ); … … 541 611 /** 542 612 * @ticket 10441 543 613 * @expectedDeprecated tests_do_action_deprecated 614 * 615 * @covers ::do_action_deprecated 544 616 */ 545 617 public function test_do_action_deprecated() { 546 618 $p = new WP_Post( (object) array( 'post_title' => 'Foo' ) ); … … 559 631 /** 560 632 * @ticket 10441 561 633 * @expectedDeprecated tests_do_action_deprecated 634 * 635 * @covers ::do_action_deprecated 562 636 */ 563 637 public function test_do_action_deprecated_with_multiple_params() { 564 638 $p1 = new WP_Post( (object) array( 'post_title' => 'Foo1' ) ); -
tests/phpunit/tests/adminbar.php
31 31 32 32 /** 33 33 * @ticket 21117 34 * 35 * @covers WP_Admin_Bar::get_nodes 34 36 */ 35 37 function test_content_post_type() { 36 38 wp_set_current_user( self::$editor_id ); … … 50 52 51 53 /** 52 54 * @ticket 21117 55 * 56 * @covers WP_Admin_Bar::add_node 53 57 */ 54 58 function test_merging_existing_meta_values() { 55 59 wp_set_current_user( self::$editor_id ); … … 86 90 /** 87 91 * @ticket 25162 88 92 * @group ms-excluded 93 * 94 * @covers ::_wp_admin_bar_init 89 95 */ 90 96 public function test_admin_bar_contains_correct_links_for_users_with_no_role() { 91 97 $this->assertFalse( user_can( self::$no_role_id, 'read' ) ); … … 111 117 /** 112 118 * @ticket 25162 113 119 * @group ms-excluded 120 * 121 * @covers ::_wp_admin_bar_init 114 122 */ 115 123 public function test_admin_bar_contains_correct_links_for_users_with_role() { 116 124 $this->assertTrue( user_can( self::$editor_id, 'read' ) ); … … 139 147 * @ticket 25162 140 148 * @group multisite 141 149 * @group ms-required 150 * 151 * @covers ::_wp_admin_bar_init 142 152 */ 143 153 public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_blog() { 144 154 $blog_id = self::factory()->blog->create( … … 188 198 * @ticket 25162 189 199 * @group multisite 190 200 * @group ms-required 201 * 202 * @covers ::_wp_admin_bar_init 191 203 */ 192 204 public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_network() { 193 205 $this->assertTrue( user_can( self::$admin_id, 'read' ) ); … … 239 251 restore_current_blog(); 240 252 } 241 253 254 /** 255 * @return mixed 256 */ 242 257 protected function get_standard_admin_bar() { 243 258 global $wp_admin_bar; 244 259 … … 259 274 * 260 275 * @param array $node_data The data for a node, passed to `WP_Admin_Bar::add_node()`. 261 276 * @param string $expected_html The expected HTML when admin menu is rendered. 277 * 278 * @covers WP_Admin_Bar::add_node 262 279 */ 263 280 public function test_admin_bar_with_tabindex_meta( $node_data, $expected_html ) { 264 281 $admin_bar = new WP_Admin_Bar(); … … 347 364 348 365 /** 349 366 * @ticket 22247 367 * 368 * @covers ::_wp_admin_bar_init 369 * @covers WP_Admin_Bar::get_node 350 370 */ 351 371 public function test_admin_bar_has_edit_link_for_existing_posts() { 352 372 wp_set_current_user( self::$editor_id ); … … 374 394 375 395 /** 376 396 * @ticket 22247 397 * 398 * @covers WP_Admin_Bar::get_node 377 399 */ 378 400 public function test_admin_bar_has_no_edit_link_for_non_existing_posts() { 379 401 wp_set_current_user( self::$editor_id ); … … 393 415 394 416 /** 395 417 * @ticket 34113 418 * 419 * @covers WP_Admin_Bar::get_node 396 420 */ 397 421 public function test_admin_bar_has_no_archives_link_if_no_static_front_page() { 398 422 set_current_screen( 'edit-post' ); … … 407 431 408 432 /** 409 433 * @ticket 34113 434 * 435 * @covers WP_Admin_Bar::get_node 410 436 */ 411 437 public function test_admin_bar_contains_view_archive_link_if_static_front_page() { 412 438 update_option( 'show_on_front', 'page' ); … … 422 448 423 449 /** 424 450 * @ticket 34113 451 * 452 * @covers WP_Admin_Bar::get_node 425 453 */ 426 454 public function test_admin_bar_has_no_archives_link_for_pages() { 427 455 set_current_screen( 'edit-page' ); … … 437 465 /** 438 466 * @ticket 37949 439 467 * @group ms-excluded 468 * 469 * @covers WP_Admin_Bar::get_node 440 470 */ 441 471 public function test_admin_bar_contains_correct_about_link_for_users_with_role() { 442 472 wp_set_current_user( self::$editor_id ); … … 454 484 /** 455 485 * @ticket 37949 456 486 * @group ms-excluded 487 * 488 * @covers WP_Admin_Bar::get_node 457 489 */ 458 490 public function test_admin_bar_contains_correct_about_link_for_users_with_no_role() { 459 491 wp_set_current_user( self::$no_role_id ); … … 473 505 * @ticket 37949 474 506 * @group multisite 475 507 * @group ms-required 508 * 509 * @covers WP_Admin_Bar::get_node 476 510 */ 477 511 public function test_admin_bar_contains_correct_about_link_for_users_with_no_role_in_multisite() { 478 512 // User is not a member of a site. … … 492 526 493 527 /** 494 528 * @ticket 34113 529 * 530 * @covers WP_Admin_Bar::get_node 495 531 */ 496 532 public function test_admin_bar_has_no_archives_link_for_non_public_cpt() { 497 533 register_post_type( … … 516 552 517 553 /** 518 554 * @ticket 34113 555 * 556 * @covers WP_Admin_Bar::get_node 519 557 */ 520 558 public function test_admin_bar_has_no_archives_link_for_cpt_without_archive() { 521 559 register_post_type( … … 540 578 541 579 /** 542 580 * @ticket 34113 581 * 582 * @covers WP_Admin_Bar::get_node 543 583 */ 544 584 public function test_admin_bar_has_no_archives_link_for_cpt_not_shown_in_admin_bar() { 545 585 register_post_type( … … 596 636 597 637 /** 598 638 * @ticket 39252 639 * 640 * @covers WP_Admin_Bar::get_node 599 641 */ 600 642 public function test_new_user_link_exists_for_user_with_create_users() { 601 643 wp_set_current_user( self::$admin_id ); … … 615 657 616 658 /** 617 659 * @ticket 39252 660 * 661 * @covers WP_Admin_Bar::get_node 618 662 */ 619 663 public function test_new_user_link_existence_for_user_with_promote_users() { 620 664 wp_set_current_user( self::$admin_id ); … … 638 682 639 683 /** 640 684 * @ticket 39252 685 * 686 * @covers WP_Admin_Bar::get_node 641 687 */ 642 688 public function test_new_user_link_does_not_exist_for_user_without_create_or_promote_users() { 643 689 wp_set_current_user( self::$admin_id ); … … 657 703 /** 658 704 * @ticket 30937 659 705 * @covers ::wp_admin_bar_customize_menu 706 * 707 * @covers WP_Admin_Bar::get_node 660 708 */ 661 709 public function test_customize_link() { 662 710 global $wp_customize; … … 694 742 /** 695 743 * @ticket 39082 696 744 * @group ms-required 745 * 746 * @covers WP_Admin_Bar::get_nodes 697 747 */ 698 748 public function test_my_sites_network_menu_for_regular_user() { 699 749 wp_set_current_user( self::$editor_id ); … … 709 759 /** 710 760 * @ticket 39082 711 761 * @group ms-required 762 * 763 * @covers WP_Admin_Bar::get_nodes 712 764 */ 713 765 public function test_my_sites_network_menu_for_super_admin() { 714 766 wp_set_current_user( self::$editor_id ); … … 726 778 /** 727 779 * @ticket 39082 728 780 * @group ms-required 781 * 782 * @covers WP_Admin_Bar::get_nodes 729 783 */ 730 784 public function test_my_sites_network_menu_for_regular_user_with_network_caps() { 731 785 global $current_user; -
tests/phpunit/tests/auth.php
35 35 wp_set_current_user( self::$user_id ); 36 36 } 37 37 38 /** 39 * @covers ::wp_validate_auth_cookie 40 */ 38 41 function test_auth_cookie_valid() { 39 42 $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'auth' ); 40 43 $this->assertEquals( self::$user_id, wp_validate_auth_cookie( $cookie, 'auth' ) ); 41 44 } 42 45 46 /** 47 * @covers ::wp_validate_auth_cookie 48 */ 43 49 function test_auth_cookie_invalid() { 44 50 // 3600 or less and +3600 may occur in wp_validate_auth_cookie(), 45 51 // as an ajax test may have defined DOING_AJAX, failing the test. … … 56 62 $this->assertEquals( false, wp_validate_auth_cookie( self::$user_id, 'auth' ), 'altered cookie' ); 57 63 } 58 64 65 /** 66 * @covers ::wp_validate_auth_cookie 67 */ 59 68 function test_auth_cookie_scheme() { 60 69 // Arbitrary scheme name. 61 70 $cookie = wp_generate_auth_cookie( self::$user_id, time() + 3600, 'foo' ); … … 68 77 69 78 /** 70 79 * @ticket 23494 80 * 81 * @covers ::wp_authenticate 71 82 */ 72 83 function test_password_trimming() { 73 84 $passwords_to_test = array( … … 93 104 * wp_hash_password function 94 105 * 95 106 * @ticket 24973 107 * 108 * @covers ::wp_hash_password 96 109 */ 97 110 function test_wp_hash_password_trimming() { 98 111 99 112 $password = ' pass with leading whitespace'; 100 $this->assertTrue( wp_check_password( 'pass with leading whitespace', wp_hash_password( $password ) ) );113 $this->assertTrue( wp_check_password( 'pass with leading whitespace', ( $password ) ) ); 101 114 102 115 $password = 'pass with trailing whitespace '; 103 116 $this->assertTrue( wp_check_password( 'pass with trailing whitespace', wp_hash_password( $password ) ) ); … … 114 127 115 128 /** 116 129 * @ticket 29217 130 * 131 * @covers ::wp_verify_nonce 117 132 */ 118 133 function test_wp_verify_nonce_with_empty_arg() { 119 134 $this->assertFalse( wp_verify_nonce( '' ) ); … … 122 137 123 138 /** 124 139 * @ticket 29542 140 * 141 * @covers ::wp_verify_nonce 125 142 */ 126 143 function test_wp_verify_nonce_with_integer_arg() { 127 144 $this->assertFalse( wp_verify_nonce( 1 ) ); … … 129 146 130 147 /** 131 148 * @ticket 24030 149 * 150 * @covers ::wp_verify_nonce 132 151 */ 133 152 function test_wp_nonce_verify_failed() { 134 153 $nonce = substr( md5( uniqid() ), 0, 10 ); … … 141 160 142 161 /** 143 162 * @ticket 24030 163 * 164 * @covers ::wp_verify_nonce 144 165 */ 145 166 function test_wp_nonce_verify_success() { 146 167 $nonce = wp_create_nonce( 'nonce_test_action' ); … … 153 174 154 175 /** 155 176 * @ticket 36361 177 * 178 * @covers ::check_admin_referer 156 179 */ 157 180 public function test_check_admin_referer_with_no_action_triggers_doing_it_wrong() { 158 181 $this->setExpectedIncorrectUsage( 'check_admin_referer' ); … … 165 188 unset( $_REQUEST['_wpnonce'] ); 166 189 } 167 190 191 /** 192 * @covers ::check_admin_referer 193 */ 168 194 public function test_check_admin_referer_with_default_action_as_string_not_doing_it_wrong() { 169 195 // A valid nonce needs to be set so the check doesn't die(). 170 196 $_REQUEST['_wpnonce'] = wp_create_nonce( '-1' ); … … 176 202 177 203 /** 178 204 * @ticket 36361 205 /** 206 * 207 * @c * 208 * @covers ::check_ajax_referer 179 209 */ 180 210 public function test_check_ajax_referer_with_no_action_triggers_doing_it_wrong() { 181 211 $this->setExpectedIncorrectUsage( 'check_ajax_referer' ); … … 188 218 unset( $_REQUEST['_wpnonce'] ); 189 219 } 190 220 221 /** 222 * @covers ::wp_authenticate 223 */ 191 224 function test_password_length_limit() { 192 225 $limit = str_repeat( 'a', 4096 ); 193 226 … … 237 270 238 271 /** 239 272 * @ticket 45746 273 * 274 * @covers ::check_password_reset_key 240 275 */ 241 276 function test_user_activation_key_is_saved() { 242 277 $user = get_userdata( $this->user->ID ); … … 251 286 252 287 /** 253 288 * @ticket 32429 289 * 290 * @covers ::check_password_reset_key 254 291 */ 255 292 function test_user_activation_key_is_checked() { 256 293 global $wpdb; … … 289 326 290 327 /** 291 328 * @ticket 32429 329 * 330 * @covers ::check_password_reset_key 292 331 */ 293 332 function test_expired_user_activation_key_is_rejected() { 294 333 global $wpdb; … … 312 351 313 352 /** 314 353 * @ticket 32429 354 * 355 * @covers ::check_password_reset_key 315 356 */ 316 357 function test_empty_user_activation_key_fails_key_check() { 317 358 // An empty user_activation_key should not allow any key to be accepted. … … 325 366 326 367 /** 327 368 * @ticket 32429 369 * 370 * @covers ::check_password_reset_key 328 371 */ 329 372 function test_legacy_user_activation_key_is_rejected() { 330 373 global $wpdb; … … 355 398 /** 356 399 * @ticket 32429 357 400 * @ticket 24783 401 * 402 * @covers ::check_password_reset_key 358 403 */ 359 404 function test_plaintext_user_activation_key_is_rejected() { 360 405 global $wpdb; … … 386 431 * Ensure users can log in using both their username and their email address. 387 432 * 388 433 * @ticket 9568 434 * 435 * @covers ::wp_authenticate 389 436 */ 390 437 public function test_log_in_using_email() { 391 438 $user_args = array( … … 401 448 402 449 /** 403 450 * @ticket 38744 451 * 452 * @covers ::wp_signon 404 453 */ 405 454 public function test_wp_signon_using_email_with_an_apostrophe() { 406 455 $user_args = array( -
tests/phpunit/tests/avatar.php
8 8 class Tests_Avatar extends WP_UnitTestCase { 9 9 /** 10 10 * @ticket 21195 11 * 12 * @covers ::get_avatar_url 11 13 */ 12 14 public function test_get_avatar_url_gravatar_url() { 13 15 $url = get_avatar_url( 1 ); … … 16 18 17 19 /** 18 20 * @ticket 21195 21 * 22 * @covers ::get_avatar_url 19 23 */ 20 24 public function test_get_avatar_url_size() { 21 25 $url = get_avatar_url( 1 ); … … 28 32 29 33 /** 30 34 * @ticket 21195 35 * 36 * @covers ::get_avatar_url 31 37 */ 32 38 public function test_get_avatar_url_default() { 33 39 $url = get_avatar_url( 1 ); … … 45 51 46 52 /** 47 53 * @ticket 21195 54 * 55 * @covers ::get_avatar_url 48 56 */ 49 57 public function test_get_avatar_url_rating() { 50 58 $url = get_avatar_url( 1 ); … … 57 65 58 66 /** 59 67 * @ticket 21195 68 * 69 * @covers ::get_avatar_url 60 70 */ 61 71 public function test_get_avatar_url_scheme() { 62 72 $url = get_avatar_url( 1 ); … … 73 83 74 84 /** 75 85 * @ticket 21195 86 * 87 * @covers ::get_avatar_url 76 88 */ 77 89 public function test_get_avatar_url_user() { 78 90 $url = get_avatar_url( 1 ); … … 106 118 protected $fake_url; 107 119 /** 108 120 * @ticket 21195 121 * 122 * @covers ::get_avatar_url 109 123 */ 110 124 public function test_pre_get_avatar_url_filter() { 111 125 $this->fake_url = 'haha wat'; … … 116 130 117 131 $this->assertEquals( $url, $this->fake_url ); 118 132 } 133 119 134 public function pre_get_avatar_url_filter( $args ) { 120 135 $args['url'] = $this->fake_url; 121 136 return $args; … … 123 138 124 139 /** 125 140 * @ticket 21195 141 * 142 * @covers ::get_avatar_url 126 143 */ 127 144 public function test_get_avatar_url_filter() { 128 145 $this->fake_url = 'omg lol'; … … 139 156 140 157 /** 141 158 * @ticket 21195 159 * 160 * @covers ::get_avatar_url 142 161 */ 143 162 public function test_get_avatar_comment_types_filter() { 144 163 $url = get_avatar_url( 1 ); … … 167 186 return $comment_types; 168 187 } 169 188 189 /** 190 * @covers ::get_avatar 191 */ 170 192 public function test_get_avatar() { 171 193 $img = get_avatar( 1 ); 172 194 $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' srcset='[^']*' class='[^']*' height='[^']*' width='[^']*' loading='lazy'/>$|", $img ), 1 ); 173 195 } 174 196 197 /** 198 * @covers ::get_avatar 199 */ 175 200 public function test_get_avatar_size() { 176 201 $size = '100'; 177 202 $img = get_avatar( 1, $size ); … … 178 203 $this->assertEquals( preg_match( "|^<img .*height='$size'.*width='$size'|", $img ), 1 ); 179 204 } 180 205 206 /** 207 * @covers ::get_avatar 208 */ 181 209 public function test_get_avatar_alt() { 182 210 $alt = 'Mr Hyde'; 183 211 $img = get_avatar( 1, 96, '', $alt ); … … 184 212 $this->assertEquals( preg_match( "|^<img alt='$alt'|", $img ), 1 ); 185 213 } 186 214 215 /** 216 * @covers ::get_avatar 217 */ 187 218 public function test_get_avatar_class() { 188 219 $class = 'first'; 189 220 $img = get_avatar( 1, 96, '', '', array( 'class' => $class ) ); … … 190 221 $this->assertEquals( preg_match( "|^<img .*class='[^']*{$class}[^']*'|", $img ), 1 ); 191 222 } 192 223 224 /** 225 * @covers ::get_avatar 226 */ 193 227 public function test_get_avatar_default_class() { 194 228 $img = get_avatar( 1, 96, '', '', array( 'force_default' => true ) ); 195 229 $this->assertEquals( preg_match( "|^<img .*class='[^']*avatar-default[^']*'|", $img ), 1 ); 196 230 } 197 231 232 /** 233 * @covers ::get_avatar 234 */ 198 235 public function test_get_avatar_force_display() { 199 236 $old = get_option( 'show_avatars' ); 200 237 update_option( 'show_avatars', false ); … … 210 247 protected $fake_img; 211 248 /** 212 249 * @ticket 21195 250 * 251 * @covers ::get_avatar 213 252 */ 214 253 public function test_pre_get_avatar_filter() { 215 254 $this->fake_img = 'YOU TOO?!'; … … 226 265 227 266 /** 228 267 * @ticket 21195 268 * 269 * @covers ::get_avatar 229 270 */ 230 271 public function test_get_avatar_filter() { 231 272 $this->fake_url = 'YA RLY'; … … 244 285 * The `get_avatar_data()` function should return gravatar url when comment type allowed to retrieve avatars. 245 286 * 246 287 * @ticket 44033 288 * 289 * @covers ::is_avatar_comment_type 290 * @covers ::get_avatar 247 291 */ 248 292 public function test_get_avatar_data_should_return_gravatar_url_when_input_avatar_comment_type() { 249 293 $comment_type = 'comment'; … … 264 308 * The `get_avatar_data()` function should return invalid url when comment type not allowed to retrieve avatars. 265 309 * 266 310 * @ticket 44033 311 * 312 * @covers ::is_avatar_comment_type 313 * @covers ::get_avatar 267 314 */ 268 315 public function test_get_avatar_data_should_return_invalid_url_when_input_not_avatar_comment_type() { 269 316 $comment_type = 'review'; -
tests/phpunit/tests/basic.php
3 3 /** 4 4 * just make sure the test framework is working 5 5 * 6 * No Covers as this checks for content in files 7 * 6 8 * @group testsuite 7 9 */ 8 10 class Tests_Basic extends WP_UnitTestCase { 9 11 12 /** 13 * @coversNothing 14 */ 10 15 function test_license() { 11 16 // This test is designed to only run on trunk/master. 12 17 $this->skipOnAutomatedBranches(); … … 17 22 $this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." ); 18 23 } 19 24 25 /** 26 * @coversNothing 27 */ 20 28 function test_security_md() { 21 29 // This test is designed to only run on trunk/master. 22 30 $this->skipOnAutomatedBranches(); … … 28 36 $this->assertEquals( $latest_stable, trim( $matches[0] ), "SECURITY.md's version needs to be updated to $latest_stable." ); 29 37 } 30 38 39 /** 40 * @coversNothing 41 */ 31 42 function test_package_json() { 32 43 $package_json = file_get_contents( dirname( ABSPATH ) . '/package.json' ); 33 44 $package_json = json_decode( $package_json, true ); … … 42 53 43 54 /** 44 55 * @depends test_package_json 56 * 57 * @coversNothing 45 58 */ 46 59 function test_package_json_node_engine( $package_json ) { 47 60 $this->assertArrayHasKey( 'engines', $package_json ); … … 50 63 $this->assertRegExp( '~^=?\d+\.\d+\.\d+$~', $node, "package.json's node version cannot be a range." ); 51 64 } 52 65 53 // Test some helper utility functions. 54 66 /** 67 * Test some helper utility functions. 68 * 69 * @coversNothing 70 */ 55 71 function test_strip_ws() { 56 72 $this->assertEquals( '', strip_ws( '' ) ); 57 73 $this->assertEquals( 'foo', strip_ws( 'foo' ) ); … … 79 95 80 96 } 81 97 98 /** 99 * @coversNothing 100 */ 82 101 function test_mask_input_value() { 83 102 $in = <<<EOF 84 103 <h2>Assign Authors</h2> -
tests/phpunit/tests/cache.php
26 26 return $cache; 27 27 } 28 28 29 /** 30 * 31 * @covers WP_Object_Cache::test_miss 32 */ 29 33 function test_miss() { 30 34 $this->assertEquals( null, $this->cache->get( 'test_miss' ) ); 31 35 } 32 36 37 /** 38 * 39 * @covers WP_Object_Cache::add 40 */ 33 41 function test_add_get() { 34 42 $key = __FUNCTION__; 35 43 $val = 'val'; … … 38 46 $this->assertEquals( $val, $this->cache->get( $key ) ); 39 47 } 40 48 49 /** 50 * 51 * @covers WP_Object_Cache::add 52 */ 41 53 function test_add_get_0() { 42 54 $key = __FUNCTION__; 43 55 $val = 0; … … 47 59 $this->assertEquals( $val, $this->cache->get( $key ) ); 48 60 } 49 61 62 /** 63 * 64 * @covers WP_Object_Cache::add 65 */ 50 66 function test_add_get_null() { 51 67 $key = __FUNCTION__; 52 68 $val = null; … … 56 72 $this->assertEquals( '', $this->cache->get( $key ) ); 57 73 } 58 74 75 /** 76 * 77 * @covers WP_Object_Cache::add 78 */ 59 79 function test_add() { 60 80 $key = __FUNCTION__; 61 81 $val1 = 'val1'; … … 69 89 $this->assertEquals( $val1, $this->cache->get( $key ) ); 70 90 } 71 91 92 /** 93 * 94 * @covers WP_Object_Cache::replace 95 */ 72 96 function test_replace() { 73 97 $key = __FUNCTION__; 74 98 $val = 'val1'; … … 83 107 $this->assertEquals( $val2, $this->cache->get( $key ) ); 84 108 } 85 109 110 /** 111 * 112 * @covers WP_Object_Cache::set 113 */ 86 114 function test_set() { 87 115 $key = __FUNCTION__; 88 116 $val1 = 'val1'; … … 96 124 $this->assertEquals( $val2, $this->cache->get( $key ) ); 97 125 } 98 126 127 /** 128 * 129 * @covers WP_Object_Cache::flush 130 */ 99 131 function test_flush() { 100 132 global $_wp_using_ext_object_cache; 101 133 … … 114 146 $this->assertFalse( $this->cache->get( $key ) ); 115 147 } 116 148 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 */ 118 155 function test_object_refs() { 119 156 $key = __FUNCTION__ . '_1'; 120 157 $object_a = new stdClass; … … 137 174 $this->assertEquals( 'bravo', $object_a->foo ); 138 175 } 139 176 177 /** 178 * 179 * @covers WP_Object_Cache::incr 180 */ 140 181 function test_incr() { 141 182 $key = __FUNCTION__; 142 183 … … 150 191 $this->assertEquals( 3, $this->cache->get( $key ) ); 151 192 } 152 193 194 /** 195 * 196 * @covers ::wp_cache_incr 197 */ 153 198 function test_wp_cache_incr() { 154 199 $key = __FUNCTION__; 155 200 … … 163 208 $this->assertEquals( 3, wp_cache_get( $key ) ); 164 209 } 165 210 211 /** 212 * 213 * @covers WP_Object_Cache::decr 214 */ 166 215 function test_decr() { 167 216 $key = __FUNCTION__; 168 217 … … 182 231 183 232 /** 184 233 * @ticket 21327 234 * 235 * @covers ::wp_cache_decr 185 236 */ 186 237 function test_wp_cache_decr() { 187 238 $key = __FUNCTION__; … … 200 251 $this->assertEquals( 0, wp_cache_get( $key ) ); 201 252 } 202 253 254 /** 255 * 256 * @covers WP_Object_Cache::delete 257 */ 203 258 function test_delete() { 204 259 $key = __FUNCTION__; 205 260 $val = 'val'; … … 215 270 $this->assertFalse( $this->cache->delete( $key, 'default' ) ); 216 271 } 217 272 273 /** 274 * 275 * @covers ::wp_cache_delete 276 * @covers ::wp_cache_get 277 * @covers ::wp_cache_set 278 */ 218 279 function test_wp_cache_delete() { 219 280 $key = __FUNCTION__; 220 281 $val = 'val'; … … 234 295 $this->assertFalse( wp_cache_delete( $key, 'default' ) ); 235 296 } 236 297 298 /** 299 * 300 * @covers WP_Object_Cache::switch_to_blog 301 */ 237 302 function test_switch_to_blog() { 238 303 if ( ! method_exists( $this->cache, 'switch_to_blog' ) ) { 239 304 return; … … 280 345 $this->assertEquals( $val2, $this->cache->get( $key, 'global-cache-test' ) ); 281 346 } 282 347 348 /** 349 * 350 * @covers ::wp_cache_init 351 */ 283 352 function test_wp_cache_init() { 284 353 $new_blank_cache_object = new WP_Object_Cache(); 285 354 wp_cache_init(); … … 294 363 } 295 364 } 296 365 366 /** 367 * 368 * @covers ::wp_cache_replace 369 */ 297 370 function test_wp_cache_replace() { 298 371 $key = 'my-key'; 299 372 $val1 = 'first-val'; … … 318 391 319 392 /** 320 393 * @ticket 20875 394 * 395 * @covers ::wp_cache_get_multiple 321 396 */ 322 397 public function test_get_multiple() { 323 398 wp_cache_set( 'foo1', 'bar', 'group1' ); -
tests/phpunit/tests/canonical.php
17 17 18 18 /** 19 19 * @dataProvider data_canonical 20 * 21 * @covers ::redirect_canonical 20 22 */ 21 23 function test_canonical( $test_url, $expected, $ticket = 0, $expected_doing_it_wrong = array() ) { 22 24 … … 232 234 233 235 /** 234 236 * @ticket 16557 237 * 238 * @covers ::redirect_guess_404_permalink 235 239 */ 236 240 public function test_do_redirect_guess_404_permalink() { 237 241 // Test disable do_redirect_guess_404_permalink(). … … 242 246 243 247 /** 244 248 * @ticket 16557 249 * 250 * @covers ::redirect_guess_404_permalink 245 251 */ 246 252 public function test_pre_redirect_guess_404_permalink() { 247 253 // Test short-circuit filter. … … 257 263 258 264 /** 259 265 * @ticket 16557 266 * 267 * @covers ::redirect_guess_404_permalink 260 268 */ 261 269 public function test_strict_redirect_guess_404_permalink() { 262 270 $post = self::factory()->post->create( … … 277 285 278 286 /** 279 287 * @ticket 43745 288 * 289 * @covers ::redirect_canonical 280 290 */ 281 291 public function test_utf8_query_keys_canonical() { 282 292 $p = self::factory()->post->create( -
tests/phpunit/tests/category.php
18 18 * Validate get_all_category_ids 19 19 * 20 20 * @expectedDeprecated get_all_category_ids 21 * 22 * @covers ::get_all_category_ids 21 23 */ 22 24 function test_get_all_category_ids() { 23 25 // Ccreate categories. … … 34 36 35 37 /** 36 38 * Validate get_category_by_slug function 39 * 40 * @covers ::get_category_by_slug 37 41 */ 38 42 function test_get_category_by_slug() { 39 43 … … 64 68 65 69 /** 66 70 * Validate _make_cat_compat function 71 * 72 * @covers ::_make_cat_compat 67 73 */ 68 74 function test__make_cat_compat() { 69 75 … … 141 147 142 148 /** 143 149 * Validate get_cat_name function 150 * 151 * @covers ::get_cat_name 144 152 */ 145 153 function test_get_cat_name() { 146 154 … … 161 169 162 170 /** 163 171 * Validate get_cat_name function 172 * 173 * @covers ::get_cat_ID 164 174 */ 165 175 function test_get_cat_ID() { 166 176 … … 181 191 182 192 /** 183 193 * Validate get_category_by_path function 194 * 195 * @covers ::get_category_by_path 184 196 */ 185 197 function test_get_category_by_path() { 186 198 -
tests/phpunit/tests/comment-submission.php
39 39 require_once ABSPATH . WPINC . '/class-phpass.php'; 40 40 } 41 41 42 /** 43 * @covers ::wp_handle_comment_submission 44 */ 42 45 public function test_submitting_comment_to_invalid_post_returns_error() { 43 46 $error = 'comment_id_not_found'; 44 47 … … 55 58 56 59 } 57 60 61 /** 62 * @covers ::wp_handle_comment_submission 63 */ 58 64 public function test_submitting_comment_to_post_with_closed_comments_returns_error() { 59 65 60 66 $error = 'comment_closed'; … … 78 84 79 85 } 80 86 87 /** 88 * @covers ::wp_handle_comment_submission 89 */ 81 90 public function test_submitting_comment_to_trashed_post_returns_error() { 82 91 83 92 $error = 'comment_on_trash'; … … 99 108 100 109 } 101 110 111 /** 112 * @covers ::wp_handle_comment_submission 113 */ 102 114 public function test_submitting_comment_to_draft_post_returns_error() { 103 115 $error = 'comment_on_draft'; 104 116 … … 124 136 125 137 /** 126 138 * @ticket 39650 139 * 140 * @covers ::wp_handle_comment_submission 127 141 */ 128 142 public function test_submitting_comment_to_draft_post_returns_error_message_for_user_with_correct_caps() { 129 143 $error = 'comment_on_draft'; … … 150 164 $this->assertNotEmpty( $comment->get_error_message() ); 151 165 } 152 166 167 /** 168 * @covers ::wp_handle_comment_submission 169 */ 153 170 public function test_submitting_comment_to_scheduled_post_returns_error() { 154 171 155 172 // Same error as commenting on a draft. … … 176 193 177 194 } 178 195 196 /** 197 * @covers ::wp_handle_comment_submission 198 */ 179 199 public function test_submitting_comment_to_password_required_post_returns_error() { 180 200 181 201 $error = 'comment_on_password_protected'; … … 199 219 200 220 } 201 221 222 /** 223 * @covers ::wp_handle_comment_submission 224 */ 202 225 public function test_submitting_comment_to_password_protected_post_succeeds() { 203 226 204 227 $password = 'password'; … … 227 250 228 251 } 229 252 253 /** 254 * @covers ::wp_handle_comment_submission 255 */ 230 256 public function test_submitting_valid_comment_as_logged_in_user_succeeds() { 231 257 232 258 $user = self::factory()->user->create_and_get( … … 254 280 255 281 } 256 282 283 /** 284 * @covers ::wp_handle_comment_submission 285 */ 257 286 public function test_submitting_valid_comment_anonymously_succeeds() { 258 287 259 288 $data = array( … … 280 309 * wp_handle_comment_submission() expects un-slashed data. 281 310 * 282 311 * @group slashes 312 * 313 * @covers ::wp_handle_comment_submission 283 314 */ 284 315 public function test_submitting_comment_handles_slashes_correctly_handles_slashes() { 285 316 … … 300 331 301 332 } 302 333 334 /** 335 * @covers ::wp_handle_comment_submission 336 */ 303 337 public function test_submitting_comment_anonymously_to_private_post_returns_error() { 304 338 305 339 $error = 'comment_id_not_found'; … … 321 355 322 356 } 323 357 358 /** 359 * @covers ::wp_handle_comment_submission 360 */ 324 361 public function test_submitting_comment_as_logged_in_user_to_inaccessible_private_post_returns_error() { 325 362 326 363 $error = 'comment_id_not_found'; … … 351 388 352 389 } 353 390 391 /** 392 * @covers ::wp_handle_comment_submission 393 */ 354 394 public function test_submitting_comment_to_private_post_with_closed_comments_returns_correct_error() { 355 395 356 396 $error = 'comment_id_not_found'; … … 382 422 383 423 } 384 424 425 /** 426 * @covers ::wp_handle_comment_submission 427 */ 385 428 public function test_submitting_comment_to_own_private_post_succeeds() { 386 429 387 430 wp_set_current_user( self::$author_id ); … … 405 448 406 449 } 407 450 451 /** 452 * @covers ::wp_handle_comment_submission 453 */ 408 454 public function test_submitting_comment_to_accessible_private_post_succeeds() { 409 455 410 456 wp_set_current_user( self::$editor_id ); … … 428 474 429 475 } 430 476 477 /** 478 * @covers ::wp_handle_comment_submission 479 */ 431 480 public function test_anonymous_user_cannot_comment_unfiltered_html() { 432 481 433 482 $data = array( … … 444 493 445 494 } 446 495 496 /** 497 * @covers ::wp_handle_comment_submission 498 */ 447 499 public function test_unprivileged_user_cannot_comment_unfiltered_html() { 448 500 449 501 wp_set_current_user( self::$author_id ); … … 462 514 463 515 } 464 516 517 /** 518 * @covers ::wp_handle_comment_submission 519 */ 465 520 public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() { 466 521 467 522 wp_set_current_user( self::$author_id ); … … 486 541 487 542 } 488 543 544 /** 545 * @covers ::wp_handle_comment_submission 546 */ 489 547 public function test_privileged_user_can_comment_unfiltered_html_with_valid_nonce() { 490 548 491 549 $this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) ); … … 518 576 519 577 } 520 578 579 /** 580 * @covers ::wp_handle_comment_submission 581 */ 521 582 public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() { 522 583 523 584 if ( is_multisite() ) { … … 542 603 543 604 } 544 605 606 /** 607 * @covers ::wp_handle_comment_submission 608 */ 545 609 public function test_submitting_comment_as_anonymous_user_when_registration_required_returns_error() { 546 610 547 611 $error = 'not_logged_in'; … … 561 625 562 626 } 563 627 628 /** 629 * @covers ::wp_handle_comment_submission 630 */ 564 631 public function test_submitting_comment_with_no_name_when_name_email_required_returns_error() { 565 632 566 633 $error = 'require_name_email'; … … 582 649 583 650 } 584 651 652 /** 653 * @covers ::wp_handle_comment_submission 654 */ 585 655 public function test_submitting_comment_with_no_email_when_name_email_required_returns_error() { 586 656 587 657 $error = 'require_name_email'; … … 603 673 604 674 } 605 675 676 /** 677 * @covers ::wp_handle_comment_submission 678 */ 606 679 public function test_submitting_comment_with_invalid_email_when_name_email_required_returns_error() { 607 680 608 681 $error = 'require_valid_email'; … … 625 698 626 699 } 627 700 701 /** 702 * @covers ::wp_handle_comment_submission 703 */ 628 704 public function test_submitting_comment_with_no_comment_content_returns_error() { 629 705 630 706 $error = 'require_valid_comment'; … … 644 720 645 721 /** 646 722 * @ticket 10377 723 * 724 * @covers ::wp_handle_comment_submission 647 725 */ 648 726 public function test_submitting_comment_with_content_too_long_returns_error() { 649 727 $error = 'comment_content_column_length'; … … 662 740 663 741 /** 664 742 * @ticket 10377 743 * 744 * @covers ::wp_handle_comment_submission 665 745 */ 666 746 public function test_submitting_comment_with_author_too_long_returns_error() { 667 747 $error = 'comment_author_column_length'; … … 680 760 681 761 /** 682 762 * @ticket 10377 763 * 764 * @covers ::wp_handle_comment_submission 683 765 */ 684 766 public function test_submitting_comment_with_email_too_long_returns_error() { 685 767 $error = 'comment_author_email_column_length'; … … 698 780 699 781 /** 700 782 * @ticket 10377 783 * 784 * @covers ::wp_handle_comment_submission 701 785 */ 702 786 public function test_submitting_comment_with_url_too_long_returns_error() { 703 787 $error = 'comment_author_url_column_length'; … … 717 801 718 802 /** 719 803 * @ticket 49236 804 * 805 * @covers ::wp_handle_comment_submission 720 806 */ 721 807 public function test_submitting_comment_with_empty_type_results_in_correct_type() { 722 808 $data = array( … … 736 822 737 823 /** 738 824 * @ticket 49236 825 * 826 * @covers ::wp_handle_comment_submission 739 827 */ 740 828 public function test_inserting_comment_with_empty_type_results_in_correct_type() { 741 829 $data = array( … … 756 844 757 845 /** 758 846 * @ticket 34997 847 * 848 * @covers ::wp_handle_comment_submission 759 849 */ 760 850 public function test_comment_submission_sends_all_expected_parameters_to_preprocess_comment_filter() { 761 851 … … 798 888 799 889 /** 800 890 * @ticket 36901 891 * 892 * @covers ::wp_handle_comment_submission 801 893 */ 802 894 public function test_submitting_duplicate_comments() { 803 895 $data = array( … … 814 906 815 907 /** 816 908 * @ticket 36901 909 * 910 * @covers ::wp_handle_comment_submission 817 911 */ 818 912 public function test_comments_flood() { 819 913 $data = array( … … 833 927 834 928 /** 835 929 * @ticket 36901 930 * 931 * @covers ::wp_handle_comment_submission 836 932 */ 837 933 public function test_comments_flood_user_is_admin() { 838 934 $user = self::factory()->user->create_and_get( -
tests/phpunit/tests/comment.php
30 30 ); 31 31 } 32 32 33 /** 34 * 35 * 36 * @covers ::wp_update_comment 37 */ 33 38 public function test_wp_update_comment() { 34 39 $post = self::factory()->post->create_and_get( 35 40 array( … … 78 83 79 84 /** 80 85 * @ticket 30627 86 * 87 * @covers ::wp_update_comment 81 88 */ 82 89 public function test_wp_update_comment_updates_comment_type() { 83 90 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); … … 95 102 96 103 /** 97 104 * @ticket 36784 105 * 106 * @covers ::wp_update_comment 98 107 */ 99 108 public function test_wp_update_comment_updates_comment_meta() { 100 109 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); … … 114 123 115 124 /** 116 125 * @ticket 30307 126 * 127 * @covers ::wp_update_comment 117 128 */ 118 129 public function test_wp_update_comment_updates_user_id() { 119 130 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); … … 131 142 132 143 /** 133 144 * @ticket 34954 145 * 146 * @covers ::wp_update_comment 134 147 */ 135 148 public function test_wp_update_comment_with_no_post_id() { 136 149 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => 0 ) ); … … 152 165 153 166 /** 154 167 * @ticket 39732 168 * 169 * @covers ::wp_update_comment 155 170 */ 156 171 public function test_wp_update_comment_returns_false_for_invalid_comment_or_post_id() { 157 172 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); … … 175 190 176 191 /** 177 192 * @ticket 39732 193 * 194 * @covers ::wp_update_comment 178 195 */ 179 196 public function test_wp_update_comment_is_wp_error() { 180 197 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); … … 201 218 return new WP_Error( 'comment_wrong', 'wp_update_comment_data filter fails for this comment.', 500 ); 202 219 } 203 220 221 /** 222 * 223 * 224 * @covers ::get_approved_comments 225 */ 204 226 public function test_get_approved_comments() { 205 227 $ca1 = self::factory()->comment->create( 206 228 array( … … 257 279 258 280 /** 259 281 * @ticket 30412 282 * 283 * @covers ::get_approved_comments 260 284 */ 261 285 public function test_get_approved_comments_with_post_id_0_should_return_empty_array() { 262 286 $ca1 = self::factory()->comment->create( … … 273 297 274 298 /** 275 299 * @ticket 14279 300 * 301 * @covers ::wp_new_comment 276 302 */ 277 303 public function test_wp_new_comment_respects_dates() { 278 304 $data = array( … … 296 322 297 323 /** 298 324 * @ticket 14601 325 * 326 * @covers ::wp_new_comment 299 327 */ 300 328 public function test_wp_new_comment_respects_author_ip() { 301 329 $data = array( … … 317 345 318 346 /** 319 347 * @ticket 14601 348 * 349 * @covers ::wp_new_comment 320 350 */ 321 351 public function test_wp_new_comment_respects_author_ip_empty_string() { 322 352 $data = array( … … 338 368 339 369 /** 340 370 * @ticket 14601 371 * 372 * @covers ::wp_new_comment 341 373 */ 342 374 public function test_wp_new_comment_respects_comment_agent() { 343 375 $data = array( … … 360 392 361 393 /** 362 394 * @ticket 14601 395 * 396 * @covers ::wp_new_comment 363 397 */ 364 398 public function test_wp_new_comment_should_trim_provided_comment_agent_to_254_chars() { 365 399 $data = array( … … 382 416 383 417 /** 384 418 * @ticket 14601 419 * 420 * @covers ::wp_new_comment 385 421 */ 386 422 public function test_wp_new_comment_respects_comment_agent_empty_string() { 387 423 $data = array( … … 402 438 $this->assertEquals( $data['comment_agent'], $comment->comment_agent ); 403 439 } 404 440 405 441 /** 442 * @covers ::wp_new_comment 443 */ 406 444 public function test_comment_field_lengths() { 407 445 $data = array( 408 446 'comment_post_ID' => self::$post_id, … … 424 462 425 463 /** 426 464 * @ticket 32566 465 * 466 * @covers ::wp_notify_moderator 427 467 */ 428 468 public function test_wp_notify_moderator_should_not_throw_notice_when_post_author_is_0() { 429 469 $p = self::factory()->post->create( … … 441 481 $this->assertTrue( wp_notify_moderator( $c ) ); 442 482 } 443 483 484 /** 485 * 486 * 487 * @covers ::wp_new_comment_notify_postauthor 488 */ 444 489 public function test_wp_new_comment_notify_postauthor_should_send_email_when_comment_is_approved() { 445 490 $c = self::factory()->comment->create( 446 491 array( … … 452 497 $this->assertTrue( $sent ); 453 498 } 454 499 500 /** 501 * 502 * 503 * @covers ::wp_new_comment_notify_postauthor 504 */ 455 505 public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_is_unapproved() { 456 506 $c = self::factory()->comment->create( 457 507 array( … … 466 516 467 517 /** 468 518 * @ticket 33587 519 * 520 * @covers ::wp_new_comment_notify_postauthor 469 521 */ 470 522 public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_marked_as_spam() { 471 523 $c = self::factory()->comment->create( … … 481 533 482 534 /** 483 535 * @ticket 35006 536 * 537 * @covers ::wp_new_comment_notify_postauthor 484 538 */ 485 539 public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_trashed() { 486 540 $c = self::factory()->comment->create( … … 496 550 497 551 /** 498 552 * @ticket 43805 553 * 554 * @covers ::wp_new_comment_notify_postauthor 499 555 */ 500 556 public function test_wp_new_comment_notify_postauthor_content_should_include_link_to_parent() { 501 557 $c1 = self::factory()->comment->create( … … 520 576 521 577 /** 522 578 * @ticket 43805 579 * 580 * @covers ::wp_new_comment_notify_moderator 523 581 */ 524 582 public function test_wp_new_comment_notify_moderator_content_should_include_link_to_parent() { 525 583 $c1 = self::factory()->comment->create( … … 556 614 557 615 /** 558 616 * @ticket 12431 617 * 618 * @covers ::get_comment_meta 559 619 */ 560 620 public function test_wp_new_comment_with_meta() { 561 621 $c = self::factory()->comment->create( … … 573 633 574 634 /** 575 635 * @ticket 8071 636 * 637 * @covers WP_Comment::get_children 576 638 */ 577 639 public function test_wp_comment_get_children_should_fill_children() { 578 640 $c1 = self::factory()->comment->create( … … 633 695 634 696 /** 635 697 * @ticket 27571 698 * 699 * @covers ::get_comment 636 700 */ 637 701 public function test_post_properties_should_be_lazyloaded() { 638 702 $c = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); … … 684 748 685 749 /** 686 750 * @ticket 761 751 * 752 * @covers ::wp_new_comment 687 753 */ 688 754 public function test_wp_notify_moderator_filter_moderation_notify_option_true_filter_false() { 689 755 $comment_data = $this->setup_notify_comment(); … … 705 771 706 772 /** 707 773 * @ticket 761 774 * 775 * @covers ::wp_new_comment 708 776 */ 709 777 public function test_wp_notify_moderator_filter_moderation_notify_option_false_filter_true() { 710 778 $comment_data = $this->setup_notify_comment(); … … 726 794 727 795 /** 728 796 * @ticket 761 797 * 798 * @covers ::wp_new_comment 729 799 */ 730 800 public function test_wp_notify_post_author_filter_comments_notify_option_true_filter_false() { 731 801 … … 748 818 749 819 /** 750 820 * @ticket 761 821 * 822 * @covers ::wp_new_comment 751 823 */ 752 824 public function test_wp_notify_post_author_filter_comments_notify_option_false_filter_true() { 753 825 $comment_data = $this->setup_notify_comment(); … … 852 924 return $email_sent_when_comment_approved || $email_sent_when_comment_added; 853 925 } 854 926 927 /** 928 * 929 * 930 * @covers ::_close_comments_for_old_post 931 */ 855 932 public function test_close_comments_for_old_post() { 856 933 update_option( 'close_comments_for_old_posts', true ); 857 934 // Close comments more than one day old. … … 867 944 $this->assertTrue( $new_post_comment_status ); 868 945 } 869 946 947 /** 948 * 949 * 950 * @covers ::_close_comments_for_old_post 951 */ 870 952 public function test_close_comments_for_old_post_undated_draft() { 871 953 $draft_id = self::factory()->post->create( 872 954 array( … … 881 963 882 964 /** 883 965 * @ticket 35276 966 * 967 * @covers ::wp_update_comment 884 968 */ 885 969 public function test_wp_update_comment_author_id_and_agent() { 886 970 … … 917 1001 $this->assertSame( 'SHIELD_AGENT', $updated->comment_agent ); 918 1002 } 919 1003 1004 /** 1005 * @covers ::wp_get_comment_fields_max_lengths 1006 */ 920 1007 public function test_wp_get_comment_fields_max_lengths() { 921 1008 $expected = array( 922 1009 'comment_author' => 245, … … 937 1024 * 938 1025 * @group privacy 939 1026 * @ticket 43442 1027 * 1028 * @covers ::wp_comments_personal_data_eraser 940 1029 */ 941 1030 public function test_wp_comments_personal_data_eraser() { 942 1031 … … 994 1083 * 995 1084 * @group privacy 996 1085 * @ticket 43442 1086 * 1087 * @covers ::wp_comments_personal_data_eraser 997 1088 */ 998 1089 public function test_wp_comments_personal_data_eraser_empty_first_page_output() { 999 1090 … … 1013 1104 * 1014 1105 * @group privacy 1015 1106 * @ticket 43442 1107 * 1108 * @covers ::wp_comments_personal_data_eraser 1016 1109 */ 1017 1110 public function test_wp_comments_personal_data_eraser_non_empty_first_page_output() { 1018 1111 … … 1045 1138 * 1046 1139 * @group privacy 1047 1140 * @ticket 43442 1141 * 1142 * @covers ::wp_comments_personal_data_eraser 1048 1143 */ 1049 1144 public function test_wp_comments_personal_data_eraser_empty_second_page_output() { 1050 1145 … … 1077 1172 * 1078 1173 * @group privacy 1079 1174 * @ticket 43442 1175 * 1176 * @covers ::wp_comments_personal_data_eraser 1080 1177 */ 1081 1178 public function test_wp_anonymize_comment_filter_to_prevent_comment_anonymization() { 1082 1179 … … 1114 1211 * 1115 1212 * @group privacy 1116 1213 * @ticket 43442 1214 * 1215 * @covers ::wp_comments_personal_data_eraser 1117 1216 */ 1118 1217 public function test_wp_anonymize_comment_filter_to_prevent_comment_anonymization_with_custom_message() { 1119 1218 … … 1179 1278 $this->assertSame( 'Bar', $comment->comment_author ); 1180 1279 } 1181 1280 1281 /** 1282 * 1283 * 1284 * @covers ::wp_trash_comment 1285 */ 1182 1286 public function test_trash_should_invalidate_comment_cache() { 1183 1287 global $wpdb; 1184 1288 … … 1193 1297 $this->assertSame( 'trash', $comment->comment_approved ); 1194 1298 } 1195 1299 1300 /** 1301 * 1302 * 1303 * @covers ::wp_untrash_comment 1304 */ 1196 1305 public function test_untrash_should_invalidate_comment_cache() { 1197 1306 global $wpdb; 1198 1307 … … 1209 1318 $this->assertSame( '1', $comment->comment_approved ); 1210 1319 } 1211 1320 1321 /** 1322 * 1323 * 1324 * @covers ::wp_spam_comment 1325 */ 1212 1326 public function test_spam_should_invalidate_comment_cache() { 1213 1327 global $wpdb; 1214 1328 … … 1223 1337 $this->assertSame( 'spam', $comment->comment_approved ); 1224 1338 } 1225 1339 1340 /** 1341 * 1342 * 1343 * @covers ::wp_unspam_comment 1344 */ 1226 1345 public function test_unspam_should_invalidate_comment_cache() { 1227 1346 global $wpdb; 1228 1347 … … 1244 1363 * 1245 1364 * @group privacy 1246 1365 * @ticket 43440 1366 * 1367 * @covers ::wp_comments_personal_data_exporter 1247 1368 */ 1248 1369 public function test_wp_comments_personal_data_exporter() { 1249 1370 $args = array( … … 1290 1411 * 1291 1412 * @group privacy 1292 1413 * @ticket 43440 1414 * 1415 * @covers ::wp_comments_personal_data_exporter 1293 1416 */ 1294 1417 public function test_wp_comments_personal_data_exporter_no_comments_found() { 1295 1418 … … 1308 1431 * 1309 1432 * @group privacy 1310 1433 * @ticket 43440 1434 * 1435 * @covers ::wp_comments_personal_data_exporter 1311 1436 */ 1312 1437 public function test_wp_comments_personal_data_exporter_empty_comment_prop() { 1313 1438 $args = array( … … 1339 1464 * 1340 1465 * @group privacy 1341 1466 * @ticket 43440 1467 * 1468 * @covers ::wp_comments_personal_data_exporter 1342 1469 */ 1343 1470 public function test_wp_comments_personal_data_exporter_empty_second_page() { 1344 1471 $args = array( -
tests/phpunit/tests/compat.php
34 34 35 35 /** 36 36 * @dataProvider utf8_string_lengths 37 * 38 * @covers ::_mb_strlen 37 39 */ 38 40 function test_mb_strlen( $string, $expected_character_length ) { 39 41 $this->assertEquals( $expected_character_length, _mb_strlen( $string, 'UTF-8' ) ); … … 41 43 42 44 /** 43 45 * @dataProvider utf8_string_lengths 46 * 47 * @covers ::_mb_strlen 44 48 */ 45 49 function test_mb_strlen_via_regex( $string, $expected_character_length ) { 46 50 _wp_can_use_pcre_u( false ); … … 50 54 51 55 /** 52 56 * @dataProvider utf8_string_lengths 57 * 58 * @covers ::_mb_strlen 53 59 */ 54 60 function test_8bit_mb_strlen( $string, $expected_character_length, $expected_byte_length ) { 55 61 $this->assertEquals( $expected_byte_length, _mb_strlen( $string, '8bit' ) ); … … 57 63 58 64 /** 59 65 * @dataProvider utf8_substrings 66 * 67 * @covers ::_mb_substr 60 68 */ 61 69 function test_mb_substr( $string, $start, $length, $expected_character_substring ) { 62 70 $this->assertEquals( $expected_character_substring, _mb_substr( $string, $start, $length, 'UTF-8' ) ); … … 64 72 65 73 /** 66 74 * @dataProvider utf8_substrings 75 * 76 * @covers ::_mb_substr 67 77 */ 68 78 function test_mb_substr_via_regex( $string, $start, $length, $expected_character_substring ) { 69 79 _wp_can_use_pcre_u( false ); … … 73 83 74 84 /** 75 85 * @dataProvider utf8_substrings 86 * 87 * @covers ::_mb_substr 76 88 */ 77 89 function test_8bit_mb_substr( $string, $start, $length, $expected_character_substring, $expected_byte_substring ) { 78 90 $this->assertEquals( $expected_byte_substring, _mb_substr( $string, $start, $length, '8bit' ) ); 79 91 } 80 92 93 /** 94 * 95 * @covers ::_mb_substr 96 */ 81 97 function test_mb_substr_phpcore() { 82 98 /* https://github.com/php/php-src/blob/php-5.6.8/ext/mbstring/tests/mb_substr_basic.phpt */ 83 99 $string_ascii = 'ABCDEF'; … … 164 180 165 181 } 166 182 183 /** 184 * 185 * @covers ::_hash_hmac 186 */ 167 187 function test_hash_hmac_simple() { 168 188 $this->assertEquals( '140d1cb79fa12e2a31f32d35ad0a2723', _hash_hmac( 'md5', 'simple', 'key' ) ); 169 189 $this->assertEquals( '993003b95758e0ac2eba451a4c5877eb1bb7b92a', _hash_hmac( 'sha1', 'simple', 'key' ) ); 170 190 } 171 191 192 /** 193 * 194 * @covers ::_hash_hmac 195 */ 172 196 function test_hash_hmac_padding() { 173 197 $this->assertEquals( '3c1399103807cf12ec38228614416a8c', _hash_hmac( 'md5', 'simple', '65 character key 65 character key 65 character key 65 character k' ) ); 174 198 $this->assertEquals( '4428826d20003e309d6c2a6515891370daf184ea', _hash_hmac( 'sha1', 'simple', '65 character key 65 character key 65 character key 65 character k' ) ); 175 199 } 176 200 201 /** 202 * 203 * @covers ::_hash_hmac 204 */ 177 205 function test_hash_hmac_output() { 178 206 $this->assertEquals( array( 1 => '140d1cb79fa12e2a31f32d35ad0a2723' ), unpack( 'H32', _hash_hmac( 'md5', 'simple', 'key', true ) ) ); 179 207 $this->assertEquals( array( 1 => '993003b95758e0ac2eba451a4c5877eb1bb7b92a' ), unpack( 'H40', _hash_hmac( 'sha1', 'simple', 'key', true ) ) ); … … 181 209 182 210 /** 183 211 * @expectedException PHPUnit_Framework_Error_Deprecated 212 * 213 * @covers Services_JSON::encodeUnsafe 214 * @covers Services_JSON::decode 184 215 */ 185 216 function test_json_encode_decode() { 186 217 require_once ABSPATH . WPINC . '/class-json.php'; … … 194 225 * Test that is_countable() is always available (either from PHP or WP). 195 226 * 196 227 * @ticket 43583 228 * 229 * @covers ::is_countable 197 230 */ 198 231 function test_is_countable_availability() { 199 232 $this->assertTrue( function_exists( 'is_countable' ) ); … … 208 241 * 209 242 * @param mixed $variable Variable to check. 210 243 * @param bool $is_countable The expected return value of PHP 7.3 is_countable() function. 244 * 245 * @covers ::is_countable 211 246 */ 212 247 function test_is_countable_functionality( $variable, $is_countable ) { 213 248 $this->assertSame( is_countable( $variable ), $is_countable ); … … 243 278 * Test is_countable() polyfill for ResourceBundle. 244 279 * 245 280 * @ticket 43583 281 * 282 * @covers ::is_countable 246 283 */ 247 284 function test_is_countable_ResourceBundle() { 248 285 if ( ! class_exists( 'ResourceBundle' ) ) { … … 256 293 * Test is_countable() polyfill for SimpleXMLElement. 257 294 * 258 295 * @ticket 43583 296 * 297 * @covers ::is_countable 259 298 */ 260 299 function test_is_countable_SimpleXMLElement() { 261 300 if ( ! class_exists( 'SimpleXMLElement' ) ) { … … 269 308 * Test that is_iterable() is always available (either from PHP or WP). 270 309 * 271 310 * @ticket 43619 311 * 312 * @covers ::is_iterable 272 313 */ 273 314 function test_is_iterable_availability() { 274 315 $this->assertTrue( function_exists( 'is_iterable' ) ); … … 283 324 * 284 325 * @param mixed $variable Variable to check. 285 326 * @param bool $is_iterable The expected return value of PHP 7.1 is_iterable() function. 327 * 328 * @covers ::is_iterable 286 329 */ 287 330 function test_is_iterable_functionality( $variable, $is_iterable ) { 288 331 $this->assertSame( is_iterable( $variable ), $is_iterable ); -
tests/phpunit/tests/cron.php
30 30 parent::tearDown(); 31 31 } 32 32 33 /** 34 * 35 * @covers ::wp_get_schedule 36 */ 33 37 function test_wp_get_schedule_empty() { 34 38 // Nothing scheduled. 35 39 $hook = __FUNCTION__; … … 36 40 $this->assertFalse( wp_get_schedule( $hook ) ); 37 41 } 38 42 43 /** 44 * 45 * @covers ::wp_schedule_single_event 46 */ 39 47 function test_schedule_event_single() { 40 48 // Schedule an event and make sure it's returned by wp_next_scheduled(). 41 49 $hook = __FUNCTION__; … … 50 58 51 59 } 52 60 61 /** 62 * 63 * @covers ::wp_schedule_single_event 64 */ 53 65 function test_schedule_event_single_args() { 54 66 // Schedule an event with arguments and make sure it's returned by wp_next_scheduled(). 55 67 $hook = 'event'; … … 68 80 $this->assertEquals( '', wp_get_schedule( $hook, $args ) ); 69 81 } 70 82 83 /** 84 * 85 * @covers ::wp_schedule_event 86 */ 71 87 function test_schedule_event() { 72 88 // Schedule an event and make sure it's returned by wp_next_scheduled(). 73 89 $hook = __FUNCTION__; … … 82 98 $this->assertEquals( $recur, wp_get_schedule( $hook ) ); 83 99 } 84 100 101 /** 102 * 103 * @covers ::wp_schedule_event 104 */ 85 105 function test_schedule_event_args() { 86 106 // Schedule an event and make sure it's returned by wp_next_scheduled(). 87 107 $hook = 'event'; … … 101 121 102 122 } 103 123 124 /** 125 * 126 * @covers ::wp_unschedule_event 127 */ 104 128 function test_unschedule_event() { 105 129 // Schedule an event and make sure it's returned by wp_next_scheduled(). 106 130 $hook = __FUNCTION__; … … 115 139 $this->assertEquals( false, wp_next_scheduled( $hook ) ); 116 140 } 117 141 142 /** 143 * 144 * @covers ::wp_clear_scheduled_hook 145 */ 118 146 function test_clear_schedule() { 119 147 $hook = __FUNCTION__; 120 148 $args = array( 'arg1' ); … … 142 170 $this->assertFalse( wp_next_scheduled( $hook, $args ) ); 143 171 } 144 172 173 /** 174 * 175 * @covers ::wp_clear_scheduled_hook 176 */ 145 177 function test_clear_undefined_schedule() { 146 178 $hook = __FUNCTION__; 147 179 $args = array( 'arg1' ); … … 154 186 $this->assertSame( 0, $hook_unscheduled ); 155 187 } 156 188 189 /** 190 * 191 * @covers ::wp_clear_scheduled_hook 192 */ 157 193 function test_clear_schedule_multiple_args() { 158 194 $hook = __FUNCTION__; 159 195 $args = array( 'arg1', 'arg2' ); … … 182 218 183 219 /** 184 220 * @ticket 10468 221 * 222 * @covers ::wp_clear_scheduled_hook 185 223 */ 186 224 function test_clear_schedule_new_args() { 187 225 $hook = __FUNCTION__; … … 220 258 221 259 /** 222 260 * @ticket 18997 261 * 262 * @covers ::wp_clear_scheduled_hook 223 263 */ 224 264 function test_unschedule_hook() { 225 265 $hook = __FUNCTION__; … … 240 280 $this->assertSame( 4, $unschedule_hook ); 241 281 $this->assertFalse( wp_next_scheduled( $hook ) ); 242 282 } 243 283 /** 284 * 285 * @covers ::wp_clear_scheduled_hook 286 */ 244 287 function test_unschedule_undefined_hook() { 245 288 $hook = __FUNCTION__; 246 289 $unrelated_hook = __FUNCTION__ . '_two'; … … 261 304 262 305 /** 263 306 * @ticket 6966 307 * 308 * @covers ::wp_schedule_single_event 264 309 */ 265 310 function test_duplicate_event() { 266 311 // Duplicate events close together should be skipped. … … 280 325 281 326 /** 282 327 * @ticket 6966 328 * 329 * @covers ::wp_schedule_single_event 283 330 */ 284 331 function test_not_duplicate_event() { 285 332 // Duplicate events far apart should work normally. … … 300 347 $this->assertEquals( $ts1, wp_next_scheduled( $hook, $args ) ); 301 348 } 302 349 350 /** 351 * 352 * @covers ::wp_schedule_single_event 353 */ 303 354 function test_not_duplicate_event_reversed() { 304 355 // Duplicate events far apart should work normally regardless of order. 305 356 $hook = __FUNCTION__; … … 324 375 * modification of the cron_array_option. 325 376 * 326 377 * @ticket 32656 378 * 379 * @covers ::wp_schedule_single_event 327 380 */ 328 381 function test_pre_schedule_event_filter() { 329 382 $hook = __FUNCTION__; … … 376 429 * modification of the cron_array_option. 377 430 * 378 431 * @ticket 32656 432 * 433 * @covers ::wp_schedule_event 379 434 */ 380 435 function test_pre_reschedule_event_filter() { 381 436 $hook = __FUNCTION__; … … 400 455 * modification of the cron_array_option. 401 456 * 402 457 * @ticket 32656 458 * 459 * @covers ::wp_unschedule_event 403 460 */ 404 461 function test_pre_unschedule_event_filter() { 405 462 $hook = __FUNCTION__; … … 424 481 * modification of the cron_array_option. 425 482 * 426 483 * @ticket 32656 484 * 485 * @covers ::wp_clear_scheduled_hook 427 486 */ 428 487 function test_pre_clear_scheduled_hook_filters() { 429 488 $hook = __FUNCTION__; … … 455 514 * return a filtered value as expected. 456 515 * 457 516 * @ticket 32656 517 * 518 * @covers ::wp_get_scheduled_event 458 519 */ 459 520 function test_pre_scheduled_event_hooks() { 460 521 add_filter( 'pre_get_scheduled_event', array( $this, 'filter_pre_scheduled_event_hooks' ) ); … … 489 550 * When a timestamp is specified, a particular event should be returned. 490 551 * 491 552 * @ticket 45976. 553 * 554 * @covers ::wp_get_scheduled_event 492 555 */ 493 556 function test_get_scheduled_event_singles() { 494 557 $hook = __FUNCTION__; … … 532 595 * When a timestamp is specified, a particular event should be returned. 533 596 * 534 597 * @ticket 45976. 598 * 599 * @covers ::wp_get_scheduled_event 535 600 */ 536 601 function test_get_scheduled_event_recurring() { 537 602 $hook = __FUNCTION__; … … 576 641 * Ensure wp_get_scheduled_event() returns false when expected. 577 642 * 578 643 * @ticket 45976. 644 * 645 * @covers ::wp_get_scheduled_event 579 646 */ 580 647 function test_get_scheduled_event_false() { 581 648 $hook = __FUNCTION__; … … 601 668 * Ensure any past event counts as a duplicate. 602 669 * 603 670 * @ticket 44818 671 * 672 * @covers ::wp_get_scheduled_event 604 673 */ 605 674 function test_duplicate_past_event() { 606 675 $hook = __FUNCTION__; … … 623 692 * Ensure any near future event counts as a duplicate. 624 693 * 625 694 * @ticket 44818 695 * 696 * @covers ::wp_get_scheduled_event 626 697 */ 627 698 function test_duplicate_near_future_event() { 628 699 $hook = __FUNCTION__; … … 645 716 * Duplicate future events are disallowed. 646 717 * 647 718 * @ticket 44818 719 * 720 * @covers ::wp_get_scheduled_event 648 721 */ 649 722 function test_duplicate_future_event() { 650 723 $hook = __FUNCTION__; … … 665 738 * Future events are allowed. 666 739 * 667 740 * @ticket 44818 741 * 742 * @covers ::wp_get_scheduled_event 668 743 */ 669 744 function test_not_duplicate_future_event() { 670 745 $hook = __FUNCTION__; -
tests/phpunit/tests/db.php
58 58 * Test that WPDB will reconnect when the DB link dies 59 59 * 60 60 * @ticket 5932 61 * 62 * @covers wpdb::db_connect 61 63 */ 62 64 public function test_db_reconnect() { 63 65 global $wpdb; … … 82 84 * @global mixed $wpdb 83 85 * 84 86 * @ticket 19861 87 * 88 * @covers wpdb::update 85 89 */ 86 90 public function test_locale_floats() { 87 91 global $wpdb; … … 128 132 129 133 /** 130 134 * @ticket 10041 135 * 136 * @covers wpdb::esc_like 131 137 */ 132 138 function test_esc_like() { 133 139 global $wpdb; … … 164 170 * @param $data string The haystack, raw. 165 171 * @param $like string The like phrase, raw. 166 172 * @param $result string The expected comparison result; '1' = true, '0' = false 173 * 174 * @covers wpdb::esc_like 167 175 */ 168 176 function test_like_query( $data, $like, $result ) { 169 177 global $wpdb; … … 227 235 228 236 /** 229 237 * @ticket 18510 238 * 239 * @coversNothing 230 240 */ 231 241 function test_wpdb_supposedly_protected_properties() { 232 242 global $wpdb; … … 243 253 244 254 /** 245 255 * @ticket 21212 256 * 257 * @coversNothing 246 258 */ 247 259 function test_wpdb_actually_protected_properties() { 248 260 global $wpdb; … … 274 286 * Test that an escaped %%f is not altered 275 287 * 276 288 * @ticket 19861 289 * 290 * @covers wpdb::placeholder_escape 291 * @covers wpdb::remove_placeholder_escape 277 292 */ 278 293 public function test_double_escaped_placeholders() { 279 294 global $wpdb; … … 289 304 * Test that SQL modes are set correctly 290 305 * 291 306 * @ticket 26847 307 * 308 * @covers wpdb::set_sql_mode 292 309 */ 293 310 function test_set_sql_mode() { 294 311 global $wpdb; … … 309 326 * Test that incompatible SQL modes are blocked 310 327 * 311 328 * @ticket 26847 329 * 330 * @covers wpdb::set_sql_mode 312 331 */ 313 332 function test_set_incompatible_sql_mode() { 314 333 global $wpdb; … … 327 346 * Test that incompatible SQL modes can be changed 328 347 * 329 348 * @ticket 26847 349 * 350 * @covers wpdb::set_sql_mode 330 351 */ 331 352 function test_set_allowed_incompatible_sql_mode() { 332 353 global $wpdb; … … 360 381 /** 361 382 * @ticket 25604 362 383 * @expectedIncorrectUsage wpdb::prepare 384 * 385 * @covers wpdb::prepare 363 386 */ 364 387 function test_prepare_without_arguments() { 365 388 global $wpdb; … … 370 393 $this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0", $prepared ); 371 394 } 372 395 396 /** 397 * 398 * @covers wpdb::prepare 399 */ 373 400 function test_prepare_sprintf() { 374 401 global $wpdb; 375 402 … … 379 406 380 407 /** 381 408 * @expectedIncorrectUsage wpdb::prepare 409 * 410 * @covers wpdb::prepare 382 411 */ 383 412 function test_prepare_sprintf_invalid_args() { 384 413 global $wpdb; … … 392 421 $this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0 AND user_login = 'admin'", $prepared ); 393 422 } 394 423 424 /** 425 * 426 * @covers wpdb::prepare 427 */ 395 428 function test_prepare_vsprintf() { 396 429 global $wpdb; 397 430 … … 401 434 402 435 /** 403 436 * @expectedIncorrectUsage wpdb::prepare 437 * 438 * @covers wpdb::prepare 404 439 */ 405 440 function test_prepare_vsprintf_invalid_args() { 406 441 global $wpdb; … … 418 453 * @ticket 42040 419 454 * @dataProvider data_prepare_incorrect_arg_count 420 455 * @expectedIncorrectUsage wpdb::prepare 456 * 457 * @covers wpdb::prepare 421 458 */ 422 459 public function test_prepare_incorrect_arg_count( $query, $args, $expected ) { 423 460 global $wpdb; … … 479 516 ); 480 517 } 481 518 519 /** 520 * 521 * @covers wpdb::db_version 522 */ 482 523 function test_db_version() { 483 524 global $wpdb; 484 525 485 526 $this->assertTrue( version_compare( $wpdb->db_version(), '5.0', '>=' ) ); 486 527 } 487 528 /** 529 * 530 * @covers wpdb::get_caller 531 */ 488 532 function test_get_caller() { 489 533 global $wpdb; 490 534 $str = $wpdb->get_caller(); … … 493 537 $this->assertEquals( $called, end( $calls ) ); 494 538 } 495 539 540 /** 541 * 542 * @covers wpdb::has_cap 543 */ 496 544 function test_has_cap() { 497 545 global $wpdb; 498 546 $this->assertTrue( $wpdb->has_cap( 'collation' ) ); … … 513 561 514 562 /** 515 563 * @expectedDeprecated supports_collation 564 * 565 * @covers wpdb::supports_collation 516 566 */ 517 567 function test_supports_collation() { 518 568 global $wpdb; … … 519 569 $this->assertTrue( $wpdb->supports_collation() ); 520 570 } 521 571 572 /** 573 * 574 * @covers wpdb::check_database_version 575 */ 522 576 function test_check_database_version() { 523 577 global $wpdb; 524 578 $this->assertEmpty( $wpdb->check_database_version() ); … … 526 580 527 581 /** 528 582 * @expectedException WPDieException 583 * 584 * @covers wpdb::bail 529 585 */ 530 586 function test_bail() { 531 587 global $wpdb; 532 588 $wpdb->bail( 'Database is dead.' ); 533 589 } 534 590 /** 591 * 592 * @covers wpdb::timer_start 593 * @covers wpdb::timer_stop 594 */ 535 595 function test_timers() { 536 596 global $wpdb; 537 597 … … 542 602 $this->assertNotEquals( $wpdb->time_start, $stop ); 543 603 $this->assertGreaterThan( $stop, $wpdb->time_start ); 544 604 } 545 605 /** 606 * 607 * @covers wpdb::get_col_info 608 */ 546 609 function test_get_col_info() { 547 610 global $wpdb; 548 611 … … 552 615 $this->assertEquals( array( $wpdb->users ), $wpdb->get_col_info( 'table' ) ); 553 616 $this->assertEquals( $wpdb->users, $wpdb->get_col_info( 'table', 0 ) ); 554 617 } 555 618 /** 619 * 620 * @covers wpdb::query 621 * @covers wpdb::delete 622 */ 556 623 function test_query_and_delete() { 557 624 global $wpdb; 558 625 $rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" ); … … 561 628 $d_rows = $wpdb->delete( $wpdb->users, array( 'ID' => $wpdb->insert_id ) ); 562 629 $this->assertEquals( 1, $d_rows ); 563 630 } 564 631 /** 632 * 633 * @covers wpdb::query 634 * @covers wpdb::get_row 635 */ 565 636 function test_get_row() { 566 637 global $wpdb; 567 638 $rows = $wpdb->query( "INSERT INTO $wpdb->users (display_name) VALUES ('Walter Sobchak')" ); … … 584 655 * @dataProvider data_test_get_col 585 656 * 586 657 * @ticket 45299 658 * 659 * @covers wpdb::get_col 587 660 */ 588 661 function test_get_col( $query, $expected, $last_result, $column ) { 589 662 global $wpdb; … … 664 737 ); 665 738 } 666 739 740 /** 741 * 742 * @covers wpdb::replace 743 */ 667 744 function test_replace() { 668 745 global $wpdb; 669 746 $rows1 = $wpdb->insert( $wpdb->users, array( 'display_name' => 'Walter Sobchak' ) ); … … 691 768 * wpdb::update() requires a WHERE condition. 692 769 * 693 770 * @ticket 26106 771 * 772 * @covers wpdb::update 694 773 */ 695 774 function test_empty_where_on_update() { 696 775 global $wpdb; … … 713 792 * mysqli_ incorrect flush and further sync issues. 714 793 * 715 794 * @ticket 28155 795 * 796 * @coversNothing 716 797 */ 717 798 function test_mysqli_flush_sync() { 718 799 global $wpdb; … … 873 954 /** 874 955 * @dataProvider data_get_table_from_query 875 956 * @ticket 21212 957 * 958 * @covers wpdb::get_table_from_query 876 959 */ 877 960 function test_get_table_from_query( $query, $table ) { 878 961 $this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) ); … … 888 971 /** 889 972 * @dataProvider data_get_table_from_query_false 890 973 * @ticket 21212 974 * 975 * @covers wpdb::get_table_from_query 891 976 */ 892 977 function test_get_table_from_query_false( $query ) { 893 978 $this->assertFalse( self::$_wpdb->get_table_from_query( $query ) ); … … 915 1000 /** 916 1001 * @dataProvider data_get_escaped_table_from_show_query 917 1002 * @ticket 38751 1003 * 1004 * @covers wpdb::get_table_from_query 918 1005 */ 919 1006 function test_get_escaped_table_from_show_query( $query, $table ) { 920 1007 $this->assertEquals( $table, self::$_wpdb->get_table_from_query( $query ) ); … … 1030 1117 /** 1031 1118 * @dataProvider data_process_field_formats 1032 1119 * @ticket 21212 1120 * 1121 * @covers wpdb::process_field_formats 1033 1122 */ 1034 1123 function test_process_field_formats( $data, $format, $expected, $message ) { 1035 1124 $actual = self::$_wpdb->process_field_formats( $data, $format ); … … 1038 1127 1039 1128 /** 1040 1129 * @ticket 21212 1130 * 1131 * @covers wpdb::process_fields 1041 1132 */ 1042 1133 function test_process_fields() { 1043 1134 global $wpdb; … … 1068 1159 /** 1069 1160 * @ticket 21212 1070 1161 * @depends test_process_fields 1162 * 1163 * @covers wpdb::process_fields 1071 1164 */ 1072 1165 function test_process_fields_on_nonexistent_table( $data ) { 1073 1166 self::$_wpdb->suppress_errors( true ); … … 1078 1171 1079 1172 /** 1080 1173 * @ticket 21212 1174 * 1175 * @covers wpdb::get_table_charset 1081 1176 */ 1082 1177 function test_pre_get_table_charset_filter() { 1083 1178 add_filter( 'pre_get_table_charset', array( $this, 'filter_pre_get_table_charset' ), 10, 2 ); … … 1092 1187 1093 1188 /** 1094 1189 * @ticket 21212 1190 * 1191 * @covers wpdb::get_col_charset 1095 1192 */ 1096 1193 function test_pre_get_col_charset_filter() { 1097 1194 add_filter( 'pre_get_col_charset', array( $this, 'filter_pre_get_col_charset' ), 10, 3 ); … … 1106 1203 1107 1204 /** 1108 1205 * @ticket 15158 1206 * 1207 * @covers wpdb::insert 1109 1208 */ 1110 1209 function test_null_insert() { 1111 1210 global $wpdb; … … 1128 1227 1129 1228 /** 1130 1229 * @ticket 15158 1230 * 1231 * @covers wpdb::insert 1131 1232 */ 1132 1233 function test_null_update_value() { 1133 1234 global $wpdb; … … 1166 1267 1167 1268 /** 1168 1269 * @ticket 15158 1270 * 1271 * @covers wpdb::update 1169 1272 */ 1170 1273 function test_null_update_where() { 1171 1274 global $wpdb; … … 1204 1307 1205 1308 /** 1206 1309 * @ticket 15158 1310 * 1311 * @covers wpdb::delete 1207 1312 */ 1208 1313 function test_null_delete() { 1209 1314 global $wpdb; … … 1240 1345 1241 1346 /** 1242 1347 * @ticket 34903 1348 * 1349 * @covers wpdb::close 1243 1350 */ 1244 1351 function test_close() { 1245 1352 global $wpdb; … … 1259 1366 1260 1367 /** 1261 1368 * @ticket 36917 1369 * 1370 * @covers wpdb::determine_charset 1262 1371 */ 1263 1372 function test_charset_not_determined_when_disconnected() { 1264 1373 global $wpdb; … … 1277 1386 1278 1387 /** 1279 1388 * @ticket 36917 1389 * 1390 * @covers wpdb::determine_charset 1280 1391 */ 1281 1392 function test_charset_switched_to_utf8mb4() { 1282 1393 global $wpdb; … … 1296 1407 /** 1297 1408 * @ticket 32105 1298 1409 * @ticket 36917 1410 * 1411 * @covers wpdb::determine_charset 1299 1412 */ 1300 1413 function test_collate_switched_to_utf8mb4_520() { 1301 1414 global $wpdb; … … 1315 1428 /** 1316 1429 * @ticket 32405 1317 1430 * @ticket 36917 1431 * 1432 * @covers wpdb::determine_charset 1318 1433 */ 1319 1434 function test_non_unicode_collations() { 1320 1435 global $wpdb; … … 1333 1448 1334 1449 /** 1335 1450 * @ticket 37982 1451 * 1452 * @covers wpdb::determine_charset 1336 1453 */ 1337 1454 function test_charset_switched_to_utf8() { 1338 1455 global $wpdb; … … 1352 1469 1353 1470 /** 1354 1471 * @dataProvider data_prepare_with_placeholders 1472 * 1473 * @covers wpdb::prepare 1355 1474 */ 1356 1475 function test_prepare_with_placeholders_and_individual_args( $sql, $values, $incorrect_usage, $expected ) { 1357 1476 global $wpdb; … … 1371 1490 1372 1491 /** 1373 1492 * @dataProvider data_prepare_with_placeholders 1493 * 1494 * @covers wpdb::prepare 1374 1495 */ 1375 1496 function test_prepare_with_placeholders_and_array_args( $sql, $values, $incorrect_usage, $expected ) { 1376 1497 global $wpdb; … … 1565 1686 1566 1687 /** 1567 1688 * @dataProvider data_escape_and_prepare 1689 * 1690 * @covers ::esc_sql 1691 /** 1692 * @coversNothing 1568 1693 */ 1694 */ 1569 1695 function test_escape_and_prepare( $escape, $sql, $values, $incorrect_usage, $expected ) { 1570 1696 global $wpdb; 1571 1697 … … 1612 1738 1613 1739 /** 1614 1740 * @expectedIncorrectUsage wpdb::prepare 1741 * 1742 * @covers wpdb::prepare 1615 1743 */ 1616 1744 function test_double_prepare() { 1617 1745 global $wpdb; … … 1623 1751 $this->assertNull( $query ); 1624 1752 } 1625 1753 1754 /** 1755 * 1756 * @covers wpdb::prepare 1757 */ 1626 1758 function test_prepare_numeric_placeholders_float_args() { 1627 1759 global $wpdb; 1628 1760 … … 1638 1770 $this->assertContains( ' second=2.2', $actual ); 1639 1771 } 1640 1772 1773 /** 1774 * 1775 * @covers wpdb::prepare 1776 */ 1641 1777 function test_prepare_numeric_placeholders_float_array() { 1642 1778 global $wpdb; 1643 1779 … … 1652 1788 $this->assertContains( ' second=2.2', $actual ); 1653 1789 } 1654 1790 1791 /** 1792 * 1793 * @covers wpdb::prepare 1794 */ 1655 1795 function test_query_unescapes_placeholders() { 1656 1796 global $wpdb; 1657 1797 … … 1671 1811 $this->assertEquals( $value, $actual ); 1672 1812 } 1673 1813 1814 /** 1815 * 1816 * @covers wpdb::placeholder_escape 1817 */ 1674 1818 function test_esc_sql_with_unsupported_placeholder_type() { 1675 1819 global $wpdb; 1676 1820 … … 1684 1828 /** 1685 1829 * @dataProvider parse_db_host_data_provider 1686 1830 * @ticket 41722 1831 * 1832 * @covers wpdb::parse_db_host 1687 1833 */ 1688 1834 public function test_parse_db_host( $host_string, $expect_bail, $host, $port, $socket, $is_ipv6 ) { 1689 1835 global $wpdb; -
tests/phpunit/tests/dbdelta.php
96 96 97 97 /** 98 98 * Test table creation. 99 * 100 * @covers ::dbDelta 99 101 */ 100 102 public function test_creating_a_table() { 101 103 … … 133 135 134 136 /** 135 137 * Test that it does nothing for an existing table. 138 * 139 * @covers ::dbDelta 136 140 */ 137 141 public function test_existing_table() { 138 142 … … 155 159 156 160 /** 157 161 * Test the column type is updated. 162 * 163 * @covers ::dbDelta 158 164 */ 159 165 public function test_column_type_change() { 160 166 … … 184 190 185 191 /** 186 192 * Test new column added. 193 * 194 * @covers ::dbDelta 187 195 */ 188 196 public function test_column_added() { 189 197 … … 218 226 * Test that it does nothing when a column is removed. 219 227 * 220 228 * @ticket 26801 229 * 230 * @covers ::dbDelta 221 231 */ 222 232 public function test_columns_arent_removed() { 223 233 … … 242 252 243 253 /** 244 254 * Test that nothing happens with $execute is false. 255 * 256 * @covers ::dbDelta 245 257 */ 246 258 public function test_no_execution() { 247 259 … … 275 287 276 288 /** 277 289 * Test inserting into the database 290 * 291 * @covers ::dbDelta 278 292 */ 279 293 public function test_insert_into_table() { 280 294 global $wpdb; … … 296 310 * Test that FULLTEXT indexes are detected. 297 311 * 298 312 * @ticket 14445 313 * 314 * @covers ::dbDelta 299 315 */ 300 316 public function test_fulltext_index() { 301 317 global $wpdb; … … 401 417 402 418 /** 403 419 * @ticket 31869 420 * 421 * @covers ::dbDelta 404 422 */ 405 423 function test_truncated_index() { 406 424 global $wpdb; … … 441 459 442 460 /** 443 461 * @ticket 36748 462 * 463 * @covers ::dbDelta 444 464 */ 445 465 function test_dont_downsize_text_fields() { 446 466 global $wpdb; … … 466 486 467 487 /** 468 488 * @ticket 36748 489 * 490 * @covers ::dbDelta 469 491 */ 470 492 function test_dont_downsize_blob_fields() { 471 493 global $wpdb; … … 491 513 492 514 /** 493 515 * @ticket 36748 516 * 517 * @covers ::dbDelta 494 518 */ 495 519 function test_upsize_text_fields() { 496 520 global $wpdb; … … 522 546 523 547 /** 524 548 * @ticket 36748 549 * 550 * @covers ::dbDelta 525 551 */ 526 552 function test_upsize_blob_fields() { 527 553 global $wpdb; … … 553 579 554 580 /** 555 581 * @ticket 20263 582 * 583 * @covers ::dbDelta 556 584 */ 557 585 function test_query_with_backticks_does_not_throw_an_undefined_index_warning() { 558 586 global $wpdb; … … 578 606 579 607 /** 580 608 * @ticket 36948 609 * 610 * @covers ::dbDelta 581 611 */ 582 612 function test_spatial_indices() { 583 613 global $wpdb; … … 639 669 640 670 /** 641 671 * @ticket 20263 672 * 673 * @covers ::dbDelta 642 674 */ 643 675 function test_query_with_backticks_does_not_cause_a_query_to_alter_all_columns_and_indices_to_run_even_if_none_have_changed() { 644 676 global $wpdb; … … 668 700 669 701 /** 670 702 * @ticket 20263 703 * 704 * @covers ::dbDelta 671 705 */ 672 706 function test_index_with_a_reserved_keyword_can_be_created() { 673 707 global $wpdb; … … 704 738 705 739 /** 706 740 * @ticket 20263 741 * 742 * @covers ::dbDelta 707 743 */ 708 744 function test_wp_get_db_schema_does_no_alter_queries_on_existing_install() { 709 745 $updates = dbDelta( wp_get_db_schema() ); … … 713 749 714 750 /** 715 751 * @ticket 20263 752 * 753 * @covers ::dbDelta 716 754 */ 717 755 function test_key_and_index_and_fulltext_key_and_fulltext_index_and_unique_key_and_unique_index_indicies() { 718 756 global $wpdb; … … 751 789 752 790 /** 753 791 * @ticket 20263 792 * 793 * @covers ::dbDelta 754 794 */ 755 795 function test_index_and_key_are_synonyms_and_do_not_recreate_indices() { 756 796 global $wpdb; … … 775 815 776 816 /** 777 817 * @ticket 20263 818 * 819 * @covers ::dbDelta 778 820 */ 779 821 function test_indices_with_prefix_limits_are_created_and_do_not_recreate_indices() { 780 822 global $wpdb; … … 809 851 810 852 /** 811 853 * @ticket 34959 854 * 855 * @covers ::dbDelta 812 856 */ 813 857 function test_index_col_names_with_order_do_not_recreate_indices() { 814 858 global $wpdb; … … 833 877 834 878 /** 835 879 * @ticket 34873 880 * 881 * @covers ::dbDelta 836 882 */ 837 883 function test_primary_key_with_single_space_does_not_recreate_index() { 838 884 global $wpdb; … … 857 903 858 904 /** 859 905 * @ticket 34869 906 * 907 * @covers ::dbDelta 860 908 */ 861 909 function test_index_definitions_with_spaces_do_not_recreate_indices() { 862 910 global $wpdb; … … 881 929 882 930 /** 883 931 * @ticket 34871 932 * 933 * @covers ::dbDelta 884 934 */ 885 935 function test_index_types_are_not_case_sensitive_and_do_not_recreate_indices() { 886 936 global $wpdb; … … 905 955 906 956 /** 907 957 * @ticket 34874 958 * 959 * @covers ::dbDelta 908 960 */ 909 961 function test_key_names_are_not_case_sensitive_and_do_not_recreate_indices() { 910 962 global $wpdb; … … 930 982 931 983 /** 932 984 * @ticket 34870 985 * 986 * @covers ::dbDelta 933 987 */ 934 988 function test_unchanged_key_lengths_do_not_recreate_index() { 935 989 global $wpdb; … … 955 1009 956 1010 /** 957 1011 * @ticket 34870 1012 * 1013 * @covers ::dbDelta 958 1014 */ 959 1015 function test_changed_key_lengths_do_not_recreate_index() { 960 1016 global $wpdb; … … 1039 1095 1040 1096 /** 1041 1097 * @ticket 31679 1098 * 1099 * @covers ::dbDelta 1042 1100 */ 1043 1101 function test_column_type_change_with_hyphens_in_name() { 1044 1102 global $wpdb; -
tests/phpunit/tests/dependencies.php
4 4 * @group scripts 5 5 */ 6 6 class Tests_Dependencies extends WP_UnitTestCase { 7 8 /** 9 * 10 * @covers WP_Dependencies::add 11 */ 7 12 function test_add() { 8 13 $dep = new WP_Dependencies; 9 14 … … 16 21 // Cannot reuse names. 17 22 $this->assertFalse( $dep->add( 'one', '' ) ); 18 23 } 19 24 /** 25 * 26 * @covers WP_Dependencies::remove 27 */ 20 28 function test_remove() { 21 29 $dep = new WP_Dependencies; 22 30 … … 29 37 $this->assertInstanceOf( '_WP_Dependency', $dep->query( 'two' ) ); 30 38 31 39 } 32 40 /** 41 * 42 * @covers WP_Dependencies::enqueue 43 */ 33 44 function test_enqueue() { 34 45 $dep = new WP_Dependencies; 35 46 … … 45 56 $this->assertTrue( $dep->query( 'one', 'queue' ) ); 46 57 $this->assertTrue( $dep->query( 'two', 'queue' ) ); 47 58 } 48 59 /** 60 * 61 * @covers WP_Dependencies::dequeue 62 */ 49 63 function test_dequeue() { 50 64 $dep = new WP_Dependencies; 51 65 … … 65 79 $this->assertFalse( $dep->query( 'one', 'queue' ) ); 66 80 $this->assertFalse( $dep->query( 'two', 'queue' ) ); 67 81 } 68 82 /** 83 * 84 * @covers WP_Dependencies::enqueue 85 */ 69 86 function test_enqueue_args() { 70 87 $dep = new WP_Dependencies; 71 88 … … 83 100 $this->assertTrue( $dep->query( 'two', 'queue' ) ); 84 101 $this->assertEquals( 'arg', $dep->args['two'] ); 85 102 } 86 103 /** 104 * 105 * @covers WP_Dependencies::dequeue 106 */ 87 107 function test_dequeue_args() { 88 108 $dep = new WP_Dependencies; 89 109 … … 110 130 111 131 /** 112 132 * @ticket 21741 133 * 134 * @covers WP_Dependencies::query 113 135 */ 114 136 function test_query_and_registered_enqueued() { 115 137 $dep = new WP_Dependencies; -
tests/phpunit/tests/dependencies/scripts.php
1045 1045 * Testing `wp_enqueue_code_editor` with file path. 1046 1046 * 1047 1047 * @ticket 41871 1048 * @covers ::wp_enqueue_code_editor ()1048 * @covers ::wp_enqueue_code_editor 1049 1049 */ 1050 1050 public function test_wp_enqueue_code_editor_when_php_file_will_be_passed() { 1051 1051 $real_file = WP_PLUGIN_DIR . '/hello.php'; … … 1132 1132 * Testing `wp_enqueue_code_editor` with `compact`. 1133 1133 * 1134 1134 * @ticket 41871 1135 * @covers ::wp_enqueue_code_editor ()1135 * @covers ::wp_enqueue_code_editor 1136 1136 */ 1137 1137 public function test_wp_enqueue_code_editor_when_generated_array_by_compact_will_be_passed() { 1138 1138 $file = ''; … … 1215 1215 * Testing `wp_enqueue_code_editor` with `array_merge`. 1216 1216 * 1217 1217 * @ticket 41871 1218 * @covers ::wp_enqueue_code_editor ()1218 * @covers ::wp_enqueue_code_editor 1219 1219 */ 1220 1220 public function test_wp_enqueue_code_editor_when_generated_array_by_array_merge_will_be_passed() { 1221 1221 $wp_enqueue_code_editor = wp_enqueue_code_editor( … … 1312 1312 * Testing `wp_enqueue_code_editor` with `array`. 1313 1313 * 1314 1314 * @ticket 41871 1315 * @covers ::wp_enqueue_code_editor ()1315 * @covers ::wp_enqueue_code_editor 1316 1316 */ 1317 1317 public function test_wp_enqueue_code_editor_when_simple_array_will_be_passed() { 1318 1318 $wp_enqueue_code_editor = wp_enqueue_code_editor( -
tests/phpunit/tests/file.php
16 16 /** 17 17 * @group plugins 18 18 * @group themes 19 * 20 * @cover ::get_file_data 19 21 */ 20 22 function test_get_file_data() { 21 23 $theme_headers = array( … … 46 48 /** 47 49 * @group plugins 48 50 * @group themes 51 * 52 * @cover ::get_file_data 49 53 */ 50 54 function test_get_file_data_cr_line_endings() { 51 55 $headers = array( … … 88 92 return $result; 89 93 } 90 94 95 /** 96 * 97 * @cover ::wp_unique_filename 98 */ 91 99 function test_unique_filename_is_valid() { 92 100 // Make sure it produces a valid, writable, unique filename. 93 101 $filename = wp_unique_filename( $this->dir, __FUNCTION__ . '.txt' ); … … 97 105 unlink( $this->dir . DIRECTORY_SEPARATOR . $filename ); 98 106 } 99 107 108 /** 109 * 110 * @cover ::wp_unique_filename 111 */ 100 112 function test_unique_filename_is_unique() { 101 113 // Make sure it produces two unique filenames. 102 114 $name = __FUNCTION__; … … 113 125 unlink( $this->dir . DIRECTORY_SEPARATOR . $filename2 ); 114 126 } 115 127 128 /** 129 * 130 * @cover ::wp_unique_filename 131 */ 116 132 function test_unique_filename_is_sanitized() { 117 133 $name = __FUNCTION__; 118 134 $filename = wp_unique_filename( $this->dir, $name . $this->badchars . '.txt' ); … … 125 141 unlink( $this->dir . DIRECTORY_SEPARATOR . $filename ); 126 142 } 127 143 144 /** 145 * 146 * @cover ::wp_unique_filename 147 */ 128 148 function test_unique_filename_with_slashes() { 129 149 $name = __FUNCTION__; 130 150 // "foo/foo.txt" … … 138 158 unlink( $this->dir . DIRECTORY_SEPARATOR . $filename ); 139 159 } 140 160 161 /** 162 * 163 * @cover ::wp_unique_filename 164 */ 141 165 function test_unique_filename_multiple_ext() { 142 166 $name = __FUNCTION__; 143 167 $filename = wp_unique_filename( $this->dir, $name . '.php.txt' ); … … 150 174 unlink( $this->dir . DIRECTORY_SEPARATOR . $filename ); 151 175 } 152 176 177 /** 178 * 179 * @cover ::wp_unique_filename 180 */ 153 181 function test_unique_filename_no_ext() { 154 182 $name = __FUNCTION__; 155 183 $filename = wp_unique_filename( $this->dir, $name ); … … 163 191 164 192 /** 165 193 * @dataProvider data_wp_tempnam_filenames 194 * 195 * @cover ::wp_tempnam 166 196 */ 167 197 function test_wp_tempnam( $case ) { 168 198 $file = wp_tempnam( $case ); … … 183 213 184 214 /** 185 215 * @ticket 47186 216 * 217 * @cover ::verify_file_signature 186 218 */ 187 219 function test_file_signature_functions_as_expected() { 188 220 $file = wp_tempnam(); … … 216 248 217 249 /** 218 250 * @ticket 47186 251 * 252 * @cover ::verify_file_signature 219 253 */ 220 254 function test_file_signature_expected_failure() { 221 255 $file = wp_tempnam(); -
tests/phpunit/tests/filters.php
7 7 */ 8 8 class Tests_Filters extends WP_UnitTestCase { 9 9 10 /** 11 * @covers ::add_filter 12 */ 10 13 function test_simple_filter() { 11 14 $a = new MockAction(); 12 15 $tag = __FUNCTION__; … … 25 28 $this->assertEquals( array( $val ), $args ); 26 29 } 27 30 31 /** 32 * @covers ::remove_filter 33 */ 28 34 function test_remove_filter() { 29 35 $a = new MockAction(); 30 36 $tag = __FUNCTION__; … … 45 51 46 52 } 47 53 54 /** 55 * @covers ::has_filter 56 */ 48 57 function test_has_filter() { 49 58 $tag = __FUNCTION__; 50 59 $func = __FUNCTION__ . '_func'; … … 59 68 $this->assertFalse( has_filter( $tag ) ); 60 69 } 61 70 62 // One tag with multiple filters. 71 /** 72 * One tag with multiple filters. 73 * 74 * @covers ::add_filter 75 */ 63 76 function test_multiple_filters() { 64 77 $a1 = new MockAction(); 65 78 $a2 = new MockAction(); … … 77 90 $this->assertEquals( 1, $a2->get_call_count() ); 78 91 } 79 92 93 /** 94 * One tag with multiple filters. 95 * 96 * @covers ::add_filter 97 */ 80 98 function test_filter_args_1() { 81 99 $a = new MockAction(); 82 100 $tag = __FUNCTION__; … … 92 110 $this->assertEquals( array( $val, $arg1 ), array_pop( $argsvar ) ); 93 111 } 94 112 113 /** 114 * One tag with multiple filters. 115 * 116 * @covers ::add_filter 117 */ 95 118 function test_filter_args_2() { 96 119 $a1 = new MockAction(); 97 120 $a2 = new MockAction(); … … 117 140 $this->assertEquals( array( $val ), array_pop( $argsvar2 ) ); 118 141 } 119 142 143 /** 144 * One tag with multiple filters. 145 * 146 * @covers ::add_filter 147 */ 120 148 function test_filter_priority() { 121 149 $a = new MockAction(); 122 150 $tag = __FUNCTION__; … … 148 176 $this->assertEquals( $expected, $a->get_events() ); 149 177 } 150 178 179 /** 180 * One tag with multiple filters. 181 * 182 * @covers ::add_filter 183 */ 151 184 function test_all_filter() { 152 185 $a = new MockAction(); 153 186 $tag1 = __FUNCTION__ . '_1'; … … 172 205 173 206 } 174 207 208 /** 209 * One tag with multiple filters. 210 * 211 * @covers ::add_filter 212 */ 175 213 function test_remove_all_filter() { 176 214 $a = new MockAction(); 177 215 $tag = __FUNCTION__; … … 198 236 199 237 /** 200 238 * @ticket 20920 239 * 240 * @covers ::add_filter 201 241 */ 202 242 function test_remove_all_filters_should_respect_the_priority_argument() { 203 243 $a = new MockAction(); … … 217 257 218 258 /** 219 259 * @ticket 9886 260 * 261 * @covers ::add_filter 220 262 */ 221 263 function test_filter_ref_array() { 222 264 $obj = new stdClass(); … … 236 278 237 279 /** 238 280 * @ticket 12723 281 * 282 * @covers ::add_filter 239 283 */ 240 284 function test_filter_ref_array_result() { 241 285 $obj = new stdClass(); … … 271 315 272 316 /** 273 317 * @ticket 29070 318 * 319 * @covers ::has_filter 274 320 */ 275 321 function test_has_filter_after_remove_all_filters() { 276 322 $a = new MockAction(); … … 298 344 /** 299 345 * @ticket 10441 300 346 * @expectedDeprecated tests_apply_filters_deprecated 347 * 348 * @covers ::apply_filters_deprecated 301 349 */ 302 350 public function test_apply_filters_deprecated() { 303 351 $p = 'Foo'; … … 317 365 /** 318 366 * @ticket 10441 319 367 * @expectedDeprecated tests_apply_filters_deprecated 368 * 369 * @covers ::apply_filters_deprecated 320 370 */ 321 371 public function test_apply_filters_deprecated_with_multiple_params() { 322 372 $p1 = 'Foo1'; … … 341 391 342 392 /** 343 393 * @ticket 10441 394 * 395 * @covers ::apply_filters_deprecated 344 396 */ 345 397 public function test_apply_filters_deprecated_without_filter() { 346 398 $val = 'Foobar'; … … 351 403 private $current_priority; 352 404 /** 353 405 * @ticket 39007 406 * 407 * @covers ::add_action 354 408 */ 355 409 public function test_current_priority() { 356 410 add_action( 'test_current_priority', array( $this, '_current_priority_action' ), 99 ); … … 360 414 $this->assertSame( 99, $this->current_priority ); 361 415 } 362 416 417 /** 418 * One tag with multiple filters. 419 */ 363 420 public function _current_priority_action() { 364 421 global $wp_filter; 365 422 $this->current_priority = $wp_filter[ current_filter() ]->current_priority(); … … 367 424 368 425 /** 369 426 * @ticket 39007 427 * 428 * @covers ::add_action 370 429 */ 371 430 public function test_other_priority() { 372 431 add_action( 'test_current_priority', array( $this, '_other_priority_action' ), 99 ); -
tests/phpunit/tests/functions.php
4 4 * @group functions.php 5 5 */ 6 6 class Tests_Functions extends WP_UnitTestCase { 7 8 /** 9 * 10 * @covers ::wp_parse_args 11 */ 7 12 function test_wp_parse_args_object() { 8 13 $x = new MockClass; 9 14 $x->_baba = 5; … … 21 26 $this->assertEquals( array(), wp_parse_args( $y ) ); 22 27 } 23 28 29 30 /** 31 * 32 * @covers ::wp_parse_args 33 */ 24 34 function test_wp_parse_args_array() { 25 35 // Arrays. 26 36 $a = array(); … … 40 50 ); 41 51 } 42 52 53 54 /** 55 * 56 * @covers ::wp_parse_args 57 */ 43 58 function test_wp_parse_args_defaults() { 44 59 $x = new MockClass; 45 60 $x->_baba = 5; … … 66 81 ); 67 82 } 68 83 84 85 /** 86 * 87 * @covers ::wp_parse_args 88 */ 69 89 function test_wp_parse_args_other() { 70 90 $b = true; 71 91 wp_parse_str( $b, $s ); … … 77 97 78 98 /** 79 99 * @ticket 30753 100 * 101 * @covers ::wp_parse_args 80 102 */ 81 103 function test_wp_parse_args_boolean_strings() { 82 104 $args = wp_parse_args( 'foo=false&bar=true' ); … … 86 108 87 109 /** 88 110 * @ticket 35972 111 * 112 * @covers ::bool_from_yn 89 113 */ 90 114 function test_bool_from_yn() { 91 115 $this->assertTrue( bool_from_yn( 'Y' ) ); … … 93 117 $this->assertFalse( bool_from_yn( 'n' ) ); 94 118 } 95 119 120 /** 121 * 122 * @covers ::path_is_absolute 123 */ 96 124 function test_path_is_absolute() { 97 125 $absolute_paths = array( 98 126 '/', … … 111 139 } 112 140 } 113 141 142 /** 143 * 144 * @covers ::path_is_absolute 145 */ 114 146 function test_path_is_not_absolute() { 115 147 $relative_paths = array( 116 148 '', … … 134 166 * @ticket 35996 135 167 * 136 168 * @dataProvider data_wp_normalize_path 169 * @covers ::wp_normalize_path 137 170 */ 138 171 function test_wp_normalize_path( $path, $expected ) { 139 172 $this->assertEquals( $expected, wp_normalize_path( $path ) ); … … 163 196 ); 164 197 } 165 198 199 200 /** 201 * 202 * @covers ::wp_unique_filename 203 */ 166 204 function test_wp_unique_filename() { 167 205 168 206 $testdir = DIR_TESTDATA . '/images/'; … … 198 236 199 237 /** 200 238 * @ticket 42437 239 * 240 * @covers ::wp_unique_filename 201 241 */ 202 242 function test_unique_filename_with_dimension_like_filename() { 203 243 $testdir = DIR_TESTDATA . '/images/'; … … 223 263 224 264 /** 225 265 * @dataProvider data_is_not_serialized 266 * 267 * @covers ::serialize 226 268 */ 227 269 function test_maybe_serialize( $value ) { 228 270 if ( is_array( $value ) || is_object( $value ) ) { … … 236 278 237 279 /** 238 280 * @dataProvider data_is_serialized 281 * 282 * @covers ::serialize 239 283 */ 240 284 function test_maybe_serialize_with_double_serialization( $value ) { 241 285 $expected = serialize( $value ); … … 246 290 /** 247 291 * @dataProvider data_is_serialized 248 292 * @dataProvider data_is_not_serialized 293 * 294 * @covers ::maybe_unserialize 249 295 */ 250 296 function test_maybe_unserialize( $value, $is_serialized ) { 251 297 if ( $is_serialized ) { … … 264 310 /** 265 311 * @dataProvider data_is_serialized 266 312 * @dataProvider data_is_not_serialized 313 * 314 * @covers ::is_serialized 267 315 */ 268 316 function test_is_serialized( $value, $expected ) { 269 317 $this->assertSame( $expected, is_serialized( $value ) ); … … 324 372 /** 325 373 * @ticket 46570 326 374 * @dataProvider data_is_serialized_should_return_true_for_large_floats 375 * 376 * @covers ::is_serialized 327 377 */ 328 378 function test_is_serialized_should_return_true_for_large_floats( $value ) { 329 379 $this->assertTrue( is_serialized( $value ) ); … … 338 388 339 389 /** 340 390 * @ticket 17375 391 * 392 * @covers ::is_serialized 341 393 */ 342 394 function test_no_new_serializable_types() { 343 395 $this->assertFalse( is_serialized( 'C:16:"Serialized_Class":6:{a:0:{}}' ) ); … … 345 397 346 398 /** 347 399 * @group add_query_arg 400 * 401 * @covers ::add_query_arg 348 402 */ 349 403 function test_add_query_arg() { 350 404 $old_req_uri = $_SERVER['REQUEST_URI']; … … 533 587 534 588 /** 535 589 * @ticket 31306 590 * 591 * @covers ::add_query_arg 536 592 */ 537 593 function test_add_query_arg_numeric_keys() { 538 594 $url = add_query_arg( array( 'foo' => 'bar' ), '1=1' ); … … 553 609 554 610 /** 555 611 * @ticket 21594 612 * 613 * @covers ::get_allowed_mime_types 556 614 */ 557 615 function test_get_allowed_mime_types() { 558 616 $mimes = get_allowed_mime_types(); … … 573 631 574 632 /** 575 633 * @ticket 21594 634 * 635 * @covers ::wp_get_mime_types 576 636 */ 577 637 function test_wp_get_mime_types() { 578 638 $mimes = wp_get_mime_types(); … … 605 665 606 666 /** 607 667 * @ticket 23688 668 * 669 * @covers ::get_option 670 * @covers ::_canonical_charset 608 671 */ 609 672 function test_canonical_charset() { 610 673 $orig_blog_charset = get_option( 'blog_charset' ); … … 643 706 /** 644 707 * @ticket 43977 645 708 * @dataProvider data_wp_parse_list 709 * 710 * @covers ::wp_parse_list 646 711 */ 647 712 function test_wp_parse_list( $expected, $actual ) { 648 713 $this->assertSame( $expected, array_values( wp_parse_list( $actual ) ) ); … … 666 731 667 732 /** 668 733 * @dataProvider data_wp_parse_id_list 734 * 735 * @covers ::wp_parse_id_list 669 736 */ 670 737 function test_wp_parse_id_list( $expected, $actual ) { 671 738 $this->assertSame( $expected, array_values( wp_parse_id_list( $actual ) ) ); … … 701 768 702 769 /** 703 770 * @dataProvider data_device_can_upload 771 * 772 * @covers ::_device_can_upload 704 773 */ 705 774 function test_device_can_upload( $user_agent, $expected ) { 706 775 $_SERVER['HTTP_USER_AGENT'] = $user_agent; … … 761 830 762 831 /** 763 832 * @ticket 9064 833 * 834 * @covers ::wp_extract_urls 764 835 */ 765 836 function test_wp_extract_urls() { 766 837 $original_urls = array( … … 928 999 929 1000 /** 930 1001 * @ticket 28786 1002 * 1003 * @covers ::wp_json_encode 931 1004 */ 932 1005 function test_wp_json_encode() { 933 1006 $this->assertEquals( wp_json_encode( 'a' ), '"a"' ); … … 935 1008 936 1009 /** 937 1010 * @ticket 28786 1011 * 1012 * @covers ::wp_json_encode 938 1013 */ 939 1014 function test_wp_json_encode_utf8() { 940 1015 $this->assertEquals( wp_json_encode( '这' ), '"\u8fd9"' ); … … 942 1017 943 1018 /** 944 1019 * @ticket 28786 1020 * 1021 * @covers ::wp_json_encode 945 1022 */ 946 1023 function test_wp_json_encode_non_utf8() { 947 1024 if ( ! function_exists( 'mb_detect_order' ) ) { … … 967 1044 968 1045 /** 969 1046 * @ticket 28786 1047 * 1048 * @covers ::wp_json_encode 970 1049 */ 971 1050 function test_wp_json_encode_non_utf8_in_array() { 972 1051 if ( ! function_exists( 'mb_detect_order' ) ) { … … 992 1071 993 1072 /** 994 1073 * @ticket 28786 1074 * 1075 * @covers ::wp_json_encode 995 1076 */ 996 1077 function test_wp_json_encode_array() { 997 1078 $this->assertEquals( wp_json_encode( array( 'a' ) ), '["a"]' ); … … 999 1080 1000 1081 /** 1001 1082 * @ticket 28786 1083 * 1084 * @covers ::wp_json_encode 1002 1085 */ 1003 1086 function test_wp_json_encode_object() { 1004 1087 $object = new stdClass; … … 1008 1091 1009 1092 /** 1010 1093 * @ticket 28786 1094 * 1095 * @covers ::wp_json_encode 1011 1096 */ 1012 1097 function test_wp_json_encode_depth() { 1013 1098 $data = array( array( array( 1, 2, 3 ) ) ); … … 1022 1107 /** 1023 1108 * @ticket 36054 1024 1109 * @dataProvider datetime_provider 1110 * 1111 * @covers ::mysql_to_rfc3339 1025 1112 */ 1026 1113 function test_mysql_to_rfc3339( $expected, $actual ) { 1027 1114 $date_return = mysql_to_rfc3339( $actual ); … … 1044 1131 1045 1132 /** 1046 1133 * @ticket 35987 1134 * 1135 * @covers ::wp_get_ext_types 1047 1136 */ 1048 1137 public function test_wp_get_ext_types() { 1049 1138 $extensions = wp_get_ext_types(); … … 1063 1152 1064 1153 /** 1065 1154 * @ticket 35987 1155 * 1156 * @covers ::wp_get_ext_types 1066 1157 */ 1067 1158 public function test_wp_ext2type() { 1068 1159 $extensions = wp_get_ext_types(); … … 1084 1175 * test suite is -1, we can not test the memory limit negotiations. 1085 1176 * 1086 1177 * @ticket 32075 1178 * 1179 * @covers ::wp_raise_memory_limit 1087 1180 */ 1088 1181 function test_wp_raise_memory_limit() { 1089 1182 if ( -1 !== WP_MAX_MEMORY_LIMIT ) { … … 1102 1195 /** 1103 1196 * Tests wp_generate_uuid4(). 1104 1197 * 1198 * @ticket 38164 1199 * 1105 1200 * @covers ::wp_generate_uuid4 1106 * @ticket 381641107 1201 */ 1108 1202 function test_wp_generate_uuid4() { 1109 1203 $uuids = array(); … … 1120 1214 /** 1121 1215 * Tests wp_is_uuid(). 1122 1216 * 1217 * @ticket 39778 1218 * 1123 1219 * @covers ::wp_is_uuid 1124 * @ticket 397781125 1220 */ 1126 1221 function test_wp_is_valid_uuid() { 1127 1222 $uuids_v4 = array( … … 1170 1265 /** 1171 1266 * Tests wp_unique_id(). 1172 1267 * 1268 * @ticket 44883 1269 * 1173 1270 * @covers ::wp_unique_id 1174 * @ticket 448831175 1271 */ 1176 1272 function test_wp_unique_id() { 1177 1273 … … 1198 1294 /** 1199 1295 * @ticket 40017 1200 1296 * @dataProvider _wp_get_image_mime 1297 * 1298 * @covers ::wp_get_image_mime 1201 1299 */ 1202 1300 public function test_wp_get_image_mime( $file, $expected ) { 1203 1301 if ( ! is_callable( 'exif_imagetype' ) && ! function_exists( 'getimagesize' ) ) { … … 1210 1308 /** 1211 1309 * @ticket 39550 1212 1310 * @dataProvider _wp_check_filetype_and_ext_data 1311 * 1312 * @covers ::wp_check_filetype_and_ext 1213 1313 */ 1214 1314 function test_wp_check_filetype_and_ext( $file, $filename, $expected ) { 1215 1315 if ( ! extension_loaded( 'fileinfo' ) ) { … … 1222 1322 /** 1223 1323 * @ticket 39550 1224 1324 * @group ms-excluded 1325 * 1326 * @covers ::wp_check_filetype_and_ext 1225 1327 */ 1226 1328 function test_wp_check_filetype_and_ext_with_filtered_svg() { 1227 1329 if ( ! extension_loaded( 'fileinfo' ) ) { … … 1247 1349 /** 1248 1350 * @ticket 39550 1249 1351 * @group ms-excluded 1352 * 1353 * @covers ::wp_check_filetype_and_ext 1250 1354 */ 1251 1355 function test_wp_check_filetype_and_ext_with_filtered_woff() { 1252 1356 if ( ! extension_loaded( 'fileinfo' ) ) { … … 1488 1592 * @param string $file File path. 1489 1593 * @param array $allowed_files List of allowed files. 1490 1594 * @param int $expected Expected result. 1595 * 1596 * @covers ::validate_file 1491 1597 */ 1492 1598 public function test_validate_file( $file, $allowed_files, $expected ) { 1493 1599 $this->assertSame( $expected, validate_file( $file, $allowed_files ) ); … … 1630 1736 * 1631 1737 * @param string $path The resource path or URL. 1632 1738 * @param bool $expected Expected result. 1739 * 1740 * @covers ::wp_is_stream 1633 1741 */ 1634 1742 public function test_wp_is_stream( $path, $expected ) { 1635 1743 if ( ! extension_loaded( 'openssl' ) && false !== strpos( $path, 'https://' ) ) { … … 1674 1782 * 1675 1783 * @param string $input Duration. 1676 1784 * @param string $expected Expected human readable duration. 1785 * 1786 * @covers ::human_readable_duration 1677 1787 */ 1678 1788 public function test_human_readable_duration( $input, $expected ) { 1679 1789 $this->assertSame( $expected, human_readable_duration( $input ) ); -
tests/phpunit/tests/kses.php
9 9 10 10 /** 11 11 * @ticket 20210 12 * 13 * @covers ::wp_kses 12 14 */ 13 15 function test_wp_filter_post_kses_address() { 14 16 global $allowedposttags; … … 36 38 37 39 /** 38 40 * @ticket 20210 41 * 42 * @covers ::wp_kses 39 43 */ 40 44 function test_wp_filter_post_kses_a() { 41 45 global $allowedposttags; … … 77 81 * @param string $source Source HTML. 78 82 * @param string $context Context to use for parsing source. 79 83 * @param string $expected Expected output following KSES parsing. 84 * 85 * @covers ::wp_kses 80 86 */ 81 87 function test_wp_kses_video( $source, $context, $expected ) { 82 88 $actual = wp_kses( $source, $context ); … … 123 129 124 130 /** 125 131 * @ticket 20210 132 * 133 * @covers ::wp_kses 126 134 */ 127 135 function test_wp_filter_post_kses_abbr() { 128 136 global $allowedposttags; … … 141 149 } 142 150 } 143 151 152 /** 153 * 154 * @covers ::wp_kses 155 */ 144 156 function test_feed_links() { 145 157 global $allowedposttags; 146 158 … … 175 187 $this->assertEquals( $expected, wp_kses( $content, $allowedposttags ) ); 176 188 } 177 189 190 /** 191 * 192 * @covers ::wp_kses_bad_protocol 193 */ 178 194 function test_wp_kses_bad_protocol() { 179 195 $bad = array( 180 196 'dummy:alert(1)', … … 277 293 } 278 294 } 279 295 296 /** 297 * 298 * @covers ::wp_kses_data 299 */ 280 300 public function test_hackers_attacks() { 281 301 $xss = simplexml_load_file( DIR_TESTDATA . '/formatting/xssAttacks.xml' ); 282 302 foreach ( $xss->attack as $attack ) { … … 421 441 422 442 /** 423 443 * @ticket 20210 444 * 445 * @covers ::wp_kses_allowed_html 424 446 */ 425 447 public function test_wp_kses_allowed_html() { 426 448 global $allowedposttags, $allowedtags, $allowedentitynames; … … 470 492 $this->assertEquals( $allowedtags, wp_kses_allowed_html( 'data' ) ); 471 493 } 472 494 495 /** 496 * 497 * @covers ::wp_kses_post 498 */ 473 499 function test_hyphenated_tag() { 474 500 $string = '<hyphenated-tag attribute="value" otherattribute="value2">Alot of hyphens.</hyphenated-tag>'; 475 501 $custom_tags = array( … … 486 512 487 513 /** 488 514 * @ticket 26290 515 * 516 * @covers ::wp_kses_normalize_entities 489 517 */ 490 518 public function test_wp_kses_normalize_entities() { 491 519 $this->assertEquals( '♠', wp_kses_normalize_entities( '♠' ) ); … … 504 532 * 505 533 * @ticket 28506 506 534 * @dataProvider data_ctrl_removal 535 * 536 * @covers ::wp_kses 507 537 */ 508 538 function test_ctrl_removal( $input, $output ) { 509 539 global $allowedposttags; … … 541 571 * 542 572 * @ticket 28699 543 573 * @dataProvider data_slash_zero_removal 574 * 575 * @covers ::wp_kses 544 576 */ 545 577 function test_slash_zero_removal( $input, $output ) { 546 578 global $allowedposttags; … … 593 625 * Test new function wp_kses_hair_parse(). 594 626 * 595 627 * @dataProvider data_hair_parse 628 * 629 * @covers ::wp_kses_hair_parse 596 630 */ 597 631 function test_hair_parse( $input, $output ) { 598 632 return $this->assertEquals( $output, wp_kses_hair_parse( $input ) ); … … 659 693 * Test new function wp_kses_attr_parse(). 660 694 * 661 695 * @dataProvider data_attr_parse 696 * 697 * @covers ::wp_kses_attr_parse 662 698 */ 663 699 function test_attr_parse( $input, $output ) { 664 700 return $this->assertEquals( $output, wp_kses_attr_parse( $input ) ); … … 717 753 * Test new function wp_kses_one_attr(). 718 754 * 719 755 * @dataProvider data_one_attr 756 * 757 * @covers ::wp_kses_one_attr 720 758 */ 721 759 function test_one_attr( $element, $input, $output ) { 722 760 return $this->assertEquals( $output, wp_kses_one_attr( $input, $element ) ); … … 794 832 795 833 /** 796 834 * @ticket 34063 835 * 836 * @covers ::wp_kses 797 837 */ 798 838 function test_bdo() { 799 839 global $allowedposttags; … … 805 845 806 846 /** 807 847 * @ticket 35079 848 * 849 * @covers ::wp_kses 808 850 */ 809 851 function test_ol_reversed() { 810 852 global $allowedposttags; … … 816 858 817 859 /** 818 860 * @ticket 40680 861 * 862 * @covers ::wp_kses_attr 819 863 */ 820 864 function test_wp_kses_attr_no_attributes_allowed_with_empty_array() { 821 865 $element = 'foo'; … … 826 870 827 871 /** 828 872 * @ticket 40680 873 * 874 * @covers ::wp_kses_attr 829 875 */ 830 876 function test_wp_kses_attr_no_attributes_allowed_with_true() { 831 877 $element = 'foo'; … … 836 882 837 883 /** 838 884 * @ticket 40680 885 * 886 * @covers ::wp_kses_attr 839 887 */ 840 888 function test_wp_kses_attr_single_attribute_is_allowed() { 841 889 $element = 'foo'; … … 846 894 847 895 /** 848 896 * @ticket 43312 897 * 898 * @covers ::wp_kses_attr 849 899 */ 850 900 function test_wp_kses_attr_no_attributes_allowed_with_false() { 851 901 $element = 'foo'; … … 864 914 * 865 915 * @param string $css A string of CSS rules. 866 916 * @param string $expected Expected string of CSS rules. 917 * 918 * @covers ::safecss_filter_attr 867 919 */ 868 920 public function test_safecss_filter_attr( $css, $expected ) { 869 921 $this->assertSame( $expected, safecss_filter_attr( $css ) ); … … 1052 1104 * Data attributes are globally accepted. 1053 1105 * 1054 1106 * @ticket 33121 1107 * 1108 * @covers ::wp_kses_post 1055 1109 */ 1056 1110 function test_wp_kses_attr_data_attribute_is_allowed() { 1057 1111 $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>'; … … 1064 1118 * Ensure wildcard attributes block unprefixed wildcard uses. 1065 1119 * 1066 1120 * @ticket 33121 1121 * 1122 * @covers ::wp_kses 1067 1123 */ 1068 1124 function test_wildcard_requires_hyphen_after_prefix() { 1069 1125 $allowed_html = array( … … 1085 1141 * Ensure wildcard allows two hyphen. 1086 1142 * 1087 1143 * @ticket 33121 1144 * 1145 * @covers ::wp_kses 1088 1146 */ 1089 1147 function test_wildcard_allows_two_hyphens() { 1090 1148 $allowed_html = array( … … 1107 1165 * @dataProvider data_wildcard_attribute_prefixes 1108 1166 * 1109 1167 * @ticket 33121 1168 * 1169 * @covers ::wp_kses_attr_check 1110 1170 */ 1111 1171 function test_wildcard_attribute_prefixes( $wildcard_attribute, $expected ) { 1112 1172 $allowed_html = array( … … 1152 1212 * 1153 1213 * @param $input string The style attribute saved in the editor. 1154 1214 * @param $expected string The sanitized style attribute. 1215 * 1216 * @covers ::safecss_filter_attr 1155 1217 */ 1156 1218 function test_kses_style_attr_with_url( $input, $expected ) { 1157 1219 $actual = safecss_filter_attr( $input ); … … 1299 1361 * 1300 1362 * @param string $css A string of CSS rules. 1301 1363 * @param string $expected Expected string of CSS rules. 1364 * 1365 * @covers ::safecss_filter_attr 1302 1366 */ 1303 1367 public function test_safecss_filter_attr_filtered( $css, $expected ) { 1304 1368 add_filter( 'safecss_filter_attr_allow_css', '__return_true' ); … … 1366 1430 * Test filtering a standard img tag. 1367 1431 * 1368 1432 * @ticket 50731 1433 * 1434 * @covers ::wp_kses_post 1369 1435 */ 1370 1436 function test_wp_kses_img_tag_standard_attributes() { 1371 1437 $html = array( -
tests/phpunit/tests/l10n.php
17 17 18 18 /** 19 19 * @ticket 35961 20 * 21 * @covers ::_n_noop 20 22 */ 21 23 function test_n_noop() { 22 24 $text_domain = 'text-domain'; … … 30 32 31 33 /** 32 34 * @ticket 35961 35 * 36 * @covers ::_nx_noop 33 37 */ 34 38 function test_nx_noop() { 35 39 $text_domain = 'text-domain'; … … 44 48 45 49 /** 46 50 * @ticket 35073 51 * 52 * @covers ::before_last_bar 47 53 */ 48 54 function test_before_last_bar() { 49 55 $this->assertEquals( 'no-bar-at-all', before_last_bar( 'no-bar-at-all' ) ); … … 53 59 54 60 /** 55 61 * @ticket 35950 62 * 63 * @covers ::get_available_languages 56 64 */ 57 65 function test_get_available_languages() { 58 66 $array = get_available_languages(); … … 67 75 68 76 /** 69 77 * @ticket 35284 78 * 79 * @covers ::wp_get_installed_translations 70 80 */ 71 81 function test_wp_get_installed_translations_for_core() { 72 82 $installed_translations = wp_get_installed_translations( 'core' ); … … 89 99 90 100 /** 91 101 * @ticket 35294 102 * 103 * @covers ::wp_dropdown_languages 92 104 */ 93 105 function test_wp_dropdown_languages() { 94 106 $args = array( … … 111 123 112 124 /** 113 125 * @ticket 38632 126 * 127 * @covers ::wp_dropdown_languages 114 128 */ 115 129 function test_wp_dropdown_languages_site_default() { 116 130 $args = array( … … 135 149 136 150 /** 137 151 * @ticket 44494 152 * 153 * @covers ::wp_dropdown_languages 138 154 */ 139 155 function test_wp_dropdown_languages_exclude_en_us() { 140 156 $args = array( … … 153 169 154 170 /** 155 171 * @ticket 38632 172 * 173 * @covers ::wp_dropdown_languages 156 174 */ 157 175 function test_wp_dropdown_languages_en_US_selected() { 158 176 $args = array( … … 175 193 176 194 /** 177 195 * Add site default language to ja_JP in dropdown 196 * 197 * @covers ::wp_dropdown_languages 178 198 */ 179 199 function test_wp_dropdown_languages_site_default_ja_JP() { 180 200 $args = array( … … 199 219 200 220 /** 201 221 * Select dropdown language from de_DE to ja_JP 222 * 223 * @covers ::wp_dropdown_languages 202 224 */ 203 225 function test_wp_dropdown_languages_ja_JP_selected() { 204 226 $args = array( … … 246 268 247 269 /** 248 270 * @ticket 35284 271 * 272 * @covers ::wp_get_pomo_file_data 249 273 */ 250 274 function test_wp_get_pomo_file_data() { 251 275 $file = DIR_TESTDATA . '/pomo/empty.po'; … … 272 296 273 297 /** 274 298 * @ticket 44541 299 * 300 * @covers ::the_excerpt 275 301 */ 276 302 function test_length_of_excerpt_should_be_counted_by_words() { 277 303 global $post; … … 296 322 297 323 /** 298 324 * @ticket 44541 325 * 326 * @covers ::the_excerpt 299 327 */ 300 328 function test_length_of_excerpt_should_be_counted_by_chars() { 301 329 global $post; … … 320 348 321 349 /** 322 350 * @ticket 44541 351 * 352 * @covers ::the_excerpt 323 353 */ 324 354 function test_length_of_excerpt_should_be_counted_by_chars_in_japanese() { 325 355 global $post; … … 344 374 345 375 /** 346 376 * @ticket 44541 377 * 378 * @covers ::the_excerpt_rss 347 379 */ 348 380 function test_length_of_excerpt_rss_should_be_counted_by_words() { 349 381 global $post; … … 368 400 369 401 /** 370 402 * @ticket 44541 403 * 404 * @covers ::the_excerpt_rss 371 405 */ 372 406 function test_length_of_excerpt_rss_should_be_counted_by_chars() { 373 407 global $post; … … 393 427 394 428 /** 395 429 * @ticket 44541 430 * 431 * @covers ::wp_dashboard_recent_drafts 396 432 */ 397 433 function test_length_of_draft_should_be_counted_by_words() { 398 434 require_once ABSPATH . 'wp-admin/includes/dashboard.php'; … … 417 453 418 454 /** 419 455 * @ticket 44541 456 * 457 * @covers ::wp_dashboard_recent_drafts 420 458 */ 421 459 function test_length_of_draft_should_be_counted_by_chars() { 422 460 require_once ABSPATH . 'wp-admin/includes/dashboard.php'; … … 441 479 442 480 /** 443 481 * @ticket 44541 482 * 483 * @covers ::wp_dashboard_recent_drafts 444 484 */ 445 485 function test_length_of_draft_should_be_counted_by_chars_in_japanese() { 446 486 require_once ABSPATH . 'wp-admin/includes/dashboard.php'; … … 465 505 466 506 /** 467 507 * @ticket 44541 508 * 509 * @covers ::get_comment_excerpt 468 510 */ 469 511 function test_length_of_comment_excerpt_should_be_counted_by_words() { 470 512 switch_to_locale( 'en_US' ); … … 483 525 484 526 /** 485 527 * @ticket 44541 528 * 529 * @covers ::get_comment_excerpt 486 530 */ 487 531 function test_length_of_comment_excerpt_should_be_counted_by_chars() { 488 532 switch_to_locale( 'ja_JP' ); … … 501 545 502 546 /** 503 547 * @ticket 44541 548 * 549 * @covers ::get_comment_excerpt 504 550 */ 505 551 function test_length_of_comment_excerpt_should_be_counted_by_chars_in_Japanese() { 506 552 switch_to_locale( 'ja_JP' ); -
tests/phpunit/tests/link.php
10 10 11 11 /** 12 12 * @ticket 8847 13 * 14 * @covers ::get_pagenum_link 13 15 */ 14 16 function test_get_pagenum_link_case_insensitivity() { 15 17 $old_req_uri = $_SERVER['REQUEST_URI']; … … 26 28 $_SERVER['REQUEST_URI'] = $old_req_uri; 27 29 } 28 30 31 /** 32 * 33 * @covers ::wp_get_shortlink 34 */ 29 35 function test_wp_get_shortlink() { 30 36 $post_id = self::factory()->post->create(); 31 37 $post_id2 = self::factory()->post->create(); … … 70 76 $this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() ); 71 77 } 72 78 79 /** 80 * 81 * @covers ::wp_get_shortlink 82 */ 73 83 function test_wp_get_shortlink_with_page() { 74 84 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 75 85 … … 84 94 85 95 /** 86 96 * @ticket 26871 97 * 98 * @covers ::wp_get_shortlink 87 99 */ 88 100 function test_wp_get_shortlink_with_home_page() { 89 101 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); … … 99 111 100 112 /** 101 113 * @ticket 30910 114 * 115 * @covers ::get_permalink 102 116 */ 103 117 public function test_get_permalink_should_not_reveal_post_name_for_post_with_post_status_future() { 104 118 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); … … 114 128 115 129 $non_pretty_permalink = add_query_arg( 'p', $p, trailingslashit( home_url() ) ); 116 130 117 $this->assert Equals( $non_pretty_permalink, get_permalink( $p ) );131 $this->assertSame( $non_pretty_permalink, get_permalink( $p ) ); 118 132 } 119 133 120 134 /** 121 135 * @ticket 30910 136 * 137 * @covers ::get_permalink 122 138 */ 123 139 public function test_get_permalink_should_not_reveal_post_name_for_cpt_with_post_status_future() { 124 140 update_option( 'permalink_structure', '/%year%/%monthnum%/%day%/%postname%/' ); … … 148 164 149 165 /** 150 166 * @ticket 1914 167 * 168 * @covers ::get_permalink 151 169 */ 152 170 public function test_unattached_attachment_has_a_pretty_permalink() { 153 171 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); … … 170 188 171 189 /** 172 190 * @ticket 1914 191 * 192 * @covers ::get_permalink 173 193 */ 174 194 public function test_attachment_attached_to_non_existent_post_type_has_a_pretty_permalink() { 175 195 global $wp_post_types; -
tests/phpunit/tests/locale.php
15 15 $this->locale = new WP_Locale(); 16 16 } 17 17 18 /** 19 * 20 * @covers WP_Locale::get_weekday 21 */ 18 22 public function test_get_weekday() { 19 23 $this->assertEquals( __( 'Sunday' ), $this->locale->get_weekday( 0 ) ); 20 24 $this->assertEquals( __( 'Monday' ), $this->locale->get_weekday( 1 ) ); … … 27 31 28 32 /** 29 33 * @expectedException PHPUnit_Framework_Error_Notice 34 * 35 * @covers WP_Locale::get_weekday 30 36 */ 31 37 public function test_get_weekday_undefined_index() { 32 38 $this->locale->get_weekday( 7 ); 33 39 } 34 40 41 /** 42 * 43 * @covers WP_Locale::get_weekday_initial 44 */ 35 45 public function test_get_weekday_initial() { 36 46 $this->assertEquals( __( 'S' ), $this->locale->get_weekday_initial( __( 'Sunday' ) ) ); 37 47 $this->assertEquals( __( 'M' ), $this->locale->get_weekday_initial( __( 'Monday' ) ) ); … … 42 52 $this->assertEquals( __( 'S' ), $this->locale->get_weekday_initial( __( 'Saturday' ) ) ); 43 53 } 44 54 55 /** 56 * 57 * @covers WP_Locale::get_weekday_abbrev 58 */ 45 59 public function test_get_weekday_abbrev() { 46 60 $this->assertEquals( __( 'Sun' ), $this->locale->get_weekday_abbrev( __( 'Sunday' ) ) ); 47 61 $this->assertEquals( __( 'Mon' ), $this->locale->get_weekday_abbrev( __( 'Monday' ) ) ); … … 52 66 $this->assertEquals( __( 'Sat' ), $this->locale->get_weekday_abbrev( __( 'Saturday' ) ) ); 53 67 } 54 68 69 /** 70 * 71 * @covers WP_Locale::get_month 72 */ 55 73 public function test_get_month() { 56 74 $this->assertEquals( __( 'January' ), $this->locale->get_month( 1 ) ); 57 75 $this->assertEquals( __( 'February' ), $this->locale->get_month( 2 ) ); … … 67 85 $this->assertEquals( __( 'December' ), $this->locale->get_month( 12 ) ); 68 86 } 69 87 88 /** 89 * 90 * @covers WP_Locale::get_month 91 */ 70 92 public function test_get_month_leading_zero() { 71 93 $this->assertEquals( __( 'January' ), $this->locale->get_month( '01' ) ); 72 94 $this->assertEquals( __( 'February' ), $this->locale->get_month( '02' ) ); … … 79 101 $this->assertEquals( __( 'September' ), $this->locale->get_month( '09' ) ); 80 102 } 81 103 104 /** 105 * 106 * @covers WP_Locale::get_month_abbrev 107 */ 82 108 public function test_get_month_abbrev() { 83 109 $this->assertEquals( __( 'Jan' ), $this->locale->get_month_abbrev( __( 'January' ) ) ); 84 110 $this->assertEquals( __( 'Feb' ), $this->locale->get_month_abbrev( __( 'February' ) ) ); … … 94 120 $this->assertEquals( __( 'Dec' ), $this->locale->get_month_abbrev( __( 'December' ) ) ); 95 121 } 96 122 123 /** 124 * 125 * @covers WP_Locale::get_meridiem 126 */ 97 127 public function test_get_meridiem() { 98 128 $this->assertEquals( __( 'am' ), $this->locale->get_meridiem( 'am' ) ); 99 129 $this->assertEquals( __( 'AM' ), $this->locale->get_meridiem( 'AM' ) ); … … 101 131 $this->assertEquals( __( 'PM' ), $this->locale->get_meridiem( 'PM' ) ); 102 132 } 103 133 134 /** 135 * 136 * @covers WP_Locale::is_rtl 137 */ 104 138 public function test_is_rtl() { 105 139 $this->assertFalse( $this->locale->is_rtl() ); 106 140 $this->locale->text_direction = 'foo'; -
tests/phpunit/tests/mail.php
21 21 * when it encounters a line longer than 999 characters. But PHPMailer doesn't clean up after itself / presets 22 22 * all variables, which means that following tests would fail. To solve this issue we set `$this->Encoding` 23 23 * back to 8bit in `MockPHPMailer::preSend`. 24 * 25 * @covers ::wp_mail 24 26 */ 25 27 function test_wp_mail_break_it() { 26 28 $content = str_repeat( 'A', 1000 ); … … 27 29 $this->assertTrue( wp_mail( WP_TESTS_EMAIL, 'Looong line testing', $content ) ); 28 30 } 29 31 32 /** 33 * 34 * @covers ::wp_mail 35 */ 30 36 function test_wp_mail_custom_boundaries() { 31 37 $to = 'user@example.com'; 32 38 $subject = 'Test email with custom boundaries'; … … 87 93 88 94 /** 89 95 * @ticket 17305 96 * 97 * @covers ::wp_mail 90 98 */ 91 99 function test_wp_mail_rfc2822_addresses() { 92 100 $to = 'Name <address@tld.com>'; … … 117 125 118 126 /** 119 127 * @ticket 17305 128 * 129 * @covers ::wp_mail 120 130 */ 121 131 function test_wp_mail_multiple_rfc2822_to_addresses() { 122 132 $to = 'Name <address@tld.com>, Another Name <another_address@different-tld.com>'; … … 135 145 $this->assertEqualsIgnoreEOL( $message . "\n", $mailer->get_sent()->body ); 136 146 } 137 147 148 /** 149 * 150 * @covers ::wp_mail 151 */ 138 152 function test_wp_mail_multiple_to_addresses() { 139 153 $to = 'address@tld.com, another_address@different-tld.com'; 140 154 $subject = 'RFC2822 Testing'; … … 150 164 151 165 /** 152 166 * @ticket 18463 167 * 168 * @covers ::wp_mail 153 169 */ 154 170 function test_wp_mail_to_address_no_name() { 155 171 $to = '<address@tld.com>'; … … 165 181 166 182 /** 167 183 * @ticket 23642 184 * 185 * @covers ::wp_mail 168 186 */ 169 187 function test_wp_mail_return_value() { 170 188 // No errors. … … 179 197 180 198 /** 181 199 * @ticket 30266 200 * 201 * @covers ::wp_mail 182 202 */ 183 203 public function test_wp_mail_with_valid_from_header() { 184 204 $to = 'address@tld.com'; … … 195 215 196 216 /** 197 217 * @ticket 30266 218 * 219 * @covers ::wp_mail 198 220 */ 199 221 public function test_wp_mail_with_empty_from_header() { 200 222 $to = 'address@tld.com'; … … 211 233 212 234 /** 213 235 * @ticket 30266 236 * 237 * @covers ::wp_mail 214 238 */ 215 239 public function test_wp_mail_with_empty_from_name_for_the_from_header() { 216 240 $to = 'address@tld.com'; … … 227 251 228 252 /** 229 253 * @ticket 30266 254 * 255 * @covers ::wp_mail 230 256 */ 231 257 public function test_wp_mail_with_valid_content_type_header() { 232 258 $to = 'address@tld.com'; … … 243 269 244 270 /** 245 271 * @ticket 30266 272 * 273 * @covers ::wp_mail 246 274 */ 247 275 public function test_wp_mail_with_empty_content_type_header() { 248 276 $to = 'address@tld.com'; … … 259 287 260 288 /** 261 289 * @ticket 30266 290 * 291 * @covers ::wp_mail 262 292 */ 263 293 public function test_wp_mail_with_empty_charset_for_the_content_type_header() { 264 294 $to = 'address@tld.com'; … … 275 305 276 306 /** 277 307 * @ticket 43542 308 * 309 * @covers ::wp_mail 278 310 */ 279 311 public function test_wp_mail_does_not_duplicate_mime_version_header() { 280 312 $to = 'user@example.com'; … … 308 340 * https://tools.ietf.org/html/rfc2045#section-6.1 309 341 * 310 342 * @ticket 28039 343 * 344 * @covers ::wp_mail 311 345 */ 312 346 function test_wp_mail_content_transfer_encoding_in_quoted_printable_multipart() { 313 347 add_action( 'phpmailer_init', array( $this, 'wp_mail_quoted_printable' ) ); … … 325 359 326 360 /** 327 361 * @ticket 21659 362 * 363 * @covers ::wp_mail 328 364 */ 329 365 public function test_wp_mail_addresses_arent_encoded() { 330 366 $to = 'Lukáš To <to@example.org>'; … … 367 403 * set it correctly. 368 404 * 369 405 * @ticket 37736 406 * 407 * @covers ::wp_mail 370 408 */ 371 409 public function test_wp_mail_sender_not_set() { 372 410 wp_mail( 'user@example.org', 'Testing the Sender field', 'The Sender field should not have been set.' ); … … 378 416 379 417 /** 380 418 * @ticket 35598 419 * 420 * @covers ::wp_mail 381 421 */ 382 422 public function test_phpmailer_exception_thrown() { 383 423 $to = 'an_invalid_address'; … … 410 450 411 451 /** 412 452 * @ticket 50720 453 * 454 * @coversNothing 413 455 */ 414 456 function test_phpmailer_validator() { 415 457 $phpmailer = $GLOBALS['phpmailer']; -
tests/phpunit/tests/media.php
46 46 ); 47 47 } 48 48 49 /** 50 * @covers ::add_shortcode 51 */ 49 52 function test_img_caption_shortcode_added() { 50 53 global $shortcode_tags; 51 54 $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['caption'] ); … … 52 55 $this->assertEquals( 'img_caption_shortcode', $shortcode_tags['wp_caption'] ); 53 56 } 54 57 58 /** 59 * @covers ::img_caption_shortcode 60 */ 55 61 function test_img_caption_shortcode_with_empty_params() { 56 62 $result = img_caption_shortcode( array() ); 57 63 $this->assertNull( $result ); … … 59 65 60 66 /** 61 67 * @ticket 33981 68 * 69 * @covers ::img_caption_shortcode 62 70 */ 63 71 function test_img_caption_shortcode_with_empty_params_but_content() { 64 72 $result = img_caption_shortcode( array(), $this->caption ); … … 67 75 68 76 /** 69 77 * @ticket 33981 78 * 79 * @covers ::img_caption_shortcode 70 80 */ 71 81 function test_img_caption_shortcode_short_circuit_filter() { 72 82 add_filter( 'img_caption_shortcode', array( $this, '_return_alt_caption' ) ); … … 84 94 85 95 /** 86 96 * @ticket 33981 97 * 98 * @covers ::img_caption_shortcode 87 99 */ 88 100 &nbs