Ticket #39265: m-folders.patch
File m-folders.patch, 124.2 KB (added by , 4 years ago) |
---|
-
tests/phpunit/tests/media/getAttachmentTaxonomies.php
5 5 * @group taxonomy 6 6 */ 7 7 class Tests_Media_GetAttachmentTaxonomies extends WP_UnitTestCase { 8 /** 9 * @covers ::get_attachment_taxonomies 10 */ 8 11 public function test_should_return_attachment_taxonomy() { 9 12 register_taxonomy( 'wptests_tax', 'attachment' ); 10 13 … … 24 27 $this->assertSame( $expected, $found ); 25 28 } 26 29 30 /** 31 * @covers ::get_attachment_taxonomies 32 */ 27 33 public function test_should_return_taxonomy_registered_for_specific_attachment_type() { 28 34 register_taxonomy( 'wptests_tax', 'attachment:image' ); 29 35 … … 43 49 $this->assertSame( $expected, $found ); 44 50 } 45 51 52 /** 53 * @covers ::get_attachment_taxonomies 54 */ 46 55 public function test_should_return_taxonomy_registered_for_specific_attachment_mimetype() { 47 56 register_taxonomy( 'wptests_tax', 'attachment:image/jpeg' ); 48 57 … … 62 71 $this->assertSame( $expected, $found ); 63 72 } 64 73 74 /** 75 * @covers ::get_attachment_taxonomies 76 */ 65 77 public function test_should_return_taxonomy_registered_for_specific_file_extension() { 66 78 register_taxonomy( 'wptests_tax', 'attachment:jpg' ); 67 79 … … 81 93 $this->assertSame( $expected, $found ); 82 94 } 83 95 96 /** 97 * @covers ::get_attachment_taxonomies 98 */ 84 99 public function test_should_not_return_duplicate_taxonomies() { 85 100 register_taxonomy( 'wptests_tax', array( 'attachment', 'attachment:image/jpeg' ) ); 86 101 … … 102 117 103 118 /** 104 119 * @ticket 37368 120 * 121 * @covers ::get_attachment_taxonomies 105 122 */ 106 123 public function test_should_respect_output_objects() { 107 124 register_taxonomy( 'wptests_tax2', 'attachment:image' ); … … 126 143 127 144 /** 128 145 * @ticket 37368 146 * 147 * @covers ::get_attachment_taxonomies 129 148 */ 130 149 public function test_should_return_unique_taxonomies_for_output_objects() { 131 150 register_taxonomy( 'wptests_tax2', array( 'attachment:image', 'attachment:image/jpeg' ) ); -
tests/phpunit/tests/menu/walker-nav-menu-edit.php
30 30 31 31 /** 32 32 * @ticket 36729 33 * 34 * @covers Walker_Nav_Menu::start_el 33 35 */ 34 36 function test_original_title_prefix_should_not_be_shown_if_empty() { 35 37 $expected = ''; -
tests/phpunit/tests/menu/walker-nav-menu.php
40 40 * Tests when an item's target is _blank, that rel="noopener" is added. 41 41 * 42 42 * @ticket 43290 43 * 44 * @covers Walker_Nav_Menu::start_el 43 45 */ 44 46 public function test_noopener_no_referrer_for_target_blank() { 45 47 $expected = ''; … … 71 73 * @ticket 47720 72 74 * 73 75 * @dataProvider data_start_el_with_empty_attributes 76 * 77 * @covers Walker_Nav_Menu::start_el 74 78 */ 75 79 public function test_start_el_with_empty_attributes( $value, $expected ) { 76 80 $output = ''; -
tests/phpunit/tests/menu/wpAjaxMenuQuickSearch.php
34 34 * Test search returns results for pages. 35 35 * 36 36 * @ticket 27042 37 * 38 * @covers ::_wp_ajax_menu_quick_search 37 39 */ 38 40 public function test_search_returns_results_for_pages() { 39 41 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; … … 69 71 * Test that search only returns results for published posts. 70 72 * 71 73 * @ticket 33742 74 * 75 * @covers ::_wp_ajax_menu_quick_search 72 76 */ 73 77 public function test_search_returns_results_for_published_posts() { 74 78 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; … … 125 129 * Test that search displays terms that are not assigned to any posts. 126 130 * 127 131 * @ticket 45298 132 * 133 * @covers ::_wp_ajax_menu_quick_search 128 134 */ 129 135 public function test_search_should_return_unassigned_term_items() { 130 136 register_taxonomy( 'wptests_tax', 'post' ); -
tests/phpunit/tests/menu/wpExpandNavMenuPostData.php
5 5 * @ticket 36590 6 6 */ 7 7 class Tests_Menu_WpExpandNavMenuPostData extends WP_UnitTestCase { 8 /** 9 * @covers ::_wp_expand_nav_menu_post_data 10 */ 8 11 public function test_unnested_data_should_expand() { 9 12 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 10 13 … … 28 31 $this->assertSame( $expected, $_POST ); 29 32 } 30 33 34 /** 35 * @covers ::_wp_expand_nav_menu_post_data 36 */ 31 37 public function test_multidimensional_nested_array_should_expand() { 32 38 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 33 39 … … 58 64 $this->assertSame( $expected, $_POST ); 59 65 } 60 66 67 /** 68 * @covers ::_wp_expand_nav_menu_post_data 69 */ 61 70 public function test_multidimensional_nested_array_should_expand_and_merge() { 62 71 require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; 63 72 -
tests/phpunit/tests/meta/deleteMetadata.php
4 4 * @group meta 5 5 */ 6 6 class Tests_Meta_DeleteMetadata extends WP_UnitTestCase { 7 /** 8 * @covers ::delete_metadata 9 */ 7 10 public function test_all_metas_for_key_should_be_deleted_when_no_meta_value_is_provided() { 8 11 $vals = array( '0', '1', '2' ); 9 12 foreach ( $vals as $val ) { … … 17 20 $this->assertSameSets( array(), $m ); 18 21 } 19 22 23 /** 24 * @covers ::delete_metadata 25 */ 20 26 public function test_with_meta_value() { 21 27 $vals = array( '0', '1', '2' ); 22 28 foreach ( $vals as $val ) { … … 34 40 35 41 /** 36 42 * @ticket 32224 43 * 44 * @covers ::delete_metadata 37 45 */ 38 46 public function test_with_falsey_meta_value_should_not_delete_all_meta() { 39 47 $vals = array( '0', '1', '2' ); … … 54 62 * @ticket 32224 55 63 * 56 64 * This is a backwards compatiblity quirk. 65 * 66 * @covers ::delete_metadata 57 67 */ 58 68 public function test_meta_value_should_be_ignored_when_empty_string() { 59 69 $vals = array( '0', '1', '2', '' ); … … 70 80 71 81 /** 72 82 * @ticket 32224 83 * 84 * @covers ::delete_metadata 73 85 */ 74 86 public function test_meta_value_should_be_ignored_when_null() { 75 87 $vals = array( '0', '1', '2', '' ); … … 86 98 87 99 /** 88 100 * @ticket 32224 101 * 102 * @covers ::delete_metadata 89 103 */ 90 104 public function test_meta_value_should_be_ignored_when_false() { 91 105 $vals = array( '0', '1', '2', '' ); … … 102 116 103 117 /** 104 118 * @ticket 35797 119 * 120 * @covers ::delete_metadata 105 121 */ 106 122 public function test_delete_all_should_only_invalidate_cache_for_objects_matching_meta_value() { 107 123 $p1 = 1234; … … 125 141 126 142 /** 127 143 * @ticket 35797 144 * 145 * @covers ::delete_metadata 128 146 */ 129 147 public function test_delete_all_should_invalidate_cache_for_all_objects_with_meta_key_when_meta_value_is_not_provided() { 130 148 $p1 = 1234; … … 147 165 148 166 /** 149 167 * @ticket 43561 168 * 169 * @covers ::delete_metadata_by_mid 150 170 */ 151 171 public function test_object_id_is_int_inside_delete_post_meta() { 152 172 $post_id = self::factory()->post->create(); -
tests/phpunit/tests/meta/isProtectedMeta.php
8 8 9 9 /** 10 10 * @dataProvider protected_data 11 * 12 * @covers ::is_protected_meta 11 13 */ 12 14 public function test_protected( $key ) { 13 15 $this->assertTrue( is_protected_meta( $key ) ); … … 30 32 31 33 /** 32 34 * @dataProvider unprotected_data 35 * 36 * @covers ::is_protected_meta 33 37 */ 34 38 public function test_unprotected( $key ) { 35 39 $this->assertFalse( is_protected_meta( $key ) ); -
tests/phpunit/tests/meta/query.php
8 8 */ 9 9 class Tests_Meta_Query extends WP_UnitTestCase { 10 10 11 /** 12 * @covers WP_Meta_Query::__construct 13 */ 11 14 public function test_empty_meta_query_param() { 12 15 $query = new WP_Meta_Query(); 13 16 $this->assertNull( $query->relation ); 14 17 } 15 18 19 /** 20 * @covers WP_Meta_Query::__construct 21 */ 16 22 public function test_default_relation() { 17 23 $query = new WP_Meta_Query( array( array( 'key' => 'abc' ) ) ); 18 24 $this->assertSame( 'AND', $query->relation ); 19 25 } 20 26 27 /** 28 * @covers WP_Meta_Query::__construct 29 */ 21 30 public function test_set_relation() { 22 31 23 32 $query = new WP_Meta_Query( … … 41 50 42 51 /** 43 52 * Non-arrays should not be added to the queries array. 53 * 54 * @covers WP_Meta_Query::__construct 44 55 */ 45 56 public function test_invalid_query_clauses() { 46 57 $query = new WP_Meta_Query( … … 59 70 * Test all key only meta queries use the same INNER JOIN when using relation=OR 60 71 * 61 72 * @ticket 19729 73 * 74 * @covers WP_Meta_Query::get_sql 62 75 */ 63 76 public function test_single_inner_join_for_keys_only() { 64 77 … … 97 110 98 111 /** 99 112 * WP_Query-style query must be at index 0 for order_by=meta_value to work. 113 * 114 * @covers WP_Meta_Query::parse_query_vars 100 115 */ 101 116 public function test_parse_query_vars_simple_query_index_0() { 102 117 $qv = array( … … 135 150 136 151 /** 137 152 * When no meta_value is provided, no 'value' should be set in the parsed queries. 153 * 154 * @covers WP_Meta_Query::parse_query_vars 138 155 */ 139 156 public function test_parse_query_vars_with_no_meta_value() { 140 157 $qv = array( … … 151 168 152 169 /** 153 170 * WP_Query sets meta_value to '' by default. It should be removed by parse_query_vars(). 171 * 172 * @covers WP_Meta_Query::parse_query_vars 154 173 */ 155 174 public function test_parse_query_vars_with_default_meta_compare() { 156 175 $qv = array( … … 169 188 /** 170 189 * Test the conversion between "WP_Query" style meta args (meta_value=x&meta_key=y) 171 190 * to a meta query array. 191 * 192 * @covers WP_Meta_Query::parse_query_vars 172 193 */ 173 194 public function test_parse_query_vars() { 174 195 … … 223 244 224 245 /** 225 246 * @ticket 23033 247 * 248 * @covers WP_Meta_Query::get_cast_for_type 226 249 */ 227 250 public function test_get_cast_for_type() { 228 251 $query = new WP_Meta_Query(); … … 255 278 $this->assertSame( 'CHAR', $query->get_cast_for_type( 'ANYTHING ELSE' ) ); 256 279 } 257 280 281 /** 282 * @covers WP_Meta_Query::sanitize_query 283 */ 258 284 public function test_sanitize_query_single_query() { 259 285 $expected = array( 260 286 array( … … 277 303 $this->assertSame( $expected, $found ); 278 304 } 279 305 306 /** 307 * @covers WP_Meta_Query::sanitize_query 308 */ 280 309 public function test_sanitize_query_multiple_first_order_queries_relation_default() { 281 310 $expected = array( 282 311 array( … … 307 336 $this->assertSame( $expected, $found ); 308 337 } 309 338 339 /** 340 * @covers WP_Meta_Query::sanitize_query 341 */ 310 342 public function test_sanitize_query_multiple_first_order_queries_relation_or() { 311 343 $expected = array( 312 344 array( … … 338 370 $this->assertSame( $expected, $found ); 339 371 } 340 372 373 /** 374 * @covers WP_Meta_Query::sanitize_query 375 */ 341 376 public function test_sanitize_query_multiple_first_order_queries_relation_or_lowercase() { 342 377 $expected = array( 343 378 array( … … 369 404 $this->assertSame( $expected, $found ); 370 405 } 371 406 407 /** 408 * @covers WP_Meta_Query::sanitize_query 409 */ 372 410 public function test_sanitize_query_multiple_first_order_queries_invalid_relation() { 373 411 $expected = array( 374 412 array( … … 400 438 $this->assertSame( $expected, $found ); 401 439 } 402 440 441 /** 442 * @covers WP_Meta_Query::__construct 443 */ 403 444 public function test_sanitize_query_single_query_which_is_a_nested_query() { 404 445 $expected = array( 405 446 array( … … 435 476 $this->assertSame( $expected, $found ); 436 477 } 437 478 479 /** 480 * @covers WP_Meta_Query::sanitize_query 481 */ 438 482 public function test_sanitize_query_multiple_nested_queries() { 439 483 $expected = array( 440 484 array( … … 494 538 495 539 /** 496 540 * Invalid $type will fail to get a table from _get_meta_table() 541 * 542 * @covers WP_Meta_Query::__construct 497 543 */ 498 544 public function test_get_sql_invalid_type() { 499 545 $query = new WP_Meta_Query(); … … 502 548 503 549 /** 504 550 * @ticket 22096 551 * 552 * @covers WP_Meta_Query::__construct 505 553 */ 506 554 public function test_empty_value_sql() { 507 555 global $wpdb; … … 533 581 534 582 /** 535 583 * @ticket 22967 584 * 585 * @covers WP_Meta_Query::__construct 536 586 */ 537 587 public function test_null_value_sql() { 538 588 global $wpdb; … … 554 604 /** 555 605 * "key only queries" are queries that don't need to match a value, so 556 606 * they can be grouped together into a single clause without JOINs 607 * 608 * @covers WP_Meta_Query::__construct 557 609 */ 558 610 public function test_get_sql_key_only_queries() { 559 611 global $wpdb; … … 628 680 629 681 /** 630 682 * Key-only and regular queries should have the key trimmed 683 * 684 * @covers WP_Meta_Query::__construct 631 685 */ 632 686 public function test_get_sql_trim_key() { 633 687 global $wpdb; … … 650 704 $this->assertSame( 1, substr_count( $sql['where'], "meta_key = 'bar'" ) ); 651 705 } 652 706 707 /** 708 * @covers WP_Meta_Query::__construct 709 */ 653 710 public function test_convert_null_value_to_empty_string() { 654 711 global $wpdb; 655 712 … … 667 724 $this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_value = ''" ) ); 668 725 } 669 726 727 /** 728 * @covers WP_Meta_Query::__construct 729 */ 670 730 public function test_get_sql_convert_lowercase_compare_to_uppercase() { 671 731 global $wpdb; 672 732 … … 685 745 $this->assertSame( 1, substr_count( $sql['where'], 'REGEXP' ) ); 686 746 } 687 747 748 /** 749 * @covers WP_Meta_Query::__construct 750 */ 688 751 public function test_get_sql_empty_meta_compare_with_array_value() { 689 752 global $wpdb; 690 753 … … 702 765 $this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_value IN" ) ); 703 766 } 704 767 768 /** 769 * @covers WP_Meta_Query::__construct 770 */ 705 771 public function test_get_sql_empty_meta_compare_with_non_array_value() { 706 772 global $wpdb; 707 773 … … 741 807 * Verifies only that meta_type_key is passed. See query/metaQuery.php for more complete tests. 742 808 * 743 809 * @ticket 43446 810 * 811 * @covers WP_Query::__construct 744 812 */ 745 813 public function test_meta_type_key_should_be_passed_to_meta_query() { 746 814 $posts = self::factory()->post->create_many( 3 ); … … 774 842 775 843 /** 776 844 * This is the clause that ensures that empty arrays are not valid queries. 845 * 846 * @covers WP_Meta_Query::get_sql 777 847 */ 778 848 public function test_get_sql_null_value_and_empty_key_should_not_have_table_join() { 779 849 global $wpdb; … … 794 864 $this->assertSame( 0, substr_count( $sql['join'], 'AS mt' ) ); 795 865 } 796 866 867 /** 868 * @covers WP_Meta_Query::__construct 869 */ 797 870 public function test_get_sql_compare_array_comma_separated_values() { 798 871 global $wpdb; 799 872 … … 843 916 $this->assertSame( 1, substr_count( $sql['where'], "('bar','baz','barry')" ) ); 844 917 } 845 918 919 /** 920 * @covers WP_Meta_Query::__construct 921 */ 846 922 public function test_get_sql_compare_array() { 847 923 global $wpdb; 848 924 … … 863 939 864 940 /** 865 941 * Non-array values are trimmed. @todo Why? 942 * 943 * @covers WP_Meta_Query::__construct 866 944 */ 867 945 public function test_get_sql_trim_string_value() { 868 946 global $wpdb; … … 881 959 $this->assertSame( 1, substr_count( $sql['where'], "$wpdb->postmeta.meta_value = 'bar'" ) ); 882 960 } 883 961 962 /** 963 * @covers WP_Meta_Query::__construct 964 */ 884 965 public function test_not_exists() { 885 966 global $wpdb; 886 967 … … 904 985 $this->assertContains( "{$wpdb->postmeta}.post_id IS NULL", $sql['where'] ); 905 986 } 906 987 988 /** 989 * @covers WP_Meta_Query::__construct 990 */ 907 991 public function test_empty_compare() { 908 992 global $wpdb; 909 993 … … 931 1015 932 1016 /** 933 1017 * @ticket 32592 1018 * 1019 * @covers WP_Meta_Query::has_or_relation 934 1020 */ 935 1021 public function test_has_or_relation_should_return_false() { 936 1022 $q = new WP_Meta_Query( … … 959 1045 960 1046 /** 961 1047 * @ticket 32592 1048 * 1049 * @covers WP_Meta_Query::has_or_relation 962 1050 */ 963 1051 public function test_has_or_relation_should_return_true_for_top_level_or() { 964 1052 $q = new WP_Meta_Query( … … 987 1075 988 1076 /** 989 1077 * @ticket 32592 1078 * 1079 * @covers WP_Meta_Query::has_or_relation 990 1080 */ 991 1081 public function test_has_or_relation_should_return_true_for_nested_or() { 992 1082 $q = new WP_Meta_Query( -
tests/phpunit/tests/meta/registerMeta.php
39 39 return $allowed; 40 40 } 41 41 42 /** 43 * @covers ::register_meta 44 */ 42 45 public function test_register_meta_back_compat_with_auth_callback_and_no_sanitize_callback_has_old_style_auth_filter() { 43 46 register_meta( 'post', 'flight_number', null, array( $this, '_old_auth_meta_cb' ) ); 44 47 $has_filter = has_filter( 'auth_post_meta_flight_number', array( $this, '_old_auth_meta_cb' ) ); … … 48 51 $this->assertSame( 10, $has_filter ); 49 52 } 50 53 54 /** 55 * @covers ::register_meta 56 */ 51 57 public function test_register_meta_back_compat_with_sanitize_callback_and_no_auth_callback_has_old_style_sanitize_filter() { 52 58 register_meta( 'post', 'flight_number', array( $this, '_old_sanitize_meta_cb' ) ); 53 59 $has_filter = has_filter( 'sanitize_post_meta_flight_number', array( $this, '_old_sanitize_meta_cb' ) ); … … 56 62 $this->assertSame( 10, $has_filter ); 57 63 } 58 64 65 /** 66 * @covers ::register_meta 67 */ 59 68 public function test_register_meta_back_compat_with_auth_and_sanitize_callback_has_old_style_filters() { 60 69 register_meta( 'post', 'flight_number', array( $this, '_old_sanitize_meta_cb' ), array( $this, '_old_auth_meta_cb' ) ); 61 70 $has_filters = array(); … … 73 82 ); 74 83 } 75 84 85 /** 86 * @covers ::register_meta 87 */ 76 88 public function test_register_meta_with_post_object_type_returns_true() { 77 89 $result = register_meta( 'post', 'flight_number', array() ); 78 90 unregister_meta_key( 'post', 'flight_number' ); … … 80 92 $this->assertTrue( $result ); 81 93 } 82 94 95 /** 96 * @covers ::register_meta 97 */ 83 98 public function test_register_meta_with_post_object_type_populates_wp_meta_keys() { 84 99 global $wp_meta_keys; 85 100 … … 105 120 $this->assertSame( $expected, $actual ); 106 121 } 107 122 123 /** 124 * @covers ::register_meta 125 */ 108 126 public function test_register_meta_with_term_object_type_populates_wp_meta_keys() { 109 127 global $wp_meta_keys; 110 128 register_meta( 'term', 'category_icon', array() ); … … 129 147 $this->assertSame( $expected, $actual ); 130 148 } 131 149 150 /** 151 * @covers ::register_meta 152 */ 132 153 public function test_register_meta_with_deprecated_sanitize_callback_does_not_populate_wp_meta_keys() { 133 154 global $wp_meta_keys; 134 155 … … 140 161 $this->assertSame( array(), $actual ); 141 162 } 142 163 164 /** 165 * @covers ::register_meta 166 */ 143 167 public function test_register_meta_with_deprecated_sanitize_callback_param_returns_false() { 144 168 $actual = register_meta( 'post', 'flight_number', array( $this, '_old_sanitize_meta_cb' ) ); 145 169 … … 149 173 $this->assertFalse( $actual ); 150 174 } 151 175 176 /** 177 * @covers ::register_meta 178 */ 152 179 public function test_register_meta_with_deprecated_sanitize_callback_parameter_passes_through_filter() { 153 180 register_meta( 'post', 'old_sanitized_key', array( $this, '_old_sanitize_meta_cb' ) ); 154 181 $meta = sanitize_meta( 'old_sanitized_key', 'unsanitized', 'post', 'post' ); … … 159 186 $this->assertSame( 'old_sanitized_key old sanitized', $meta ); 160 187 } 161 188 189 /** 190 * @covers ::register_meta 191 */ 162 192 public function test_register_meta_with_current_sanitize_callback_populates_wp_meta_keys() { 163 193 global $wp_meta_keys; 164 194 register_meta( 'post', 'flight_number', array( 'sanitize_callback' => array( $this, '_new_sanitize_meta_cb' ) ) ); … … 182 212 $this->assertSame( $actual, $expected ); 183 213 } 184 214 215 /** 216 * @covers ::register_meta 217 */ 185 218 public function test_register_meta_with_current_sanitize_callback_returns_true() { 186 219 $result = register_meta( 'post', 'flight_number', array( 'sanitize_callback' => array( $this, '_new_sanitize_meta_cb' ) ) ); 187 220 unregister_meta_key( 'post', 'flight_number' ); … … 189 222 $this->assertTrue( $result ); 190 223 } 191 224 225 /** 226 * @covers ::register_meta 227 */ 192 228 public function test_register_meta_with_new_sanitize_callback_parameter() { 193 229 register_meta( 'post', 'new_sanitized_key', array( 'sanitize_callback' => array( $this, '_new_sanitize_meta_cb' ) ) ); 194 230 $meta = sanitize_meta( 'new_sanitized_key', 'unsanitized', 'post' ); … … 198 234 $this->assertSame( 'new_sanitized_key new sanitized', $meta ); 199 235 } 200 236 237 /** 238 * @covers ::unregister_meta_key 239 */ 201 240 public function test_register_meta_unregistered_meta_key_removes_sanitize_filter() { 202 241 register_meta( 'post', 'new_sanitized_key', array( 'sanitize_callback' => array( $this, '_new_sanitize_meta_cb' ) ) ); 203 242 unregister_meta_key( 'post', 'new_sanitized_key' ); … … 207 246 $this->assertFalse( $has_filter ); 208 247 } 209 248 249 /** 250 * @covers ::unregister_meta_key 251 */ 210 252 public function test_register_meta_unregistered_meta_key_removes_auth_filter() { 211 253 register_meta( 'post', 'new_auth_key', array( 'auth_callback' => array( $this, '_new_auth_meta_cb' ) ) ); 212 254 unregister_meta_key( 'post', 'new_auth_key' ); … … 216 258 $this->assertFalse( $has_filter ); 217 259 } 218 260 261 /** 262 * @covers ::unregister_meta_key 263 */ 219 264 public function test_unregister_meta_key_clears_key_from_wp_meta_keys() { 220 265 global $wp_meta_keys; 221 266 register_meta( 'post', 'registered_key', array() ); … … 224 269 $this->assertSame( array(), $wp_meta_keys ); 225 270 } 226 271 272 /** 273 * @covers ::unregister_meta_key 274 */ 227 275 public function test_unregister_meta_key_with_invalid_key_returns_false() { 228 276 $this->assertFalse( unregister_meta_key( 'post', 'not_a_registered_key' ) ); 229 277 } 230 278 279 /** 280 * @covers ::get_registered_meta_keys 281 */ 231 282 public function test_get_registered_meta_keys() { 232 283 register_meta( 'post', 'registered_key1', array() ); 233 284 register_meta( 'post', 'registered_key2', array() ); … … 241 292 $this->assertArrayHasKey( 'registered_key2', $meta_keys ); 242 293 } 243 294 295 /** 296 * @covers ::get_registered_meta_keys 297 */ 244 298 public function test_get_registered_meta_keys_with_invalid_type_is_empty() { 245 299 register_meta( 'post', 'registered_key1', array() ); 246 300 register_meta( 'post', 'registered_key2', array() ); … … 253 307 $this->assertEmpty( $meta_keys ); 254 308 } 255 309 310 311 /** 312 * @covers ::get_registered_meta_keys 313 */ 256 314 public function test_get_registered_meta_keys_description_arg() { 257 315 register_meta( 'post', 'registered_key1', array( 'description' => 'I\'m just a field, take a good look at me' ) ); 258 316 … … 263 321 $this->assertSame( 'I\'m just a field, take a good look at me', $meta_keys['registered_key1']['description'] ); 264 322 } 265 323 324 /** 325 * @covers ::get_registered_meta_keys 326 */ 266 327 public function test_get_registered_meta_keys_invalid_arg() { 267 328 register_meta( 'post', 'registered_key1', array( 'invalid_arg' => 'invalid' ) ); 268 329 … … 273 334 $this->assertArrayNotHasKey( 'invalid_arg', $meta_keys['registered_key1'] ); 274 335 } 275 336 337 /** 338 * @covers ::get_registered_metadata 339 */ 276 340 public function test_get_registered_metadata() { 277 341 register_meta( 'post', 'flight_number', array() ); 278 342 add_post_meta( self::$post_id, 'flight_number', 'Oceanic 815' ); … … 284 348 $this->assertSame( 'Oceanic 815', $meta['flight_number'][0] ); 285 349 } 286 350 351 /** 352 * @covers ::get_registered_metadata 353 */ 287 354 public function test_get_registered_metadata_by_key() { 288 355 register_meta( 'post', 'flight_number', array() ); 289 356 add_post_meta( self::$post_id, 'flight_number', 'Oceanic 815' ); … … 295 362 $this->assertSame( 'Oceanic 815', $meta[0] ); 296 363 } 297 364 365 /** 366 * @covers ::get_registered_metadata 367 */ 298 368 public function test_get_registered_metadata_by_key_single() { 299 369 register_meta( 'post', 'flight_number', array( 'single' => true ) ); 300 370 add_post_meta( self::$post_id, 'flight_number', 'Oceanic 815' ); … … 306 376 $this->assertSame( 'Oceanic 815', $meta ); 307 377 } 308 378 379 /** 380 * @covers ::get_registered_metadata 381 */ 309 382 public function test_get_registered_metadata_by_invalid_key() { 310 383 register_meta( 'post', 'flight_number', array() ); 311 384 add_post_meta( self::$post_id, 'flight_number', 'Oceanic 815' ); … … 317 390 $this->assertFalse( $meta ); 318 391 } 319 392 393 /** 394 * @covers ::get_registered_metadata 395 */ 320 396 public function test_get_registered_metadata_invalid_object_type_returns_empty_array() { 321 397 $meta = get_registered_metadata( 'invalid-type', self::$post_id ); 322 398 … … 326 402 /** 327 403 * @ticket 38323 328 404 * @dataProvider data_get_types_and_subtypes 405 * 406 * @covers ::register_meta 329 407 */ 330 408 public function test_register_meta_with_subtype_populates_wp_meta_keys( $type, $subtype ) { 331 409 global $wp_meta_keys; … … 358 436 /** 359 437 * @ticket 38323 360 438 * @dataProvider data_get_types_and_subtypes 439 * 440 * @covers ::unregister_meta_key 361 441 */ 362 442 public function test_unregister_meta_with_subtype_unpopulates_wp_meta_keys( $type, $subtype ) { 363 443 global $wp_meta_keys; … … 376 456 /** 377 457 * @ticket 38323 378 458 * @dataProvider data_get_types_and_subtypes 459 * 460 * @covers ::unregister_meta_key 379 461 */ 380 462 public function test_unregister_meta_without_subtype_keeps_subtype_meta_key( $type, $subtype ) { 381 463 global $wp_meta_keys; … … 411 493 /** 412 494 * @ticket 38323 413 495 * @dataProvider data_get_types_and_subtypes 496 * 497 * @covers ::get_registered_meta_keys 414 498 */ 415 499 public function test_get_registered_meta_keys_with_subtype( $type, $subtype ) { 416 500 register_meta( $type, 'registered_key1', array( 'object_subtype' => $subtype ) ); … … 426 510 /** 427 511 * @ticket 38323 428 512 * @dataProvider data_get_types_and_subtypes 513 * 514 * @covers ::get_registered_meta_keys 429 515 */ 430 516 public function test_get_registered_metadata_with_subtype( $type, $subtype ) { 431 517 register_meta( $type, 'registered_key1', array() ); … … 483 569 /** 484 570 * @ticket 38323 485 571 * @dataProvider data_get_types_and_subtypes 572 * 573 * @covers ::get_object_subtype 486 574 */ 487 575 public function test_get_object_subtype( $type, $expected_subtype ) { 488 576 $object_property_name = $type . '_id'; … … 493 581 494 582 /** 495 583 * @ticket 38323 584 * 585 * @covers ::get_object_subtype 496 586 */ 497 587 public function test_get_object_subtype_custom() { 498 588 add_filter( 'get_object_subtype_customtype', array( $this, 'filter_get_object_subtype_for_customtype' ), 10, 2 ); … … 507 597 /** 508 598 * @ticket 43941 509 599 * @dataProvider data_get_default_data 600 * 601 * @covers ::get_metadata_default 510 602 */ 511 603 public function test_get_default_value( $args, $single, $expected ) { 512 604 … … 552 644 /** 553 645 * @ticket 43941 554 646 * @dataProvider data_get_invalid_default_data 647 * 648 * @covers ::get_metadata_default 555 649 */ 556 650 public function test_get_invalid_default_value( $args, $single, $expected ) { 557 651 $this->setExpectedIncorrectUsage( 'register_meta' ); -
tests/phpunit/tests/meta/slashes.php
34 34 35 35 /** 36 36 * Tests the controller function that expects slashed data. 37 * 38 * @covers ::add_magic_quotes 37 39 */ 38 40 function test_edit_post() { 39 41 $post_id = self::$post_id; … … 111 113 112 114 /** 113 115 * Tests the legacy model function that expects slashed data. 116 * 117 * @covers ::add_post_meta 114 118 */ 115 119 function test_add_post_meta() { 116 120 $post_id = self::$post_id; … … 126 130 127 131 /** 128 132 * Tests the legacy model function that expects slashed data. 133 * 134 * @covers ::update_post_meta 129 135 */ 130 136 function test_update_post_meta() { 131 137 $post_id = self::$post_id; … … 141 147 142 148 /** 143 149 * Tests the model function that expects slashed data. 150 * 151 * @covers ::add_comment_meta 144 152 */ 145 153 function test_add_comment_meta() { 146 154 $comment_id = self::$comment_id; … … 164 172 165 173 /** 166 174 * Tests the model function that expects slashed data. 175 * 176 * @covers ::update_comment_meta 167 177 */ 168 178 function test_update_comment_meta() { 169 179 $comment_id = self::$comment_id; … … 191 201 192 202 /** 193 203 * Tests the model function that expects slashed data. 204 * 205 * @covers ::add_user_meta 194 206 */ 195 207 function test_add_user_meta() { 196 208 $user_id = self::$user_id; … … 214 226 215 227 /** 216 228 * Tests the model function that expects slashed data. 229 * 230 * @covers ::update_user_meta 217 231 */ 218 232 function test_update_user_meta() { 219 233 $user_id = self::$user_id; -
tests/phpunit/tests/meta/updateMetadata.php
7 7 class Tests_Meta_UpdateMetadata extends WP_UnitTestCase { 8 8 /** 9 9 * @ticket 35795 10 * 11 * @covers ::update_metadata 10 12 */ 11 13 public function test_slashed_key_for_new_metadata() { 12 14 update_metadata( 'post', 123, wp_slash( 'foo\foo' ), 'bar' ); … … 17 19 18 20 /** 19 21 * @ticket 35795 22 * 23 * @covers ::update_metadata 20 24 */ 21 25 public function test_slashed_key_for_existing_metadata() { 22 26 global $wpdb; -
tests/phpunit/tests/multisite/bootstrap.php
122 122 * @param string $domain The requested domain. 123 123 * @param string $path The requested path. 124 124 * @param string $message The message to pass for failed tests. 125 * 126 * @covers ::get_network_by_path 125 127 */ 126 128 function test_get_network_by_path( $expected_key, $domain, $path, $message ) { 127 129 $network = get_network_by_path( $domain, $path ); … … 153 155 * @param string $domain The requested domain. 154 156 * @param string $path The requested path. 155 157 * @param string $message The message to pass for failed tests. 158 * 159 * @covers ::get_network_by_path 156 160 */ 157 161 public function test_get_network_by_path_with_zero_path_segments( $expected_key, $domain, $path, $message ) { 158 162 add_filter( 'network_by_path_segments_count', '__return_zero' ); … … 180 184 /** 181 185 * Even if a matching network is available, it should not match if the the filtered 182 186 * value for network path segments is fewer than the number of paths passed. 187 * 188 * @covers ::get_network_by_path 183 189 */ 184 190 public function test_get_network_by_path_with_forced_single_path_segment_returns_single_path_network() { 185 191 add_filter( 'network_by_path_segments_count', array( $this, 'filter_network_path_segments' ) ); … … 202 208 * @param string $domain The requested domain. 203 209 * @param string $path The requested path. 204 210 * @param int $segments Optional. Number of segments to use in `get_site_by_path()`. 211 * 212 * @covers ::get_site_by_path 205 213 */ 206 214 public function test_get_site_by_path( $expected_key, $domain, $path, $segments = null ) { 207 215 $site = get_site_by_path( $domain, $path, $segments ); … … 254 262 * @param string $network_key The array key associated with the expected network for the test. 255 263 * @param string $domain The requested domain. 256 264 * @param string $path The requested path. 265 * 266 * @covers ::ms_load_current_site_and_network 257 267 */ 258 268 function test_multisite_bootstrap( $site_key, $network_key, $domain, $path ) { 259 269 global $current_blog; … … 293 303 294 304 /** 295 305 * @ticket 27884 306 * 307 * @covers ::ms_load_current_site_and_network 296 308 */ 297 309 public function test_multisite_bootstrap_additional_path_segments() { 298 310 global $current_blog; … … 315 327 316 328 /** 317 329 * @ticket 37053 330 * 331 * @covers ::get_site_by_path 318 332 */ 319 333 public function test_get_site_by_path_returns_wp_site() { 320 334 add_filter( 'pre_get_site_by_path', array( $this, 'filter_pre_get_site_by_path' ), 10, 3 ); -
tests/phpunit/tests/multisite/cleanDirsizeCache.php
27 27 * Test whether dirsize_cache values are used correctly with a more complex dirsize cache mock. 28 28 * 29 29 * @ticket 19879 30 * 31 * @covers ::recurse_dirsize 30 32 */ 31 33 function test_get_dirsize_cache_in_recurse_dirsize_mock() { 32 34 $blog_id = self::factory()->blog->create(); … … 76 78 * Test whether the dirsize_cache invalidation works given a file path as input. 77 79 * 78 80 * @ticket 19879 81 * 82 * @covers ::clean_dirsize_cache 79 83 */ 80 84 function test_clean_dirsize_cache_file_input_mock() { 81 85 $blog_id = self::factory()->blog->create(); … … 124 128 * Test whether the dirsize_cache invalidation works given a directory path as input. 125 129 * 126 130 * @ticket 19879 131 * 132 * @covers ::clean_dirsize_cache 127 133 */ 128 134 function test_clean_dirsize_cache_folder_input_mock() { 129 135 $blog_id = self::factory()->blog->create(); … … 172 178 * Test whether dirsize_cache values are used correctly with a simple real upload. 173 179 * 174 180 * @ticket 19879 181 * 182 * @covers ::recurse_dirsize 175 183 */ 176 184 function test_get_dirsize_cache_in_recurse_dirsize_upload() { 177 185 $blog_id = self::factory()->blog->create(); -
tests/phpunit/tests/multisite/getBlogDetails.php
41 41 wp_update_network_site_counts(); 42 42 } 43 43 44 /** 45 * @covers ::get_blog_details 46 */ 44 47 public function test_get_blog_details_with_no_arguments_returns_current_site() { 45 48 $site = get_blog_details(); 46 49 $this->assertEquals( get_current_blog_id(), $site->blog_id ); 47 50 } 48 51 52 /** 53 * @covers ::get_blog_details 54 */ 49 55 public function test_get_blog_details_with_site_name_string_subdirectory() { 50 56 if ( is_subdomain_install() ) { 51 57 $this->markTestSkipped( 'This test is only valid in a subdirectory configuration.' ); … … 55 61 $this->assertEquals( self::$site_ids[ WP_TESTS_DOMAIN . '/foo/' ], $site->blog_id ); 56 62 } 57 63 64 /** 65 * @covers ::get_blog_details 66 */ 58 67 public function test_get_blog_details_with_site_name_string_subdomain() { 59 68 if ( ! is_subdomain_install() ) { 60 69 $this->markTestSkipped( 'This test is only valid in a subdomain configuration.' ); … … 64 73 $this->assertEquals( self::$site_ids[ 'foo.' . WP_TESTS_DOMAIN . '/' ], $site->blog_id ); 65 74 } 66 75 76 /** 77 * @covers ::get_blog_details 78 */ 67 79 public function test_get_blog_details_with_invalid_site_name_string() { 68 80 $site = get_blog_details( 'invalid' ); 69 81 $this->assertFalse( $site ); 70 82 } 71 83 84 /** 85 * @covers ::get_blog_details 86 */ 72 87 public function test_get_blog_details_with_site_id_int() { 73 88 $site = get_blog_details( self::$site_ids['wordpress.org/'] ); 74 89 $this->assertEquals( self::$site_ids['wordpress.org/'], $site->blog_id ); 75 90 } 76 91 92 /** 93 * @covers ::get_blog_details 94 */ 77 95 public function test_get_blog_details_with_invalid_site_id_int() { 78 96 $site = get_blog_details( 99999 ); 79 97 $this->assertFalse( $site ); 80 98 } 81 99 100 /** 101 * @covers ::get_blog_details 102 */ 82 103 public function test_get_blog_details_with_blog_id_in_fields() { 83 104 $site = get_blog_details( array( 'blog_id' => self::$site_ids['wordpress.org/'] ) ); 84 105 $this->assertEquals( self::$site_ids['wordpress.org/'], $site->blog_id ); 85 106 } 86 107 108 /** 109 * @covers ::get_blog_details 110 */ 87 111 public function test_get_blog_details_with_invalid_blog_id_in_fields() { 88 112 $site = get_blog_details( array( 'blog_id' => 88888 ) ); 89 113 $this->assertFalse( $site ); 90 114 } 91 115 116 /** 117 * @covers ::get_blog_details 118 */ 92 119 public function test_get_blog_details_with_domain_and_path_in_fields() { 93 120 $site = get_blog_details( 94 121 array( … … 99 126 $this->assertEquals( self::$site_ids['wordpress.org/'], $site->blog_id ); 100 127 } 101 128 129 /** 130 * @covers ::get_blog_details 131 */ 102 132 public function test_get_blog_details_with_domain_and_invalid_path_in_fields() { 103 133 $site = get_blog_details( 104 134 array( … … 109 139 $this->assertFalse( $site ); 110 140 } 111 141 142 /** 143 * @covers ::get_blog_details 144 */ 112 145 public function test_get_blog_details_with_path_and_invalid_domain_in_fields() { 113 146 $site = get_blog_details( 114 147 array( … … 119 152 $this->assertFalse( $site ); 120 153 } 121 154 155 /** 156 * @covers ::get_blog_details 157 */ 122 158 public function test_get_blog_details_with_only_domain_in_fields_subdomain() { 123 159 if ( ! is_subdomain_install() ) { 124 160 $this->markTestSkipped( 'This test is only valid in a subdomain configuration.' ); … … 128 164 $this->assertSame( self::$site_ids['wordpress.org/'], $site->blog_id ); 129 165 } 130 166 167 /** 168 * @covers ::get_blog_details 169 */ 131 170 public function test_get_blog_details_with_only_domain_in_fields_subdirectory() { 132 171 if ( is_subdomain_install() ) { 133 172 $this->markTestSkipped( 'This test is only valid in a subdirectory configuration.' ); … … 137 176 $this->assertFalse( $site ); 138 177 } 139 178 179 /** 180 * @covers ::get_blog_details 181 */ 140 182 public function test_get_blog_details_with_only_path_in_fields() { 141 183 $site = get_blog_details( array( 'path' => '/foo/' ) ); 142 184 $this->assertFalse( $site ); … … 144 186 145 187 /** 146 188 * @ticket 50391 189 * 190 * @covers ::get_blog_details 147 191 */ 148 192 public function test_get_blog_details_does_not_switch_to_current_blog() { 149 193 $count = did_action( 'switch_blog' ); … … 156 200 * @dataProvider data_get_all 157 201 * 158 202 * @ticket 40228 203 * 204 * @covers ::get_blog_details 159 205 */ 160 206 public function test_get_blog_details_get_object_vars( $get_all ) { 161 207 $site = get_blog_details( … … 175 221 * @dataProvider data_get_all 176 222 * 177 223 * @ticket 40228 224 * 225 * @covers ::get_blog_details 178 226 */ 179 227 public function test_get_blog_details_iterate_over_result( $get_all ) { 180 228 $site = get_blog_details( -
tests/phpunit/tests/multisite/getIdFromBlogname.php
85 85 86 86 /** 87 87 * @ticket 34450 88 * 89 * @covers ::get_id_from_blogname 88 90 */ 89 91 public function test_get_id_from_blogname_no_www() { 90 92 global $current_site; … … 106 108 107 109 /** 108 110 * @ticket 34450 111 * 112 * @covers ::get_id_from_blogname 109 113 */ 110 114 public function test_get_id_from_blogname_www() { 111 115 global $current_site; … … 125 129 $this->assertSame( $expected, $result ); 126 130 } 127 131 132 /** 133 * @covers ::get_id_from_blogname 134 */ 128 135 public function test_get_id_from_blogname_invalid_slug() { 129 136 global $current_site; 130 137 -
tests/phpunit/tests/multisite/getMainSiteId.php
69 69 70 70 /** 71 71 * @ticket 29684 72 * 73 * @covers ::get_main_site_id 72 74 */ 73 75 public function test_get_main_site_id_on_main_site_returns_self() { 74 76 $this->assertSame( get_current_blog_id(), get_main_site_id() ); … … 76 78 77 79 /** 78 80 * @ticket 29684 81 * 82 * @covers ::get_main_site_id 79 83 */ 80 84 public function test_get_main_site_id_returns_main_site_in_switched_context() { 81 85 $main_site_id = get_current_blog_id(); … … 90 94 91 95 /** 92 96 * @ticket 29684 97 * 98 * @covers ::get_main_site_id 93 99 */ 94 100 public function test_get_main_site_id_with_different_network_returns_correct_id() { 95 101 $this->assertSame( self::$site_ids['wordpress.org/'], get_main_site_id( self::$network_ids['wordpress.org/'] ) ); … … 97 103 98 104 /** 99 105 * @ticket 29684 106 * 107 * @covers ::get_main_site_id 100 108 */ 101 109 public function test_get_main_site_id_on_network_without_site_returns_0() { 102 110 $this->assertSame( 0, get_main_site_id( self::$network_ids['wp.org/'] ) ); … … 104 112 105 113 /** 106 114 * @ticket 29684 115 * 116 * @covers ::get_main_site_id 107 117 */ 108 118 public function test_get_main_site_id_on_invalid_network_returns_0() { 109 119 $this->assertSame( 0, get_main_site_id( 333 ) ); … … 111 121 112 122 /** 113 123 * @ticket 29684 124 * 125 * @covers ::get_main_site_id 114 126 */ 115 127 public function test_get_main_site_id_filtered() { 116 128 add_filter( 'pre_get_main_site_id', array( $this, 'filter_get_main_site_id' ) ); … … 125 137 126 138 /** 127 139 * @ticket 29684 140 * 141 * @covers ::get_main_site_id 128 142 */ 129 143 public function test_get_main_site_id_filtered_depending_on_network() { 130 144 add_filter( 'pre_get_main_site_id', array( $this, 'filter_get_main_site_id_depending_on_network' ), 10, 2 ); … … 144 158 145 159 /** 146 160 * @ticket 41936 161 * 162 * @covers ::get_main_site_id 147 163 */ 148 164 public function test_get_main_site_id_with_property_value() { 149 165 global $current_site; … … 160 176 161 177 /** 162 178 * @ticket 41936 179 * 180 * @covers ::get_main_site_id 163 181 */ 164 182 public function test_get_main_site_id_filtered_with_property_value() { 165 183 global $current_site; -
tests/phpunit/tests/multisite/getSite.php
40 40 wp_update_network_site_counts(); 41 41 } 42 42 43 /** 44 * @covers ::get_site 45 */ 43 46 public function test_get_site_in_switched_state_returns_switched_site() { 44 47 switch_to_blog( self::$site_ids['wordpress.org/foo/'] ); 45 48 $site = get_site(); -
tests/phpunit/tests/multisite/getSpaceAllowed.php
43 43 /** 44 44 * When no option exists for the site or the network, a fallback of 45 45 * 100 is expected. 46 * 47 * @covers ::get_space_allowed 46 48 */ 47 49 public function test_get_space_allowed_default() { 48 50 delete_option( 'blog_upload_space' ); … … 54 56 /** 55 57 * If an individual site's option is not available, the default network 56 58 * level option is used as a fallback. 59 * 60 * @covers ::get_space_allowed 57 61 */ 58 62 public function test_get_space_allowed_no_site_option_fallback_to_network_option() { 59 63 delete_site_option( 'blog_upload_space' ); … … 68 72 * @param mixed $site_option Option to assign to the site's `blog_upload_space`. 69 73 * @param mixed $network_option Option to assign to the network's `blog_upload_space`. 70 74 * @param int $expected Expected return value. 75 * 76 * @covers ::get_space_allowed 71 77 */ 72 78 public function test_get_space_allowed( $site_option, $network_option, $expected ) { 73 79 update_option( 'blog_upload_space', $site_option ); … … 100 106 ); 101 107 } 102 108 109 /** 110 * @covers ::get_space_allowed 111 */ 103 112 public function test_get_space_allowed_filtered() { 104 113 update_option( 'blog_upload_space', 777 ); 105 114 update_site_option( 'blog_upload_space', 888 ); -
tests/phpunit/tests/multisite/getSpaceUsed.php
4 4 5 5 /** 6 6 * @group multisite 7 * @covers ::get_space_used8 7 */ 9 8 class Tests_Multisite_Get_Space_Used extends WP_UnitTestCase { 10 9 protected $suppress = false; … … 21 20 parent::tearDown(); 22 21 } 23 22 23 /** 24 * @covers ::get_space_used 25 */ 24 26 function test_get_space_used_switched_site() { 25 27 $blog_id = self::factory()->blog->create(); 26 28 switch_to_blog( $blog_id ); … … 54 56 /** 55 57 * Directories of sub sites on a network should not count against the same spaced used total for 56 58 * the main site. 59 * 60 * @covers ::get_space_used 57 61 */ 58 62 function test_get_space_used_main_site() { 59 63 $space_used = get_space_used(); … … 89 93 restore_current_blog(); 90 94 } 91 95 96 /** 97 * @covers ::get_space_used 98 */ 92 99 function test_get_space_used_pre_get_spaced_used_filter() { 93 100 add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) ); 94 101 -
tests/phpunit/tests/multisite/isUploadSpaceAvailable.php
48 48 /** 49 49 * A default of 100MB is used when no `blog_upload_space` option 50 50 * exists at the site or network level. 51 * 52 * @covers ::is_upload_space_available 51 53 */ 52 54 public function test_is_upload_space_available_default() { 53 55 delete_option( 'blog_upload_space' ); … … 60 62 $this->assertTrue( $available ); 61 63 } 62 64 65 /** 66 * @covers ::is_upload_space_available 67 */ 63 68 public function test_is_upload_space_available_check_disabled() { 64 69 update_site_option( 'blog_upload_space', 10 ); 65 70 update_site_option( 'upload_space_check_disabled', true ); … … 71 76 $this->assertTrue( $available ); 72 77 } 73 78 79 /** 80 * @covers ::is_upload_space_available 81 */ 74 82 public function test_is_upload_space_available_space_used_is_less_then_allowed() { 75 83 update_option( 'blog_upload_space', 350 ); 76 84 … … 81 89 $this->assertTrue( $available ); 82 90 } 83 91 92 /** 93 * @covers ::is_upload_space_available 94 */ 84 95 function test_is_upload_space_available_space_used_is_more_than_allowed() { 85 96 update_option( 'blog_upload_space', 350 ); 86 97 … … 94 105 /** 95 106 * More comprehensive testing a 0 condition is handled in the tests 96 107 * for `get_space_allowed()`. We cover one scenario here. 108 * 109 * @covers ::is_upload_space_available 97 110 */ 98 111 function test_is_upload_space_available_upload_space_0_defaults_to_100() { 99 112 update_option( 'blog_upload_space', 0 ); … … 105 118 $this->assertFalse( $available ); 106 119 } 107 120 121 /** 122 * @covers ::is_upload_space_available 123 */ 108 124 function test_is_upload_space_available_upload_space_negative() { 109 125 update_site_option( 'blog_upload_space', -1 ); 110 126 -
tests/phpunit/tests/multisite/ms-files-rewriting.php
32 32 parent::tearDown(); 33 33 } 34 34 35 /** 36 * @covers ::switch_to_blog 37 * @covers ::wp_upload_dir 38 */ 35 39 function test_switch_upload_dir() { 36 40 $this->assertTrue( is_main_site() ); 37 41 … … 59 63 * When a site is deleted with wpmu_delete_blog(), only the files associated with 60 64 * that site should be removed. When wpmu_delete_blog() is run a second time, nothing 61 65 * should change with upload directories. 66 * 67 * @covers ::wpmu_delete_blog 62 68 */ 63 69 function test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files() { 64 70 $filename = __FUNCTION__ . '.jpg'; -
tests/phpunit/tests/multisite/network.php
74 74 75 75 /** 76 76 * By default, only one network exists and has a network ID of 1. 77 * 78 * @covers ::get_main_network_id 77 79 */ 78 80 function test_get_main_network_id_default() { 79 81 $this->assertSame( 1, get_main_network_id() ); … … 82 84 /** 83 85 * If a second network is created, network ID 1 should still be returned 84 86 * as the main network ID. 87 * 88 * @covers ::get_main_network_id 85 89 */ 86 90 function test_get_main_network_id_two_networks() { 87 91 self::factory()->network->create(); … … 92 96 /** 93 97 * When the `$current_site` global is populated with another network, the 94 98 * main network should still return as 1. 99 * 100 * @covers ::get_main_network_id 95 101 */ 96 102 function test_get_main_network_id_after_network_switch() { 97 103 global $current_site; … … 109 115 * 110 116 * @todo In the future, we'll have a smarter way of deleting a network. For now, 111 117 * fake the process with UPDATE queries. 118 * 119 * @covers ::get_main_network_id 112 120 */ 113 121 function test_get_main_network_id_after_network_delete() { 114 122 global $wpdb, $current_site; … … 135 143 136 144 /** 137 145 * @ticket 37050 146 * 147 * @covers WP_Network::get_instance 138 148 */ 139 149 function test_wp_network_object_id_property_is_int() { 140 150 $id = self::factory()->network->create(); … … 146 156 147 157 /** 148 158 * @ticket 22917 159 * 160 * @covers ::get_blog_count 149 161 */ 150 162 public function test_get_blog_count_no_filter_applied() { 151 163 wp_update_network_counts(); … … 164 176 165 177 /** 166 178 * @ticket 22917 179 * 180 * @covers ::get_blog_count 167 181 */ 168 182 public function test_get_blog_count_enable_live_network_counts_false() { 169 183 wp_update_network_counts(); … … 184 198 185 199 /** 186 200 * @ticket 22917 201 * 202 * @covers ::get_blog_count 187 203 */ 188 204 public function test_get_blog_count_enabled_live_network_counts_true() { 189 205 wp_update_network_counts(); … … 204 220 205 221 /** 206 222 * @ticket 37865 223 * 224 * @covers ::get_blog_count 207 225 */ 208 226 public function test_get_blog_count_on_different_network() { 209 227 wp_update_network_site_counts( self::$different_network_id ); … … 215 233 216 234 /** 217 235 * @ticket 37866 236 * 237 * @covers ::get_blog_count 218 238 */ 219 239 public function test_get_user_count_on_different_network() { 220 240 wp_update_network_user_counts(); … … 232 252 233 253 /** 234 254 * @ticket 22917 255 * 256 * @covers ::get_blog_count 235 257 */ 236 258 function test_enable_live_network_user_counts_filter() { 237 259 // False for large networks by default. … … 262 284 remove_filter( 'enable_live_network_counts', '__return_true' ); 263 285 } 264 286 287 /** 288 * @covers ::wp_get_active_network_plugins 289 */ 265 290 function test_active_network_plugins() { 266 291 $path = 'hello.php'; 267 292 … … 292 317 293 318 /** 294 319 * @ticket 28651 320 * 321 * @covers ::wp_get_active_network_plugins 295 322 */ 296 323 function test_duplicate_network_active_plugin() { 297 324 $path = 'hello.php'; … … 313 340 remove_action( 'activate_' . $path, array( $mock, 'action' ) ); 314 341 } 315 342 343 /** 344 * @covers ::is_plugin_active_for_network 345 */ 316 346 function test_is_plugin_active_for_network_true() { 317 347 activate_plugin( 'hello.php', '', true ); 318 348 $this->assertTrue( is_plugin_active_for_network( 'hello.php' ) ); 319 349 } 320 350 351 /** 352 * @covers ::is_plugin_active_for_network 353 */ 321 354 function test_is_plugin_active_for_network_false() { 322 355 deactivate_plugins( 'hello.php', false, true ); 323 356 $this->assertFalse( is_plugin_active_for_network( 'hello.php' ) ); … … 327 360 $this->plugin_hook_count++; 328 361 } 329 362 363 /** 364 * @covers ::get_user_count 365 */ 330 366 function test_get_user_count() { 331 367 // Refresh the cache. 332 368 wp_update_network_counts(); … … 346 382 remove_filter( 'enable_live_network_counts', '__return_false' ); 347 383 } 348 384 385 /** 386 * @coversNothing 387 */ 349 388 function test_wp_schedule_update_network_counts() { 350 389 $this->assertFalse( wp_next_scheduled( 'update_network_counts' ) ); 351 390 … … 357 396 358 397 /** 359 398 * @expectedDeprecated get_dashboard_blog 399 * 400 * @covers ::get_dashboard_blog 360 401 */ 361 402 function test_get_dashboard_blog() { 362 403 // If there is no dashboard blog set, current blog is used. … … 375 416 376 417 /** 377 418 * @ticket 37528 419 * 420 * @covers ::wp_update_network_site_counts 378 421 */ 379 422 function test_wp_update_network_site_counts() { 380 423 update_network_option( null, 'blog_count', 40 ); … … 397 440 398 441 /** 399 442 * @ticket 37528 443 * 444 * @covers ::wp_update_network_site_counts 400 445 */ 401 446 function test_wp_update_network_site_counts_on_different_network() { 402 447 update_network_option( self::$different_network_id, 'blog_count', 40 ); … … 409 454 410 455 /** 411 456 * @ticket 40349 457 * 458 * @covers ::wp_update_network_site_counts 412 459 */ 413 460 public function test_wp_update_network_user_counts() { 414 461 global $wpdb; … … 425 472 426 473 /** 427 474 * @ticket 40349 475 * 476 * @covers ::wp_update_network_site_counts 428 477 */ 429 478 public function test_wp_update_network_user_counts_on_different_network() { 430 479 global $wpdb; … … 441 490 442 491 /** 443 492 * @ticket 40386 493 * 494 * @covers ::wp_update_network_site_counts 444 495 */ 445 496 public function test_wp_update_network_counts() { 446 497 delete_network_option( null, 'blog_count' ); … … 456 507 457 508 /** 458 509 * @ticket 40386 510 * 511 * @covers ::wp_update_network_site_counts 459 512 */ 460 513 public function test_wp_update_network_counts_on_different_network() { 461 514 delete_network_option( self::$different_network_id, 'blog_count' ); … … 472 525 /** 473 526 * @ticket 40489 474 527 * @dataProvider data_wp_is_large_network 528 * 529 * @covers ::wp_is_large_network 475 530 */ 476 531 public function test_wp_is_large_network( $using, $count, $expected, $different_network ) { 477 532 $network_id = $different_network ? self::$different_network_id : null; … … 503 558 /** 504 559 * @ticket 40489 505 560 * @dataProvider data_wp_is_large_network_filtered_by_component 561 * 562 * @covers ::wp_is_large_network 506 563 */ 507 564 public function test_wp_is_large_network_filtered_by_component( $using, $count, $expected, $different_network ) { 508 565 $network_id = $different_network ? self::$different_network_id : null; … … 545 602 /** 546 603 * @ticket 40489 547 604 * @dataProvider data_wp_is_large_network_filtered_by_network 605 * 606 * @covers ::wp_is_large_network 548 607 */ 549 608 public function test_wp_is_large_network_filtered_by_network( $using, $count, $expected, $different_network ) { 550 609 $network_id = $different_network ? self::$different_network_id : null; … … 586 645 587 646 /** 588 647 * @ticket 38699 648 * 649 * @covers ::wpmu_create_blog 589 650 */ 590 651 public function test_wpmu_create_blog_updates_correct_network_site_count() { 591 652 $original_count = get_blog_count( self::$different_network_id ); … … 601 662 602 663 /** 603 664 * @ticket 29684 665 * 666 * @covers ::get_network 604 667 */ 605 668 public function test_network_blog_id_set() { 606 669 $network = get_network( self::$different_network_id ); … … 610 673 611 674 /** 612 675 * @ticket 42251 676 * 677 * @covers ::get_network 613 678 */ 614 679 public function test_get_network_not_found_cache() { 615 680 global $wpdb; … … 624 689 625 690 /** 626 691 * @ticket 42251 692 * 693 * @covers ::get_network 627 694 */ 628 695 public function test_get_network_not_found_cache_clear() { 629 696 $new_network_id = $this->_get_next_network_id(); -
tests/phpunit/tests/multisite/networkQuery.php
61 61 } 62 62 } 63 63 64 /** 65 * @covers WP_Network_Query::query 66 */ 64 67 public function test_wp_network_query_by_number() { 65 68 $q = new WP_Network_Query(); 66 69 $found = $q->query( … … 73 76 $this->assertSame( 3, count( $found ) ); 74 77 } 75 78 79 /** 80 * @covers WP_Network_Query::query 81 */ 76 82 public function test_wp_network_query_by_network__in_with_order() { 77 83 $expected = array( self::$network_ids['wordpress.org/'], self::$network_ids['make.wordpress.org/'] ); 78 84 … … 98 104 $this->assertSame( array_reverse( $expected ), $found ); 99 105 } 100 106 107 /** 108 * @covers WP_Network_Query::query 109 */ 101 110 public function test_wp_network_query_by_network__in_with_single_id() { 102 111 $expected = array( self::$network_ids['wordpress.org/'] ); 103 112 … … 112 121 $this->assertSameSets( $expected, $found ); 113 122 } 114 123 124 /** 125 * @covers WP_Network_Query::query 126 */ 115 127 public function test_wp_network_query_by_network__in_with_multiple_ids() { 116 128 $expected = array( self::$network_ids['wordpress.org/'], self::$network_ids['www.wordpress.net/'] ); 117 129 … … 126 138 $this->assertSameSets( $expected, $found ); 127 139 } 128 140 141 /** 142 * @covers WP_Network_Query::query 143 */ 129 144 public function test_wp_network_query_by_network__in_and_count_with_multiple_ids() { 130 145 $expected = array( self::$network_ids['wordpress.org/'], self::$network_ids['make.wordpress.org/'] ); 131 146 … … 141 156 $this->assertSame( 2, $found ); 142 157 } 143 158 159 /** 160 * @covers WP_Network_Query::query 161 */ 144 162 public function test_wp_network_query_by_network__not_in_with_single_id() { 145 163 $excluded = array( self::$network_ids['wordpress.org/'] ); 146 164 $expected = array_diff( self::$network_ids, $excluded ); … … 159 177 $this->assertSameSets( $expected, $found ); 160 178 } 161 179 180 /** 181 * @covers WP_Network_Query::query 182 */ 162 183 public function test_wp_network_query_by_network__not_in_with_multiple_ids() { 163 184 $excluded = array( self::$network_ids['wordpress.org/'], self::$network_ids['www.w.org/foo/'] ); 164 185 $expected = array_diff( self::$network_ids, $excluded ); … … 177 198 $this->assertSameSets( $expected, $found ); 178 199 } 179 200 201 /** 202 * @covers WP_Network_Query::query 203 */ 180 204 public function test_wp_network_query_by_domain() { 181 205 $q = new WP_Network_Query(); 182 206 $found = $q->query( … … 193 217 $this->assertSameSets( $expected, $found ); 194 218 } 195 219 220 /** 221 * @covers WP_Network_Query::query 222 */ 196 223 public function test_wp_network_query_by_domain__in_with_single_domain() { 197 224 $q = new WP_Network_Query(); 198 225 $found = $q->query( … … 209 236 $this->assertSameSets( $expected, $found ); 210 237 } 211 238 239 /** 240 * @covers WP_Network_Query::query 241 */ 212 242 public function test_wp_network_query_by_domain__in_with_multiple_domains() { 213 243 $q = new WP_Network_Query(); 214 244 $found = $q->query( … … 226 256 $this->assertSameSets( $expected, $found ); 227 257 } 228 258 259 /** 260 * @covers WP_Network_Query::query 261 */ 229 262 public function test_wp_network_query_by_domain__in_with_multiple_domains_and_number() { 230 263 $q = new WP_Network_Query(); 231 264 $found = $q->query( … … 243 276 $this->assertSameSets( $expected, $found ); 244 277 } 245 278 279 /** 280 * @covers WP_Network_Query::query 281 */ 246 282 public function test_wp_network_query_by_domain__in_with_multiple_domains_and_number_and_offset() { 247 283 $q = new WP_Network_Query(); 248 284 $found = $q->query( … … 261 297 $this->assertSameSets( $expected, $found ); 262 298 } 263 299 300 /** 301 * @covers WP_Network_Query::query 302 */ 264 303 public function test_wp_network_query_by_domain__not_in_with_single_domain() { 265 304 $q = new WP_Network_Query(); 266 305 $found = $q->query( … … 280 319 $this->assertSameSets( $expected, $found ); 281 320 } 282 321 322 /** 323 * @covers WP_Network_Query::query 324 */ 283 325 public function test_wp_network_query_by_domain__not_in_with_multiple_domains() { 284 326 $q = new WP_Network_Query(); 285 327 $found = $q->query( … … 298 340 $this->assertSameSets( $expected, $found ); 299 341 } 300 342 343 /** 344 * @covers WP_Network_Query::query 345 */ 301 346 public function test_wp_network_query_by_domain__not_in_with_multiple_domains_and_number() { 302 347 $q = new WP_Network_Query(); 303 348 $found = $q->query( … … 316 361 $this->assertSameSets( $expected, $found ); 317 362 } 318 363 364 /** 365 * @covers WP_Network_Query::query 366 */ 319 367 public function test_wp_network_query_by_domain__not_in_with_multiple_domains_and_number_and_offset() { 320 368 $q = new WP_Network_Query(); 321 369 $found = $q->query( … … 335 383 $this->assertSameSets( $expected, $found ); 336 384 } 337 385 386 /** 387 * @covers WP_Network_Query::query 388 */ 338 389 public function test_wp_network_query_by_path_with_expected_results() { 339 390 $q = new WP_Network_Query(); 340 391 $found = $q->query( … … 354 405 $this->assertSameSets( $expected, $found ); 355 406 } 356 407 408 /** 409 * @covers WP_Network_Query::query 410 */ 357 411 public function test_wp_network_query_by_path_and_number_and_offset_with_expected_results() { 358 412 $q = new WP_Network_Query(); 359 413 $found = $q->query( … … 373 427 $this->assertSameSets( $expected, $found ); 374 428 } 375 429 430 /** 431 * @covers WP_Network_Query::query 432 */ 376 433 public function test_wp_network_query_by_path_with_no_expected_results() { 377 434 $q = new WP_Network_Query(); 378 435 $found = $q->query( … … 385 442 $this->assertEmpty( $found ); 386 443 } 387 444 445 /** 446 * @covers WP_Network_Query::query 447 */ 388 448 public function test_wp_network_query_by_search_with_text_in_domain() { 389 449 $q = new WP_Network_Query(); 390 450 $found = $q->query( … … 401 461 $this->assertSameSets( $expected, $found ); 402 462 } 403 463 464 /** 465 * @covers WP_Network_Query::query 466 */ 404 467 public function test_wp_network_query_by_search_with_text_in_path() { 405 468 $q = new WP_Network_Query(); 406 469 $found = $q->query( … … 417 480 $this->assertSameSets( $expected, $found ); 418 481 } 419 482 483 /** 484 * @covers WP_Network_Query::query 485 */ 420 486 public function test_wp_network_query_by_path_order_by_domain_desc() { 421 487 $q = new WP_Network_Query(); 422 488 $found = $q->query( … … 440 506 441 507 /** 442 508 * @ticket 41347 509 * 510 * @covers WP_Network_Query::query 443 511 */ 444 512 public function test_wp_network_query_cache_with_different_fields_no_count() { 445 513 global $wpdb; … … 467 535 468 536 /** 469 537 * @ticket 41347 538 * 539 * @covers WP_Network_Query::query 470 540 */ 471 541 public function test_wp_network_query_cache_with_different_fields_active_count() { 472 542 global $wpdb; … … 496 566 497 567 /** 498 568 * @ticket 41347 569 * 570 * @covers WP_Network_Query::query 499 571 */ 500 572 public function test_wp_network_query_cache_with_same_fields_different_count() { 501 573 global $wpdb; … … 526 598 /** 527 599 * @ticket 45749 528 600 * @ticket 47599 601 * 602 * @covers WP_Network_Query::query 529 603 */ 530 604 public function test_networks_pre_query_filter_should_bypass_database_query() { 531 605 global $wpdb; … … 557 631 558 632 /** 559 633 * @ticket 51333 634 * 635 * @covers WP_Network_Query::query 560 636 */ 561 637 public function test_networks_pre_query_filter_should_set_networks_property() { 562 638 add_filter( 'networks_pre_query', array( __CLASS__, 'filter_networks_pre_query_and_set_networks' ), 10, 2 ); -
tests/phpunit/tests/multisite/site.php
88 88 } 89 89 } 90 90 91 /** 92 * @covers ::restore_current_blog 93 */ 91 94 function test_switch_restore_blog() { 92 95 global $_wp_switched_stack, $wpdb; 93 96 … … 135 138 136 139 /** 137 140 * Test the cache keys and database tables setup through the creation of a site. 141 * 142 * @covers ::get_blog_details 138 143 */ 139 144 function test_created_site_details() { 140 145 global $wpdb; … … 192 197 $this->assertSame( 2, (int) get_blog_count() ); 193 198 } 194 199 200 /** 201 * @covers ::wp_suspend_cache_invalidation 202 */ 195 203 public function test_site_caches_should_invalidate_when_invalidation_is_not_suspended() { 196 204 $site_id = self::factory()->blog->create(); 197 205 … … 205 213 $this->assertNotEquals( $details->path, $new_details->path ); 206 214 } 207 215 216 /** 217 * @covers ::wp_suspend_cache_invalidation 218 */ 208 219 public function test_site_caches_should_not_invalidate_when_invalidation_is_suspended() { 209 220 $site_id = self::factory()->blog->create(); 210 221 … … 220 231 221 232 /** 222 233 * When a site is flagged as 'deleted', its data should be cleared from cache. 234 * 235 * @covers ::wpmu_delete_blog 223 236 */ 224 237 function test_data_in_cache_after_wpmu_delete_blog_drop_false() { 225 238 $blog_id = self::factory()->blog->create(); … … 238 251 239 252 /** 240 253 * When a site is flagged as 'deleted', its data should remain in the database. 254 * 255 * @covers ::wpmu_delete_blog 241 256 */ 242 257 function test_data_in_tables_after_wpmu_delete_blog_drop_false() { 243 258 global $wpdb; … … 261 276 262 277 /** 263 278 * When a site is fully deleted, its data should be cleared from cache. 279 * 280 * @covers ::wpmu_delete_blog 264 281 */ 265 282 function test_data_in_cache_after_wpmu_delete_blog_drop_true() { 266 283 $blog_id = self::factory()->blog->create(); … … 279 296 280 297 /** 281 298 * When a site is fully deleted, its data should be removed from the database. 299 * 300 * @covers ::wpmu_delete_blog 282 301 */ 283 302 function test_data_in_tables_after_wpmu_delete_blog_drop_true() { 284 303 global $wpdb; … … 302 321 303 322 /** 304 323 * When the main site of a network is fully deleted, its data should be cleared from cache. 324 * 325 * @covers ::wpmu_delete_blog 305 326 */ 306 327 function test_data_in_cache_after_wpmu_delete_blog_main_site_drop_true() { 307 328 $blog_id = 1; // The main site in our test suite has an ID of 1. … … 320 341 321 342 /** 322 343 * When the main site of a network is fully deleted, its data should remain in the database. 344 * 345 * @covers ::wpmu_delete_blog 323 346 */ 324 347 function test_data_in_tables_after_wpmu_delete_blog_main_site_drop_true() { 325 348 global $wpdb; … … 343 366 344 367 /** 345 368 * The site count of a network should change when a site is flagged as 'deleted'. 369 * 370 * @covers ::wpmu_delete_blog 346 371 */ 347 372 function test_network_count_after_wpmu_delete_blog_drop_false() { 348 373 $blog_id = self::factory()->blog->create(); … … 357 382 358 383 /** 359 384 * The site count of a network should change when a site is fully deleted. 385 * 386 * @covers ::wpmu_delete_blog 360 387 */ 361 388 function test_blog_count_after_wpmu_delete_blog_drop_true() { 362 389 $blog_id = self::factory()->blog->create(); … … 373 400 * When a site is deleted with wpmu_delete_blog(), only the files associated with 374 401 * that site should be removed. When wpmu_delete_blog() is run a second time, nothing 375 402 * should change with upload directories. 403 * 404 * @covers ::wpmu_delete_blog 376 405 */ 377 406 function test_upload_directories_after_multiple_wpmu_delete_blog() { 378 407 $filename = __FUNCTION__ . '.jpg'; … … 400 429 $this->assertFileNotExists( $file2['file'] ); 401 430 } 402 431 432 /** 433 * @covers ::wpmu_update_blogs_date 434 */ 403 435 function test_wpmu_update_blogs_date() { 404 436 global $wpdb; 405 437 … … 424 456 * Test cached data for a site that does not exist and then again after it exists. 425 457 * 426 458 * @ticket 23405 459 * 460 * @covers ::get_blog_details 427 461 */ 428 462 function test_get_blog_details_when_site_does_not_exist() { 429 463 // Create an unused site so that we can then assume an invalid site ID. … … 450 484 451 485 /** 452 486 * Updating a field returns the sme value that was passed. 487 * 488 * @covers ::update_blog_status 453 489 */ 454 490 function test_update_blog_status() { 455 491 $result = update_blog_status( 1, 'spam', 0 ); … … 458 494 459 495 /** 460 496 * Updating an invalid field returns the same value that was passed. 497 * 498 * @covers ::update_blog_status 461 499 */ 462 500 function test_update_blog_status_invalid_status() { 463 501 $result = update_blog_status( 1, 'doesnotexist', 'invalid' ); … … 464 502 $this->assertSame( 'invalid', $result ); 465 503 } 466 504 505 /** 506 * @covers ::update_blog_status 507 */ 467 508 function test_update_blog_status_make_ham_blog_action() { 468 509 global $test_action_counter; 469 510 $test_action_counter = 0; … … 488 529 remove_action( 'make_ham_blog', array( $this, '_action_counter_cb' ), 10 ); 489 530 } 490 531 532 /** 533 * @covers ::update_blog_status 534 */ 491 535 function test_content_from_spam_blog_is_not_available() { 492 536 $spam_blog_id = self::factory()->blog->create(); 493 537 switch_to_blog( $spam_blog_id ); … … 518 562 $this->assertNotContains( "src=\"{$spam_embed_url}#?", $content ); 519 563 } 520 564 565 /** 566 * @covers ::update_blog_status 567 */ 521 568 function test_update_blog_status_make_spam_blog_action() { 522 569 global $test_action_counter; 523 570 $test_action_counter = 0; … … 541 588 remove_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 ); 542 589 } 543 590 591 /** 592 * @covers ::update_blog_status 593 */ 544 594 function test_update_blog_status_archive_blog_action() { 545 595 global $test_action_counter; 546 596 $test_action_counter = 0; … … 564 614 remove_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 ); 565 615 } 566 616 617 /** 618 * @covers ::update_blog_status 619 */ 567 620 function test_update_blog_status_unarchive_blog_action() { 568 621 global $test_action_counter; 569 622 $test_action_counter = 0; … … 587 640 remove_action( 'unarchive_blog', array( $this, '_action_counter_cb' ), 10 ); 588 641 } 589 642 643 /** 644 * @covers ::update_blog_status 645 */ 590 646 function test_update_blog_status_make_delete_blog_action() { 591 647 global $test_action_counter; 592 648 $test_action_counter = 0; … … 610 666 remove_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 ); 611 667 } 612 668 669 /** 670 * @covers ::update_blog_status 671 */ 613 672 function test_update_blog_status_make_undelete_blog_action() { 614 673 global $test_action_counter; 615 674 $test_action_counter = 0; … … 634 693 remove_action( 'make_undelete_blog', array( $this, '_action_counter_cb' ), 10 ); 635 694 } 636 695 696 /** 697 * @covers ::update_blog_status 698 */ 637 699 function test_update_blog_status_mature_blog_action() { 638 700 global $test_action_counter; 639 701 $test_action_counter = 0; … … 657 719 remove_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 ); 658 720 } 659 721 722 /** 723 * @covers ::update_blog_status 724 */ 660 725 function test_update_blog_status_unmature_blog_action() { 661 726 global $test_action_counter; 662 727 $test_action_counter = 0; … … 681 746 remove_action( 'unmature_blog', array( $this, '_action_counter_cb' ), 10 ); 682 747 } 683 748 749 /** 750 * @covers ::update_blog_status 751 */ 684 752 function test_update_blog_status_update_blog_public_action() { 685 753 global $test_action_counter; 686 754 $test_action_counter = 0; … … 706 774 707 775 /** 708 776 * @ticket 27952 777 * 778 * @covers WP_Site::post_count 709 779 */ 710 780 function test_posts_count() { 711 781 self::factory()->post->create(); … … 718 788 719 789 /** 720 790 * @ticket 26410 791 * 792 * @covers ::update_option 721 793 */ 722 794 function test_blog_details_cache_invalidation() { 723 795 update_option( 'blogname', 'foo' ); … … 732 804 /** 733 805 * Test the original and cached responses for a created and then deleted site when 734 806 * the blog ID is requested through get_blog_id_from_url(). 807 * 808 * @covers ::get_blog_id_from_url 735 809 */ 736 810 function test_get_blog_id_from_url() { 737 811 $blog_id = self::factory()->blog->create(); … … 745 819 746 820 /** 747 821 * Test the case insensitivity of the site lookup. 822 * 823 * @covers ::get_blog_id_from_url 748 824 */ 749 825 function test_get_blog_id_from_url_is_case_insensitive() { 750 826 $blog_id = self::factory()->blog->create( … … 760 836 761 837 /** 762 838 * Test the first and cached responses for a site that does not exist. 839 * 840 * @covers ::get_blog_id_from_url 763 841 */ 764 842 function test_get_blog_id_from_url_that_does_not_exist() { 765 843 $blog_id = self::factory()->blog->create( array( 'path' => '/xyz' ) ); … … 772 850 /** 773 851 * A blog ID is still available if only the `deleted` flag is set for a site. The same 774 852 * behavior would be expected if passing `false` explicitly to `wpmu_delete_blog()`. 853 * 854 * @covers ::wpmu_delete_blog 775 855 */ 776 856 function test_get_blog_id_from_url_with_deleted_flag() { 777 857 $blog_id = self::factory()->blog->create(); … … 786 866 /** 787 867 * When deleted with the drop parameter as true, the cache will first be false, then set to 788 868 * -1 after an attempt at `get_blog_id_from_url()` is made. 869 * 870 * @covers ::wpmu_delete_blog 789 871 */ 790 872 function test_get_blog_id_from_url_after_dropped() { 791 873 $blog_id = self::factory()->blog->create(); … … 800 882 801 883 /** 802 884 * Test with default parameter of site_id as null. 885 * 886 * @covers ::is_main_site 803 887 */ 804 888 function test_is_main_site() { 805 889 $this->assertTrue( is_main_site() ); … … 808 892 /** 809 893 * Test with a site id of get_current_blog_id(), which should be the same as the 810 894 * default parameter tested above. 895 * 896 * @covers ::is_main_site 811 897 */ 812 898 function test_current_blog_id_is_main_site() { 813 899 $this->assertTrue( is_main_site( get_current_blog_id() ) ); … … 815 901 816 902 /** 817 903 * Test with a site ID other than the main site to ensure a false response. 904 * 905 * @covers ::is_main_site 818 906 */ 819 907 function test_is_main_site_is_false_with_other_blog_id() { 820 908 $blog_id = self::factory()->blog->create(); … … 824 912 825 913 /** 826 914 * Test with no passed ID after switching to another site ID. 915 * 916 * @covers ::is_main_site 827 917 */ 828 918 function test_is_main_site_is_false_after_switch_to_blog() { 829 919 $blog_id = self::factory()->blog->create(); … … 834 924 restore_current_blog(); 835 925 } 836 926 927 /** 928 * @covers ::switch_to_blog 929 * @covers ::wp_upload_dir 930 */ 837 931 function test_switch_upload_dir() { 838 932 $this->assertTrue( is_main_site() ); 839 933 … … 865 959 /** 866 960 * Test the primary purpose of get_blog_post(), to retrieve a post from 867 961 * another site on the network. 962 * 963 * @covers ::get_blog_post 868 964 */ 869 965 function test_get_blog_post_from_another_site_on_network() { 870 966 $blog_id = self::factory()->blog->create(); … … 880 976 881 977 /** 882 978 * If get_blog_post() is used on the same site, it should still work. 979 * 980 * @covers ::get_blog_post 883 981 */ 884 982 function test_get_blog_post_from_same_site() { 885 983 $post_id = self::factory()->post->create(); … … 889 987 890 988 /** 891 989 * A null response should be returned if an invalid post is requested. 990 * 991 * @covers ::get_blog_post 892 992 */ 893 993 function test_get_blog_post_invalid_returns_null() { 894 994 $this->assertNull( get_blog_post( 1, 999999 ) ); … … 906 1006 } 907 1007 } 908 1008 1009 /** 1010 * @covers ::domain_exists 1011 */ 909 1012 function test_domain_exists_with_default_site_id() { 910 1013 $details = get_site( 1 ); 911 1014 … … 912 1015 $this->assertSame( 1, domain_exists( $details->domain, $details->path ) ); 913 1016 } 914 1017 1018 /** 1019 * @covers ::domain_exists 1020 */ 915 1021 function test_domain_exists_with_specified_site_id() { 916 1022 $details = get_site( 1 ); 917 1023 … … 921 1027 /** 922 1028 * When the domain is valid, but the resulting site does not belong to the specified network, 923 1029 * it is marked as not existing. 1030 * 1031 * @covers ::domain_exists 924 1032 */ 925 1033 function test_domain_does_not_exist_with_invalid_site_id() { 926 1034 $details = get_site( 1 ); … … 928 1036 $this->assertNull( domain_exists( $details->domain, $details->path, 999 ) ); 929 1037 } 930 1038 1039 /** 1040 * @covers ::domain_exists 1041 */ 931 1042 function test_invalid_domain_does_not_exist_with_default_site_id() { 932 1043 $this->assertNull( domain_exists( 'foo', 'bar' ) ); 933 1044 } 934 1045 1046 /** 1047 * @covers ::domain_exists 1048 */ 935 1049 function test_domain_filtered_to_exist() { 936 1050 add_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 ); 937 1051 $exists = domain_exists( 'foo', 'bar' ); … … 942 1056 /** 943 1057 * When a path is passed to domain_exists, it is immediately trailing slashed. A path 944 1058 * value with or without the slash should result in the same return value. 1059 * 1060 * @covers ::domain_exists 945 1061 */ 946 1062 function test_slashed_path_in_domain_exists() { 947 1063 add_filter( 'domain_exists', array( $this, '_domain_exists_cb' ), 10, 4 ); … … 955 1071 956 1072 /** 957 1073 * Tests returning an address for a given valid ID. 1074 * 1075 * @covers ::get_blogaddress_by_id 958 1076 */ 959 1077 function test_get_blogaddress_by_id_with_valid_id() { 960 1078 $blogaddress = get_blogaddress_by_id( 1 ); … … 963 1081 964 1082 /** 965 1083 * Tests returning the appropriate response for a invalid id given. 1084 * 1085 * @covers ::get_blogaddress_by_id 966 1086 */ 967 1087 function test_get_blogaddress_by_id_with_invalid_id() { 968 1088 $blogaddress = get_blogaddress_by_id( 42 ); … … 971 1091 972 1092 /** 973 1093 * @ticket 14867 1094 * 1095 * @covers ::get_blogaddress_by_id 974 1096 */ 975 1097 function test_get_blogaddress_by_id_scheme_reflects_blog_scheme() { 976 1098 $blog = self::factory()->blog->create(); … … 984 1106 985 1107 /** 986 1108 * @ticket 14867 1109 * 1110 * @covers ::get_blogaddress_by_id 987 1111 */ 988 1112 function test_get_blogaddress_by_id_scheme_is_unaffected_by_request() { 989 1113 $blog = self::factory()->blog->create(); … … 1003 1127 /** 1004 1128 * @ticket 33620 1005 1129 * @dataProvider data_new_blog_url_schemes 1130 * 1131 * @covers ::set_url_scheme 1006 1132 */ 1007 1133 function test_new_blog_url_schemes( $home_scheme, $siteurl_scheme, $force_ssl_admin ) { 1008 1134 $current_site = get_current_site(); … … 1062 1188 1063 1189 /** 1064 1190 * @ticket 36918 1191 * 1192 * @covers ::wpmu_create_blog 1065 1193 */ 1066 1194 function test_new_blog_locale() { 1067 1195 $current_site = get_current_site(); … … 1097 1225 1098 1226 /** 1099 1227 * @ticket 40503 1228 * 1229 * @covers ::wpmu_create_blog 1100 1230 */ 1101 1231 function test_different_network_language() { 1102 1232 $network = get_network( self::$network_ids['make.wordpress.org/'] ); … … 1125 1255 1126 1256 /** 1127 1257 * @ticket 29684 1258 * 1259 * @covers ::is_main_site 1128 1260 */ 1129 1261 public function test_is_main_site_different_network() { 1130 1262 $this->assertTrue( is_main_site( self::$site_ids['make.wordpress.org/'], self::$network_ids['make.wordpress.org/'] ) ); … … 1132 1264 1133 1265 /** 1134 1266 * @ticket 29684 1267 * 1268 * @covers ::is_main_site 1135 1269 */ 1136 1270 public function test_is_main_site_different_network_random_site() { 1137 1271 $this->assertFalse( is_main_site( self::$site_ids['make.wordpress.org/foo/'], self::$network_ids['make.wordpress.org/'] ) ); … … 1140 1274 /** 1141 1275 * @ticket 40201 1142 1276 * @dataProvider data_get_site_caches 1277 * 1278 * @covers ::clean_blog_cache 1143 1279 */ 1144 1280 public function test_clean_blog_cache( $key, $group ) { 1145 1281 $site = get_site( self::$site_ids['make.wordpress.org/'] ); … … 1166 1302 /** 1167 1303 * @ticket 40201 1168 1304 * @dataProvider data_get_site_caches 1305 * 1306 * @covers ::clean_blog_cache 1169 1307 */ 1170 1308 public function test_clean_blog_cache_with_id( $key, $group ) { 1171 1309 $site = get_site( self::$site_ids['make.wordpress.org/'] ); … … 1191 1329 1192 1330 /** 1193 1331 * @ticket 40201 1332 * 1333 * @covers ::clean_blog_cache 1194 1334 */ 1195 1335 public function test_clean_blog_cache_resets_last_changed() { 1196 1336 $site = get_site( self::$site_ids['make.wordpress.org/'] ); … … 1203 1343 1204 1344 /** 1205 1345 * @ticket 40201 1346 * 1347 * @covers ::clean_blog_cache 1206 1348 */ 1207 1349 public function test_clean_blog_cache_fires_action() { 1208 1350 $site = get_site( self::$site_ids['make.wordpress.org/'] ); … … 1215 1357 1216 1358 /** 1217 1359 * @ticket 40201 1360 * 1361 * @covers ::clean_blog_cache 1218 1362 */ 1219 1363 public function test_clean_blog_cache_bails_on_suspend_cache_invalidation() { 1220 1364 $site = get_site( self::$site_ids['make.wordpress.org/'] ); … … 1229 1373 1230 1374 /** 1231 1375 * @ticket 40201 1376 * 1377 * @covers ::clean_blog_cache 1232 1378 */ 1233 1379 public function test_clean_blog_cache_bails_on_empty_input() { 1234 1380 $old_count = did_action( 'clean_site_cache' ); … … 1239 1385 1240 1386 /** 1241 1387 * @ticket 40201 1388 * 1389 * @covers ::clean_blog_cache 1242 1390 */ 1243 1391 public function test_clean_blog_cache_bails_on_non_numeric_input() { 1244 1392 $old_count = did_action( 'clean_site_cache' ); … … 1249 1397 1250 1398 /** 1251 1399 * @ticket 40201 1400 * 1401 * @covers ::clean_blog_cache 1252 1402 */ 1253 1403 public function test_clean_blog_cache_works_with_deleted_site() { 1254 1404 $site_id = 12345; … … 1262 1412 /** 1263 1413 * @ticket 40201 1264 1414 * @dataProvider data_get_site_caches 1415 * 1416 * @covers ::refresh_blog_details 1265 1417 */ 1266 1418 public function test_refresh_blog_details( $key, $group ) { 1267 1419 $site = get_site( self::$site_ids['make.wordpress.org/'] ); … … 1287 1439 1288 1440 /** 1289 1441 * @ticket 40201 1442 * 1443 * @covers ::refresh_blog_details 1290 1444 */ 1291 1445 public function test_refresh_blog_details_works_with_deleted_site() { 1292 1446 $site_id = 12345; … … 1299 1453 1300 1454 /** 1301 1455 * @ticket 40201 1456 * 1457 * @covers ::refresh_blog_details 1302 1458 */ 1303 1459 public function test_refresh_blog_details_uses_current_site_as_default() { 1304 1460 $site_id = get_current_blog_id(); … … 1323 1479 /** 1324 1480 * @ticket 40364 1325 1481 * @dataProvider data_wp_insert_site 1482 * 1483 * @covers ::wp_insert_site 1326 1484 */ 1327 1485 public function test_wp_insert_site( $site_data, $expected_data ) { 1328 1486 remove_action( 'wp_initialize_site', 'wp_initialize_site', 10 ); … … 1418 1576 1419 1577 /** 1420 1578 * @ticket 50324 1579 * 1580 * @covers ::wp_insert_site 1421 1581 */ 1422 1582 public function test_wp_insert_site_with_clean_site_cache() { 1423 1583 remove_action( 'wp_initialize_site', 'wp_initialize_site', 10 ); … … 1444 1604 1445 1605 /** 1446 1606 * @ticket 40364 1607 * 1608 * @covers ::wp_insert_site 1447 1609 */ 1448 1610 public function test_wp_insert_site_empty_domain() { 1449 1611 remove_action( 'wp_initialize_site', 'wp_initialize_site', 10 ); … … 1521 1683 1522 1684 /** 1523 1685 * @ticket 40364 1686 * 1687 * @covers ::wp_update_site 1524 1688 */ 1525 1689 public function test_wp_update_site_empty_domain() { 1526 1690 $site_id = self::factory()->blog->create(); … … 1533 1697 1534 1698 /** 1535 1699 * @ticket 40364 1700 * 1701 * @covers ::wp_update_site 1536 1702 */ 1537 1703 public function test_wp_update_site_invalid_id() { 1538 1704 $result = wp_update_site( 444444, array( 'domain' => 'example.com' ) ); … … 1543 1709 1544 1710 /** 1545 1711 * @ticket 40364 1712 * 1713 * @covers ::wp_update_site 1546 1714 */ 1547 1715 public function test_wp_update_site_cleans_cache() { 1548 1716 $site_id = self::factory()->blog->create(); … … 1561 1729 1562 1730 /** 1563 1731 * @ticket 40364 1732 * 1733 * @covers ::wp_delete_site 1564 1734 */ 1565 1735 public function test_wp_delete_site() { 1566 1736 $site_id = self::factory()->blog->create(); … … 1575 1745 1576 1746 /** 1577 1747 * @ticket 40364 1748 * 1749 * @covers ::wp_delete_site 1578 1750 */ 1579 1751 public function test_wp_delete_site_invalid_id() { 1580 1752 $result = wp_delete_site( 444444 ); … … 1585 1757 1586 1758 /** 1587 1759 * @ticket 41333 1760 * 1761 * @covers ::wp_delete_site 1588 1762 */ 1589 1763 public function test_wp_delete_site_validate_site_deletion_action() { 1590 1764 add_action( 'wp_validate_site_deletion', array( $this, 'action_wp_validate_site_deletion_prevent_deletion' ) ); … … 1600 1774 /** 1601 1775 * @ticket 40364 1602 1776 * @dataProvider data_wp_normalize_site_data 1777 * 1778 * @covers ::wp_normalize_site_data 1603 1779 */ 1604 1780 public function test_wp_normalize_site_data( $data, $expected ) { 1605 1781 $result = wp_normalize_site_data( $data ); … … 1679 1855 /** 1680 1856 * @ticket 40364 1681 1857 * @dataProvider data_wp_validate_site_data 1858 * 1859 * @covers ::wp_validate_site_data 1682 1860 */ 1683 1861 public function test_wp_validate_site_data( $data, $expected_errors ) { 1684 1862 $result = new WP_Error(); … … 1807 1985 1808 1986 /** 1809 1987 * @ticket 40364 1988 * 1989 * @covers ::get_site 1810 1990 */ 1811 1991 public function test_site_dates_are_gmt() { 1812 1992 $first_date = current_time( 'mysql', true ); … … 1836 2016 1837 2017 /** 1838 2018 * @ticket 40364 2019 * 2020 * @covers ::wp_delete_site 1839 2021 */ 1840 2022 public function test_wp_delete_site_cleans_cache() { 1841 2023 $site_id = self::factory()->blog->create(); … … 1849 2031 1850 2032 /** 1851 2033 * @ticket 40364 2034 * 2035 * @covers ::wp_update_site 1852 2036 */ 1853 2037 public function test_wp_update_site_cleans_old_cache_on_domain_change() { 1854 2038 $old_domain = 'old.wordpress.org'; … … 1904 2088 1905 2089 /** 1906 2090 * @ticket 40364 2091 * 2092 * @covers ::wp_update_site 1907 2093 */ 1908 2094 public function test_wp_update_site_cleans_old_cache_on_path_change() { 1909 2095 $old_path = '/foo/'; … … 1958 2144 /** 1959 2145 * @ticket 40364 1960 2146 * @dataProvider data_site_status_hook_triggers 2147 * 2148 * @covers ::wp_insert_site 2149 * @covers ::wp_update_site 1961 2150 */ 1962 2151 public function test_site_status_hook_triggers( $insert_site_data, $expected_insert_hooks, $update_site_data, $expected_update_hooks ) { 1963 2152 // First: Insert a site. … … 2122 2311 /** 2123 2312 * @ticket 41333 2124 2313 * @dataProvider data_wp_initialize_site 2314 * 2315 * @covers ::wp_initialize_site 2125 2316 */ 2126 2317 public function test_wp_initialize_site( $args, $expected_options, $expected_meta ) { 2127 2318 $result = wp_initialize_site( self::$uninitialized_site_id, $args ); … … 2203 2394 2204 2395 /** 2205 2396 * @ticket 41333 2397 * 2398 * @covers ::wp_initialize_site 2206 2399 */ 2207 2400 public function test_wp_initialize_site_user_roles() { 2208 2401 global $wpdb; … … 2231 2424 2232 2425 /** 2233 2426 * @ticket 41333 2427 * 2428 * @covers ::wp_initialize_site 2234 2429 */ 2235 2430 public function test_wp_initialize_site_user_is_admin() { 2236 2431 $result = wp_initialize_site( self::$uninitialized_site_id, array( 'user_id' => 1 ) ); … … 2249 2444 2250 2445 /** 2251 2446 * @ticket 41333 2447 * 2448 * @covers ::wp_initialize_site 2252 2449 */ 2253 2450 public function test_wp_initialize_site_args_filter() { 2254 2451 add_filter( 'wp_initialize_site_args', array( $this, 'filter_wp_initialize_site_args' ), 10, 3 ); … … 2274 2471 2275 2472 /** 2276 2473 * @ticket 41333 2474 * 2475 * @covers ::wp_initialize_site 2277 2476 */ 2278 2477 public function test_wp_initialize_site_empty_id() { 2279 2478 $result = wp_initialize_site( 0 ); … … 2283 2482 2284 2483 /** 2285 2484 * @ticket 41333 2485 * 2486 * @covers ::wp_initialize_site 2286 2487 */ 2287 2488 public function test_wp_initialize_site_invalid_id() { 2288 2489 $result = wp_initialize_site( 123 ); … … 2292 2493 2293 2494 /** 2294 2495 * @ticket 41333 2496 * 2497 * @covers ::wp_initialize_site 2295 2498 */ 2296 2499 public function test_wp_initialize_site_already_initialized() { 2297 2500 $result = wp_initialize_site( get_current_blog_id() ); … … 2301 2504 2302 2505 /** 2303 2506 * @ticket 41333 2507 * 2508 * @covers ::wp_uninitialize_site 2304 2509 */ 2305 2510 public function test_wp_uninitialize_site() { 2306 2511 $site_id = self::factory()->blog->create(); … … 2312 2517 2313 2518 /** 2314 2519 * @ticket 41333 2520 * 2521 * @covers ::wp_uninitialize_site 2315 2522 */ 2316 2523 public function test_wp_uninitialize_site_empty_id() { 2317 2524 $result = wp_uninitialize_site( 0 ); … … 2321 2528 2322 2529 /** 2323 2530 * @ticket 41333 2531 * 2532 * @covers ::wp_uninitialize_site 2324 2533 */ 2325 2534 public function test_wp_uninitialize_site_invalid_id() { 2326 2535 $result = wp_uninitialize_site( 123 ); … … 2330 2539 2331 2540 /** 2332 2541 * @ticket 41333 2542 * 2543 * @covers ::wp_uninitialize_site 2333 2544 */ 2334 2545 public function test_wp_uninitialize_site_already_uninitialized() { 2335 2546 $result = wp_uninitialize_site( self::$uninitialized_site_id ); … … 2339 2550 2340 2551 /** 2341 2552 * @ticket 41333 2553 * 2554 * @covers ::wp_is_site_initialized 2342 2555 */ 2343 2556 public function test_wp_is_site_initialized() { 2344 2557 $this->assertTrue( wp_is_site_initialized( get_current_blog_id() ) ); … … 2347 2560 2348 2561 /** 2349 2562 * @ticket 41333 2563 * 2564 * @covers ::wp_is_site_initialized 2350 2565 */ 2351 2566 public function test_wp_is_site_initialized_prefilter() { 2352 2567 add_filter( 'pre_wp_is_site_initialized', '__return_false' ); … … 2358 2573 2359 2574 /** 2360 2575 * @ticket 41333 2576 * 2577 * @covers ::wp_insert_site 2361 2578 */ 2362 2579 public function test_wp_insert_site_forwards_args_to_wp_initialize_site() { 2363 2580 $args = array( … … 2392 2609 2393 2610 /** 2394 2611 * @ticket 46125 2612 * 2613 * @covers ::wpmu_create_blog 2395 2614 */ 2396 2615 public function test_wpmu_create_blog_cache_cleanup_backward_compatible() { 2397 2616 add_action( 'populate_options', array( $this, 'populate_options_callback' ) ); … … 2424 2643 * @dataProvider data_wpmu_new_blog_action_backward_commpatible 2425 2644 * 2426 2645 * @ticket 46351 2646 * 2647 * @covers ::wpmu_create_blog 2427 2648 */ 2428 2649 public function test_wpmu_new_blog_action_backward_compatible( $meta, $expected_meta ) { 2429 2650 // We are testing deprecated hook. Register it to expected deprecated notices. … … 2439 2660 2440 2661 /** 2441 2662 * @ticket 42251 2663 * 2664 * @covers ::get_site 2442 2665 */ 2443 2666 public function test_get_site_not_found_cache() { 2444 2667 global $wpdb; … … 2453 2676 2454 2677 /** 2455 2678 * @ticket 42251 2679 * 2680 * @covers ::get_site 2456 2681 */ 2457 2682 public function test_get_site_not_found_cache_clear() { 2458 2683 $new_site_id = $this->_get_next_site_id(); -
tests/phpunit/tests/multisite/siteDetails.php
12 12 * @dataProvider data_allowed_options 13 13 * 14 14 * @ticket 40063 15 * 16 * @covers ::update_option 15 17 */ 16 18 public function test_update_allowed_option_deletes_site_details_cache( $allowed_option, $temporary_value ) { 17 19 $site = get_site(); … … 31 33 * @dataProvider data_allowed_options 32 34 * 33 35 * @ticket 40063 36 * 37 * @covers ::update_option 34 38 */ 35 39 public function test_update_allowed_option_deletes_blog_details_cache( $allowed_option, $temporary_value ) { 36 40 $blog_details = get_blog_details(); … … 50 54 * @dataProvider data_allowed_options 51 55 * 52 56 * @ticket 40063 57 * 58 * @covers ::update_option 53 59 */ 54 60 public function test_update_allowed_option_does_not_delete_site_cache( $allowed_option, $temporary_value ) { 55 61 $site = get_site(); … … 69 75 * @dataProvider data_allowed_options 70 76 * 71 77 * @ticket 40063 78 * 79 * @covers ::update_option 72 80 */ 73 81 public function test_update_allowed_option_does_not_delete_short_blog_details_cache( $allowed_option, $temporary_value ) { 74 82 $blog_details = get_blog_details( null, false ); … … 88 96 * @dataProvider data_allowed_options 89 97 * 90 98 * @ticket 40063 99 * 100 * @covers ::update_option 91 101 */ 92 102 public function test_update_allowed_option_does_not_update_sites_last_changed( $allowed_option, $temporary_value ) { 93 103 $last_changed = wp_cache_get_last_changed( 'sites' ); … … 114 124 115 125 /** 116 126 * @ticket 40063 127 * 128 * @covers ::update_option 117 129 */ 118 130 public function test_update_random_blog_option_does_not_delete_cache() { 119 131 $site = get_site(); … … 128 140 129 141 /** 130 142 * @ticket 40247 143 * 144 * @covers WP_Site::post_count 131 145 */ 132 146 public function test_site_details_cached_including_false_values() { 133 147 $id = self::factory()->blog->create(); … … 145 159 $this->assertNotFalse( $cached_details ); 146 160 } 147 161 162 /** 163 * @covers ::get_site 164 */ 148 165 public function test_site_details_filter_with_blogname() { 149 166 add_filter( 'site_details', array( $this, '_filter_site_details_blogname' ) ); 150 167 $site = get_site(); … … 161 178 162 179 /** 163 180 * @ticket 40458 181 * 182 * @covers ::get_site 164 183 */ 165 184 public function test_site_details_filter_with_custom_value_isetter() { 166 185 add_filter( 'site_details', array( $this, '_filter_site_details_custom_value' ) ); … … 173 192 174 193 /** 175 194 * @ticket 40458 195 * 196 * @covers ::get_site 176 197 */ 177 198 public function test_site_details_filter_with_custom_value_getter() { 178 199 add_filter( 'site_details', array( $this, '_filter_site_details_custom_value' ) ); -
tests/phpunit/tests/multisite/siteMeta.php
47 47 wp_update_network_site_counts(); 48 48 } 49 49 50 /** 51 * @covers ::is_site_meta_supported 52 */ 50 53 public function test_is_site_meta_supported() { 51 54 $this->assertTrue( is_site_meta_supported() ); 52 55 } 53 56 57 /** 58 * @covers ::is_site_meta_supported 59 */ 54 60 public function test_is_site_meta_supported_filtered() { 55 61 add_filter( 'pre_site_option_site_meta_supported', '__return_zero' ); 56 62 $this->assertFalse( is_site_meta_supported() ); 57 63 } 58 64 65 /** 66 * @covers ::add_site_meta 67 */ 59 68 public function test_add() { 60 69 if ( ! is_site_meta_supported() ) { 61 70 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 65 74 $this->assertSame( 'bar', get_site_meta( self::$site_id, 'foo', true ) ); 66 75 } 67 76 77 /** 78 * @covers ::add_site_meta 79 */ 68 80 public function test_add_unique() { 69 81 if ( ! is_site_meta_supported() ) { 70 82 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 74 86 $this->assertFalse( add_site_meta( self::$site_id, 'foo', 'bar', true ) ); 75 87 } 76 88 89 /** 90 * @covers ::delete_site_meta 91 */ 77 92 public function test_delete() { 78 93 if ( ! is_site_meta_supported() ) { 79 94 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 85 100 $this->assertEmpty( get_site_meta( self::$site_id, 'foo', true ) ); 86 101 } 87 102 103 /** 104 * @covers ::delete_site_meta 105 */ 88 106 public function test_delete_with_invalid_meta_key_should_return_false() { 89 107 if ( ! is_site_meta_supported() ) { 90 108 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 93 111 $this->assertFalse( delete_site_meta( self::$site_id, 'foo' ) ); 94 112 } 95 113 114 /** 115 * @covers ::delete_site_meta 116 */ 96 117 public function test_delete_should_respect_meta_value() { 97 118 if ( ! is_site_meta_supported() ) { 98 119 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 107 128 $this->assertSame( array( 'baz' ), $metas ); 108 129 } 109 130 131 /** 132 * @covers ::get_site_meta 133 */ 110 134 public function test_get_with_no_key_should_fetch_all_keys() { 111 135 if ( ! is_site_meta_supported() ) { 112 136 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 124 148 $this->assertSameSets( $expected, $found ); 125 149 } 126 150 151 /** 152 * @covers ::get_site_meta 153 */ 127 154 public function test_get_with_key_should_fetch_all_for_key() { 128 155 if ( ! is_site_meta_supported() ) { 129 156 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 139 166 $this->assertSameSets( $expected, $found ); 140 167 } 141 168 169 /** 170 * @covers ::get_site_meta 171 */ 142 172 public function test_get_should_respect_single_true() { 143 173 if ( ! is_site_meta_supported() ) { 144 174 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 151 181 $this->assertSame( 'bar', $found ); 152 182 } 153 183 184 /** 185 * @covers ::update_site_meta 186 */ 154 187 public function test_update_should_pass_to_add_when_no_value_exists_for_key() { 155 188 if ( ! is_site_meta_supported() ) { 156 189 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 164 197 $this->assertSame( 'bar', $meta ); 165 198 } 166 199 200 /** 201 * @covers ::update_site_meta 202 */ 167 203 public function test_update_should_return_true_when_updating_existing_value_for_key() { 168 204 if ( ! is_site_meta_supported() ) { 169 205 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 178 214 $this->assertSame( 'baz', $meta ); 179 215 } 180 216 217 /** 218 * @covers ::delete_site_meta_by_key 219 */ 181 220 public function test_delete_by_key() { 182 221 if ( ! is_site_meta_supported() ) { 183 222 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 195 234 $this->assertSame( '', get_site_meta( self::$site_id2, 'unique_delete_by_key', true ) ); 196 235 } 197 236 237 /** 238 * @covers ::wp_delete_site 239 */ 198 240 public function test_site_meta_should_be_deleted_when_site_is_deleted() { 199 241 if ( ! is_site_meta_supported() ) { 200 242 $this->markTestSkipped( 'Test only runs with the blogmeta database table installed.' ); … … 219 261 $this->assertSame( '', get_site_meta( $site_id, 'foo1', true ) ); 220 262 } 221 263 264 /** 265 * @covers ::update_sitemeta_cache 266 */ 222 267 public function test_update_site_meta_cache() { 223 268 global $wpdb; 224 269 … … 234 279 $this->assertSame( $num_queries, $wpdb->num_queries ); 235 280 } 236 281 282 /** 283 * @covers ::update_site_meta 284 */ 237 285 public function test_query_update_site_meta_cache_true() { 238 286 global $wpdb; 239 287 … … 255 303 $this->assertSame( $num_queries, $wpdb->num_queries ); 256 304 } 257 305 306 /** 307 * @covers ::update_site_meta 308 */ 258 309 public function test_query_update_site_meta_cache_false() { 259 310 global $wpdb; 260 311 … … 278 329 279 330 /** 280 331 * @ticket 40229 332 * 333 * @covers ::add_site_meta 281 334 */ 282 335 public function test_add_site_meta_should_bust_get_sites_cache() { 283 336 if ( ! is_site_meta_supported() ) { … … 320 373 321 374 /** 322 375 * @ticket 40229 376 * 377 * @covers ::update_site_meta 323 378 */ 324 379 public function test_update_site_meta_should_bust_get_sites_cache() { 325 380 if ( ! is_site_meta_supported() ) { … … 363 418 364 419 /** 365 420 * @ticket 40229 421 * 422 * @covers ::delete_site_meta 366 423 */ 367 424 public function test_delete_site_meta_should_bust_get_sites_cache() { 368 425 if ( ! is_site_meta_supported() ) { -
tests/phpunit/tests/multisite/siteQuery.php
114 114 wp_update_network_site_counts(); 115 115 } 116 116 117 /** 118 * @covers WP_Site_Query::query 119 */ 117 120 public function test_wp_site_query_by_ID() { 118 121 $q = new WP_Site_Query(); 119 122 $found = $q->query( … … 126 129 $this->assertSameSets( array( self::$site_ids['www.w.org/'] ), $found ); 127 130 } 128 131 132 /** 133 * @covers WP_Site_Query::query 134 */ 129 135 public function test_wp_site_query_by_number() { 130 136 $q = new WP_Site_Query(); 131 137 $found = $q->query( … … 138 144 $this->assertSame( 3, count( $found ) ); 139 145 } 140 146 147 /** 148 * @covers WP_Site_Query::query 149 */ 141 150 public function test_wp_site_query_by_site__in_with_single_id() { 142 151 $expected = array( self::$site_ids['wordpress.org/foo/'] ); 143 152 … … 152 161 $this->assertSameSets( $expected, $found ); 153 162 } 154 163 164 /** 165 * @covers WP_Site_Query::query 166 */ 155 167 public function test_wp_site_query_by_site__in_with_multiple_ids() { 156 168 $expected = array( self::$site_ids['wordpress.org/'], self::$site_ids['wordpress.org/foo/'] ); 157 169 … … 168 180 169 181 /** 170 182 * Test the `count` query var 183 * 184 * @covers WP_Site_Query::query 171 185 */ 172 186 public function test_wp_site_query_by_site__in_and_count_with_multiple_ids() { 173 187 $expected = array( self::$site_ids['wordpress.org/'], self::$site_ids['wordpress.org/foo/'] ); … … 184 198 $this->assertSame( 2, $found ); 185 199 } 186 200 201 /** 202 * @covers WP_Site_Query::query 203 */ 187 204 public function test_wp_site_query_by_site__not_in_with_single_id() { 188 205 $excluded = array( self::$site_ids['wordpress.org/foo/'] ); 189 206 $expected = array_diff( self::$site_ids, $excluded ); … … 202 219 $this->assertSameSets( $expected, $found ); 203 220 } 204 221 222 /** 223 * @covers WP_Site_Query::query 224 */ 205 225 public function test_wp_site_query_by_site__not_in_with_multiple_ids() { 206 226 $excluded = array( self::$site_ids['wordpress.org/'], self::$site_ids['wordpress.org/foo/'] ); 207 227 $expected = array_diff( self::$site_ids, $excluded ); … … 220 240 $this->assertSameSets( $expected, $found ); 221 241 } 222 242 243 /** 244 * @covers WP_Site_Query::query 245 */ 223 246 public function test_wp_site_query_by_network_id_with_order() { 224 247 $q = new WP_Site_Query(); 225 248 $found = $q->query( … … 251 274 $this->assertSame( array_reverse( $expected ), $found ); 252 275 } 253 276 277 /** 278 * @covers WP_Site_Query::query 279 */ 254 280 public function test_wp_site_query_by_network_id_with_existing_sites() { 255 281 $q = new WP_Site_Query(); 256 282 $found = $q->query( … … 268 294 $this->assertSameSets( $expected, $found ); 269 295 } 270 296 297 /** 298 * @covers WP_Site_Query::query 299 */ 271 300 public function test_wp_site_query_by_network_id_with_no_existing_sites() { 272 301 $q = new WP_Site_Query(); 273 302 $found = $q->query( … … 280 309 $this->assertEmpty( $found ); 281 310 } 282 311 312 /** 313 * @covers WP_Site_Query::query 314 */ 283 315 public function test_wp_site_query_by_domain() { 284 316 $q = new WP_Site_Query(); 285 317 $found = $q->query( … … 299 331 $this->assertSameSets( $expected, $found ); 300 332 } 301 333 334 /** 335 * @covers WP_Site_Query::query 336 */ 302 337 public function test_wp_site_query_by_domain_and_offset() { 303 338 $q = new WP_Site_Query(); 304 339 $found = $q->query( … … 318 353 $this->assertSameSets( $expected, $found ); 319 354 } 320 355 356 /** 357 * @covers WP_Site_Query::query 358 */ 321 359 public function test_wp_site_query_by_domain_and_number_and_offset() { 322 360 $q = new WP_Site_Query(); 323 361 $found = $q->query( … … 337 375 $this->assertSameSets( $expected, $found ); 338 376 } 339 377 378 /** 379 * @covers WP_Site_Query::query 380 */ 340 381 public function test_wp_site_query_by_domain__in_with_single_domain() { 341 382 $q = new WP_Site_Query(); 342 383 $found = $q->query( … … 354 395 $this->assertSameSets( $expected, $found ); 355 396 } 356 397 398 /** 399 * @covers WP_Site_Query::query 400 */ 357 401 public function test_wp_site_query_by_domain__in_with_multiple_domains() { 358 402 $q = new WP_Site_Query(); 359 403 $found = $q->query( … … 374 418 $this->assertSameSets( $expected, $found ); 375 419 } 376 420 421 /** 422 * @covers WP_Site_Query::query 423 */ 377 424 public function test_wp_site_query_by_domain__not_in_with_single_domain() { 378 425 $q = new WP_Site_Query(); 379 426 $found = $q->query( … … 395 442 $this->assertSameSets( $expected, $found ); 396 443 } 397 444 445 /** 446 * @covers WP_Site_Query::query 447 */ 398 448 public function test_wp_site_query_by_domain__not_in_with_multiple_domains() { 399 449 $q = new WP_Site_Query(); 400 450 $found = $q->query( … … 413 463 $this->assertSameSets( $expected, $found ); 414 464 } 415 465 466 /** 467 * @covers WP_Site_Query::query 468 */ 416 469 public function test_wp_site_query_by_path_with_expected_results() { 417 470 $q = new WP_Site_Query(); 418 471 $found = $q->query( … … 430 483 $this->assertSameSets( $expected, $found ); 431 484 } 432 485 486 /** 487 * @covers WP_Site_Query::query 488 */ 433 489 public function test_wp_site_query_by_path_with_no_expected_results() { 434 490 $q = new WP_Site_Query(); 435 491 $found = $q->query( … … 442 498 $this->assertEmpty( $found ); 443 499 } 444 500 445 // archived, mature, spam, deleted, public. 446 501 /** 502 * archived, mature, spam, deleted, public. 503 * 504 * @covers WP_Site_Query::query 505 */ 447 506 public function test_wp_site_query_by_archived() { 448 507 $q = new WP_Site_Query(); 449 508 $found = $q->query( … … 458 517 $this->assertSameSets( array_values( self::$site_ids ), $found ); 459 518 } 460 519 520 /** 521 * @covers WP_Site_Query::query 522 */ 461 523 public function test_wp_site_query_by_mature() { 462 524 $q = new WP_Site_Query(); 463 525 $found = $q->query( … … 472 534 $this->assertSameSets( array_values( self::$site_ids ), $found ); 473 535 } 474 536 537 /** 538 * @covers WP_Site_Query::query 539 */ 475 540 public function test_wp_site_query_by_spam() { 476 541 $q = new WP_Site_Query(); 477 542 $found = $q->query( … … 486 551 $this->assertSameSets( array_values( self::$site_ids ), $found ); 487 552 } 488 553 554 /** 555 * @covers WP_Site_Query::query 556 */ 489 557 public function test_wp_site_query_by_deleted() { 490 558 $q = new WP_Site_Query(); 491 559 $found = $q->query( … … 500 568 $this->assertSameSets( array_values( self::$site_ids ), $found ); 501 569 } 502 570 571 /** 572 * @covers WP_Site_Query::query 573 */ 503 574 public function test_wp_site_query_by_deleted_with_no_results() { 504 575 $q = new WP_Site_Query(); 505 576 $found = $q->query( … … 512 583 $this->assertEmpty( $found ); 513 584 } 514 585 586 /** 587 * @covers WP_Site_Query::query 588 */ 515 589 public function test_wp_site_query_by_public() { 516 590 $q = new WP_Site_Query(); 517 591 $found = $q->query( … … 526 600 $this->assertSameSets( array_values( self::$site_ids ), $found ); 527 601 } 528 602 603 /** 604 * @covers WP_Site_Query::query 605 */ 529 606 public function test_wp_site_query_by_lang_id_with_zero() { 530 607 $q = new WP_Site_Query(); 531 608 $found = $q->query( … … 540 617 $this->assertSameSets( array_diff( array_values( self::$site_ids ), array( self::$site_ids['www.w.org/make/'] ) ), $found ); 541 618 } 542 619 620 /** 621 * @covers WP_Site_Query::query 622 */ 543 623 public function test_wp_site_query_by_lang_id() { 544 624 $q = new WP_Site_Query(); 545 625 $found = $q->query( … … 556 636 $this->assertSameSets( $expected, $found ); 557 637 } 558 638 639 /** 640 * @covers WP_Site_Query::query 641 */ 559 642 public function test_wp_site_query_by_lang_id_with_no_results() { 560 643 $q = new WP_Site_Query(); 561 644 $found = $q->query( … … 568 651 $this->assertEmpty( $found ); 569 652 } 570 653 654 /** 655 * @covers WP_Site_Query::query 656 */ 571 657 public function test_wp_site_query_by_lang__in() { 572 658 $q = new WP_Site_Query(); 573 659 $found = $q->query( … … 584 670 $this->assertSameSets( $expected, $found ); 585 671 } 586 672 673 /** 674 * @covers WP_Site_Query::query 675 */ 587 676 public function test_wp_site_query_by_lang__in_with_multiple_ids() { 588 677 $q = new WP_Site_Query(); 589 678 $found = $q->query( … … 598 687 $this->assertSameSets( array_values( self::$site_ids ), $found ); 599 688 } 600 689 690 /** 691 * @covers WP_Site_Query::query 692 */ 601 693 public function test_wp_site_query_by_lang__not_in() { 602 694 $q = new WP_Site_Query(); 603 695 $found = $q->query( … … 614 706 $this->assertSameSets( $expected, $found ); 615 707 } 616 708 709 /** 710 * @covers WP_Site_Query::query 711 */ 617 712 public function test_wp_site_query_by_lang__not_in_with_multiple_ids() { 618 713 $q = new WP_Site_Query(); 619 714 $found = $q->query( … … 626 721 $this->assertEmpty( $found ); 627 722 } 628 723 724 /** 725 * @covers WP_Site_Query::query 726 */ 629 727 public function test_wp_site_query_by_search_with_text_in_domain() { 630 728 $q = new WP_Site_Query(); 631 729 $found = $q->query( … … 643 741 $this->assertSameSets( $expected, $found ); 644 742 } 645 743 744 /** 745 * @covers WP_Site_Query::query 746 */ 646 747 public function test_wp_site_query_by_search_with_text_in_path() { 647 748 $q = new WP_Site_Query(); 648 749 $found = $q->query( … … 663 764 $this->assertSameSets( $expected, $found ); 664 765 } 665 766 767 /** 768 * @covers WP_Site_Query::query 769 */ 666 770 public function test_wp_site_query_by_search_with_text_in_path_and_domain() { 667 771 $q = new WP_Site_Query(); 668 772 $found = $q->query( … … 681 785 $this->assertSameSets( $expected, $found ); 682 786 } 683 787 788 /** 789 * @covers WP_Site_Query::query 790 */ 684 791 public function test_wp_site_query_by_search_with_text_in_path_and_domain_order_by_domain_desc() { 685 792 $q = new WP_Site_Query(); 686 793 $found = $q->query( … … 701 808 $this->assertSame( $expected, $found ); 702 809 } 703 810 811 /** 812 * @covers WP_Site_Query::query 813 */ 704 814 public function test_wp_site_query_by_search_with_text_in_path_exclude_domain_from_search() { 705 815 $q = new WP_Site_Query(); 706 816 $found = $q->query( … … 718 828 $this->assertSame( $expected, $found ); 719 829 } 720 830 831 /** 832 * @covers WP_Site_Query::query 833 */ 721 834 public function test_wp_site_query_by_search_with_text_in_domain_exclude_path_from_search() { 722 835 $q = new WP_Site_Query(); 723 836 $found = $q->query( … … 736 849 $this->assertSame( $expected, $found ); 737 850 } 738 851 852 /** 853 * @covers WP_Site_Query::query 854 */ 739 855 public function test_wp_site_query_by_search_with_wildcard_in_text() { 740 856 $q = new WP_Site_Query(); 741 857 $found = $q->query( … … 754 870 $this->assertSameSets( $expected, $found ); 755 871 } 756 872 873 /** 874 * @covers WP_Site_Query::query 875 */ 757 876 public function test_wp_site_query_by_search_with_wildcard_in_text_exclude_path_from_search() { 758 877 $q = new WP_Site_Query(); 759 878 $found = $q->query( … … 772 891 $this->assertSameSets( $expected, $found ); 773 892 } 774 893 894 /** 895 * @covers WP_Site_Query::query 896 */ 775 897 public function test_wp_site_query_by_search_with_wildcard_in_text_exclude_domain_from_search() { 776 898 $q = new WP_Site_Query(); 777 899 $found = $q->query( … … 791 913 792 914 /** 793 915 * @ticket 41197 916 * 917 * @covers WP_Site_Query::query 794 918 */ 795 919 public function test_wp_site_query_cache_with_different_fields_no_count() { 796 920 global $wpdb; … … 819 943 820 944 /** 821 945 * @ticket 41197 946 * 947 * @covers WP_Site_Query::query 822 948 */ 823 949 public function test_wp_site_query_cache_with_different_fields_active_count() { 824 950 global $wpdb; … … 849 975 850 976 /** 851 977 * @ticket 41197 978 * 979 * @covers WP_Site_Query::query 852 980 */ 853 981 public function test_wp_site_query_cache_with_same_fields_different_count() { 854 982 global $wpdb; … … 880 1008 /** 881 1009 * @ticket 40229 882 1010 * @dataProvider data_wp_site_query_meta_query 1011 * 1012 * @covers WP_Site_Query::query 883 1013 */ 884 1014 public function test_wp_site_query_meta_query( $query, $expected, $strict ) { 885 1015 if ( ! is_site_meta_supported() ) { … … 1067 1197 /** 1068 1198 * @ticket 45749 1069 1199 * @ticket 47599 1200 * 1201 * @covers WP_Site_Query::query 1070 1202 */ 1071 1203 public function test_sites_pre_query_filter_should_bypass_database_query() { 1072 1204 global $wpdb; … … 1098 1230 1099 1231 /** 1100 1232 * @ticket 51333 1233 * 1234 * @covers WP_Site_Query::query 1101 1235 */ 1102 1236 public function test_sites_pre_query_filter_should_set_sites_property() { 1103 1237 add_filter( 'sites_pre_query', array( __CLASS__, 'filter_sites_pre_query_and_set_sites' ), 10, 2 ); -
tests/phpunit/tests/multisite/updateBlogDetails.php
10 10 /** 11 11 * If `update_blog_details()` is called with any kind of empty arguments, it 12 12 * should return false. 13 * 14 * @covers ::update_blog_details 13 15 */ 14 16 function test_update_blog_details_with_empty_args() { 15 17 $result = update_blog_details( 1, array() ); … … 18 20 19 21 /** 20 22 * If the ID passed is not that of a current site, we should expect false. 23 * 24 * @covers ::update_blog_details 21 25 */ 22 26 function test_update_blog_details_invalid_blog_id() { 23 27 $result = update_blog_details( 999, array( 'domain' => 'example.com' ) ); … … 24 28 $this->assertFalse( $result ); 25 29 } 26 30 31 /** 32 * @covers ::update_blog_details 33 */ 27 34 function test_update_blog_details() { 28 35 $blog_id = self::factory()->blog->create(); 29 36 … … 54 61 * @param string $action The hook expected to fire for the flag name and flag combination. 55 62 * 56 63 * @dataProvider data_flag_hooks 64 * 65 * @covers ::update_blog_details 57 66 */ 58 67 public function test_update_blog_details_flag_action( $flag, $flag_value, $hook ) { 59 68 global $test_action_counter; … … 111 120 * should have a leading and trailing slash. 112 121 * 113 122 * @dataProvider data_single_directory_path 123 * 124 * @covers ::update_blog_details 114 125 */ 115 126 public function test_update_blog_details_single_directory_path( $path, $expected ) { 116 127 update_blog_details( 1, array( 'path' => $path ) ); -
tests/phpunit/tests/multisite/uploadIsUserOverQuota.php
27 27 parent::tearDown(); 28 28 } 29 29 30 /** 31 * @covers ::upload_is_user_over_quota 32 */ 30 33 public function test_upload_is_user_over_quota_allowed_0_used_5() { 31 34 add_filter( 'get_space_allowed', '__return_zero' ); 32 35 add_filter( 'pre_get_space_used', array( $this, '_filter_space_5' ) ); … … 37 40 $this->assertTrue( $result ); 38 41 } 39 42 43 /** 44 * @covers ::upload_is_user_over_quota 45 */ 40 46 public function test_upload_is_user_over_quota_allowed_0_used_0() { 41 47 add_filter( 'get_space_allowed', '__return_zero' ); 42 48 add_filter( 'pre_get_space_used', '__return_zero' ); … … 47 53 $this->assertFalse( $result ); 48 54 } 49 55 56 /** 57 * @covers ::upload_is_user_over_quota 58 */ 50 59 public function test_upload_is_user_over_quota_allowed_0_used_100() { 51 60 add_filter( 'get_space_allowed', '__return_zero' ); 52 61 add_filter( 'pre_get_space_used', array( $this, '_filter_space_100' ) ); … … 57 66 $this->assertTrue( $result ); 58 67 } 59 68 69 /** 70 * @covers ::upload_is_user_over_quota 71 */ 60 72 public function test_upload_is_user_over_quota_allowed_100_used_0() { 61 73 add_filter( 'get_space_allowed', array( $this, '_filter_space_100' ) ); 62 74 add_filter( 'pre_get_space_used', '__return_zero' ); … … 67 79 $this->assertFalse( $result ); 68 80 } 69 81 82 /** 83 * @covers ::upload_is_user_over_quota 84 */ 70 85 public function test_upload_is_user_over_quota_allowed_100_used_100() { 71 86 add_filter( 'get_space_allowed', array( $this, '_filter_space_100' ) ); 72 87 add_filter( 'pre_get_space_used', array( $this, '_filter_space_100' ) ); … … 77 92 $this->assertFalse( $result ); 78 93 } 79 94 95 /** 96 * @covers ::upload_is_user_over_quota 97 */ 80 98 public function test_upload_is_user_over_quota_allowed_100_used_200() { 81 99 add_filter( 'get_space_allowed', array( $this, '_filter_space_100' ) ); 82 100 add_filter( 'pre_get_space_used', array( $this, '_filter_space_200' ) ); … … 87 105 $this->assertTrue( $result ); 88 106 } 89 107 108 /** 109 * @covers ::upload_is_user_over_quota 110 */ 90 111 public function test_upload_is_user_over_quota_allowed_negative_used_100() { 91 112 add_filter( 'get_space_allowed', array( $this, '_filter_space_negative' ) ); 92 113 add_filter( 'pre_get_space_used', array( $this, '_filter_space_100' ) ); … … 100 121 /** 101 122 * When the upload space check is disabled, using more than the available 102 123 * quota is allowed. 124 * 125 * @covers ::upload_is_user_over_quota 103 126 */ 104 127 public function test_upload_is_user_over_check_disabled() { 105 128 update_site_option( 'upload_space_check_disabled', true ); -
tests/phpunit/tests/multisite/wpGetSites.php
51 51 52 52 /** 53 53 * @expectedDeprecated wp_get_sites 54 * 55 * @covers ::wp_get_sites 54 56 */ 55 57 public function test_wp_get_sites_site_is_expected_array() { 56 58 … … 82 84 * @param $expected 83 85 * @param $args 84 86 * @param $error 87 * 88 * @covers ::wp_get_sites 85 89 */ 86 90 public function test_wp_get_sites( $expected, $args, $error ) { 87 91 $this->assertCount( $expected, wp_get_sites( $args ), $error ); -
tests/phpunit/tests/multisite/wpInstallDefaults.php
30 30 31 31 /** 32 32 * @ticket 40036 33 * 34 * @covers ::get_page_by_path 35 * @covers ::get_comments 33 36 */ 34 37 public function test_empty_option_should_fall_back_to_default() { 35 38 /* … … 56 59 57 60 /** 58 61 * @ticket 40036 62 * 63 * @covers ::get_page_by_path 64 * @covers ::get_comments 59 65 */ 60 66 public function test_non_default_option_values() { 61 67 /* -
tests/phpunit/tests/multisite/wpMSSitesListTable.php
87 87 } 88 88 } 89 89 90 /** 91 * @covers WP_MS_Sites_List_Table::prepare_items 92 * @covers WP_MS_Sites_List_Table::items 93 */ 90 94 public function test_ms_sites_list_table_default_items() { 91 95 $this->table->prepare_items(); 92 96 … … 96 100 $this->assertSameSets( array( 1 ) + self::$site_ids, $items ); 97 101 } 98 102 103 /** 104 * @covers WP_MS_Sites_List_Table::prepare_items 105 * @covers WP_MS_Sites_List_Table::items 106 */ 99 107 public function test_ms_sites_list_table_subdirectory_path_search_items() { 100 108 if ( is_subdomain_install() ) { 101 109 $this->markTestSkipped( 'Path search is not available for subdomain configurations.' ); … … 122 130 $this->assertSameSets( $expected, $items ); 123 131 } 124 132 133 /** 134 * @covers WP_MS_Sites_List_Table::prepare_items 135 * @covers WP_MS_Sites_List_Table::items 136 */ 125 137 public function test_ms_sites_list_table_subdirectory_multiple_path_search_items() { 126 138 if ( is_subdomain_install() ) { 127 139 $this->markTestSkipped( 'Path search is not available for subdomain configurations.' ); … … 144 156 $this->assertSameSets( $expected, $items ); 145 157 } 146 158 159 /** 160 * @covers WP_MS_Sites_List_Table::prepare_items 161 * @covers WP_MS_Sites_List_Table::items 162 */ 147 163 public function test_ms_sites_list_table_invalid_path_search_items() { 148 164 $_REQUEST['s'] = 'foobar'; 149 165 … … 157 173 $this->assertEmpty( $items ); 158 174 } 159 175 176 /** 177 * @covers WP_MS_Sites_List_Table::prepare_items 178 * @covers WP_MS_Sites_List_Table::items 179 */ 160 180 public function test_ms_sites_list_table_subdomain_domain_search_items() { 161 181 if ( ! is_subdomain_install() ) { 162 182 $this->markTestSkipped( 'Domain search is not available for subdirectory configurations.' ); … … 181 201 $this->assertSameSets( $expected, $items ); 182 202 } 183 203 204 /** 205 * @covers WP_MS_Sites_List_Table::prepare_items 206 * @covers WP_MS_Sites_List_Table::items 207 */ 184 208 public function test_ms_sites_list_table_subdomain_domain_search_items_with_trailing_wildcard() { 185 209 if ( ! is_subdomain_install() ) { 186 210 $this->markTestSkipped( 'Domain search is not available for subdirectory configurations.' ); … … 205 229 $this->assertSameSets( $expected, $items ); 206 230 } 207 231 232 /** 233 * @covers WP_MS_Sites_List_Table::prepare_items 234 * @covers WP_MS_Sites_List_Table::items 235 */ 208 236 public function test_ms_sites_list_table_subdirectory_path_search_items_with_trailing_wildcard() { 209 237 if ( is_subdomain_install() ) { 210 238 $this->markTestSkipped( 'Path search is not available for subdomain configurations.' ); -
tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php
52 52 53 53 /** 54 54 * @dataProvider data_validate_blogname 55 * 56 * @covers ::wpmu_validate_blog_signup 55 57 */ 56 58 public function test_validate_blogname( $blog_name, $error_message ) { 57 59 $result = wpmu_validate_blog_signup( $blog_name, 'Foo Site Title', get_userdata( self::$super_admin_id ) ); … … 81 83 return $data; 82 84 } 83 85 86 /** 87 * @covers ::wpmu_validate_blog_signup 88 */ 84 89 public function test_validate_empty_blog_title() { 85 90 $result = wpmu_validate_blog_signup( 'uniqueblogname1234', '', get_userdata( self::$super_admin_id ) ); 86 91 $this->assertContains( 'blog_title', $result['errors']->get_error_codes(), 'Site titles must not be empty.' ); 87 92 } 88 93 94 /** 95 * @covers ::wpmu_validate_blog_signup 96 */ 89 97 public function test_validate_blogname_from_same_existing_user() { 90 98 $result = wpmu_validate_blog_signup( self::$existing_user_login, 'Foo Site Title', get_userdata( self::$existing_user_id ) ); 91 99 $this->assertEmpty( $result['errors']->get_error_codes() ); … … 95 103 * @ticket 39676 96 104 * 97 105 * @dataProvider data_filter_minimum_site_name_length 106 * 107 * @covers ::wpmu_validate_blog_signup 98 108 */ 99 109 public function test_filter_minimum_site_name_length( $site_name, $minimum_length, $expect_error ) { 100 110 $this->minimum_site_name_length = $minimum_length; … … 129 139 130 140 /** 131 141 * @ticket 43667 142 * 143 * @covers ::wpmu_validate_blog_signup 132 144 */ 133 145 public function test_signup_nonce_check() { 134 146 $original_php_self = $_SERVER['PHP_SELF']; … … 144 156 145 157 /** 146 158 * @ticket 43667 159 * 160 * @covers ::wpmu_validate_blog_signup 147 161 */ 148 162 public function test_signup_nonce_check_invalid() { 149 163 $original_php_self = $_SERVER['PHP_SELF']; -
tests/phpunit/tests/multisite/wpmuValidateUserSignup.php
30 30 ); 31 31 } 32 32 33 /** 34 * @covers ::wpmu_validate_user_signup 35 */ 33 36 public function test_should_fail_for_illegal_names() { 34 37 $illegal = array( 'foo123', 'bar123' ); 35 38 update_site_option( 'illegal_names', $illegal ); … … 40 43 } 41 44 } 42 45 46 /** 47 * @covers ::wpmu_validate_user_signup 48 */ 43 49 public function test_should_fail_for_unsafe_email_address() { 44 50 add_filter( 'is_email_address_unsafe', '__return_true' ); 45 51 $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' ); … … 47 53 remove_filter( 'is_email_address_unsafe', '__return_true' ); 48 54 } 49 55 56 /** 57 * @covers ::wpmu_validate_user_signup 58 */ 50 59 public function test_should_fail_for_invalid_email_address() { 51 60 add_filter( 'is_email', '__return_false' ); 52 61 $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' ); … … 54 63 remove_filter( 'is_email', '__return_false' ); 55 64 } 56 65 66 /** 67 * @covers ::wpmu_validate_user_signup 68 */ 57 69 public function test_should_fail_for_emails_from_disallowed_domains() { 58 70 $domains = array( 'foo.com', 'bar.org' ); 59 71 update_site_option( 'limited_email_domains', $domains ); … … 62 74 $this->assertContains( 'user_email', $v['errors']->get_error_codes() ); 63 75 } 64 76 77 /** 78 * @covers ::wpmu_validate_user_signup 79 */ 65 80 public function test_should_not_fail_for_emails_from_allowed_domains_with_mixed_case() { 66 81 $domains = array( 'foo.com', 'bar.org' ); 67 82 update_site_option( 'limited_email_domains', $domains ); … … 70 85 $this->assertNotContains( 'user_email', $v['errors']->get_error_codes() ); 71 86 } 72 87 88 /** 89 * @covers ::wpmu_validate_user_signup 90 */ 73 91 public function test_should_fail_for_existing_user_name() { 74 92 $u = self::factory()->user->create( array( 'user_login' => 'foo123' ) ); 75 93 $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' ); … … 76 94 $this->assertContains( 'user_name', $v['errors']->get_error_codes() ); 77 95 } 78 96 97 /** 98 * @covers ::wpmu_validate_user_signup 99 */ 79 100 public function test_should_fail_for_existing_user_email() { 80 101 $u = self::factory()->user->create( array( 'user_email' => 'foo@example.com' ) ); 81 102 $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' ); … … 82 103 $this->assertContains( 'user_email', $v['errors']->get_error_codes() ); 83 104 } 84 105 106 /** 107 * @covers ::wpmu_validate_user_signup 108 */ 85 109 public function test_should_fail_for_existing_signup_with_same_username() { 86 110 // Don't send notifications. 87 111 add_filter( 'wpmu_signup_user_notification', '__return_false' ); … … 92 116 $this->assertContains( 'user_name', $v['errors']->get_error_codes() ); 93 117 } 94 118 119 /** 120 * @covers ::wpmu_validate_user_signup 121 */ 95 122 public function test_should_not_fail_for_existing_signup_with_same_username_if_signup_is_old() { 96 123 // Don't send notifications. 97 124 add_filter( 'wpmu_signup_user_notification', '__return_false' ); … … 106 133 $this->assertNotContains( 'user_name', $v['errors']->get_error_codes() ); 107 134 } 108 135 136 /** 137 * @covers ::wpmu_validate_user_signup 138 */ 109 139 public function test_should_fail_for_existing_signup_with_same_email() { 110 140 // Don't send notifications. 111 141 add_filter( 'wpmu_signup_user_notification', '__return_false' ); … … 116 146 $this->assertContains( 'user_email', $v['errors']->get_error_codes() ); 117 147 } 118 148 149 /** 150 * @covers ::wpmu_validate_user_signup 151 */ 119 152 public function test_should_not_fail_for_existing_signup_with_same_email_if_signup_is_old() { 120 153 // Don't send notifications. 121 154 add_filter( 'wpmu_signup_user_notification', '__return_false' ); … … 132 165 133 166 /** 134 167 * @ticket 43232 168 * 169 * @covers ::wpmu_validate_user_signup 135 170 */ 136 171 public function test_should_not_fail_for_data_used_by_a_deleted_user() { 137 172 global $wpdb; … … 161 196 $this->assertContains( 'user_email', $valid['errors']->get_error_codes() ); 162 197 } 163 198 199 /** 200 * @covers ::wpmu_validate_user_signup 201 */ 164 202 public function test_invalid_email_address_with_banned_domains_results_in_error() { 165 203 update_site_option( 'banned_email_domains', 'bar.com' ); 166 204 $valid = wpmu_validate_user_signup( 'validusername', 'invalid-email' ); … … 169 207 $this->assertContains( 'user_email', $valid['errors']->get_error_codes() ); 170 208 } 171 209 210 /** 211 * @covers ::wpmu_validate_user_signup 212 */ 172 213 public function test_incomplete_email_address_with_no_banned_domains_results_in_error() { 173 214 $valid = wpmu_validate_user_signup( 'validusername', 'incomplete@email' ); 174 215 … … 175 216 $this->assertContains( 'user_email', $valid['errors']->get_error_codes() ); 176 217 } 177 218 219 /** 220 * @covers ::wpmu_validate_user_signup 221 */ 178 222 public function test_valid_email_address_matching_banned_domain_results_in_error() { 179 223 update_site_option( 'banned_email_domains', 'bar.com' ); 180 224 $valid = wpmu_validate_user_signup( 'validusername', 'email@bar.com' ); … … 183 227 $this->assertContains( 'user_email', $valid['errors']->get_error_codes() ); 184 228 } 185 229 230 /** 231 * @covers ::wpmu_validate_user_signup 232 */ 186 233 public function test_valid_email_address_not_matching_banned_domain_returns_in_success() { 187 234 update_site_option( 'banned_email_domains', 'bar.com' ); 188 235 $valid = wpmu_validate_user_signup( 'validusername', 'email@example.com' ); … … 193 240 194 241 /** 195 242 * @ticket 43667 243 * 244 * @covers ::wpmu_validate_user_signup 196 245 */ 197 246 public function test_signup_nonce_check() { 198 247 $original_php_self = $_SERVER['PHP_SELF']; … … 208 257 209 258 /** 210 259 * @ticket 43667 260 * 261 * @covers ::wpmu_validate_user_signup 211 262 */ 212 263 public function test_signup_nonce_check_invalid() { 213 264 $original_php_self = $_SERVER['PHP_SELF'];