Ticket #39265: L_folders.patch
File L_folders.patch, 20.2 KB (added by , 4 years ago) |
---|
-
tests/phpunit/tests/link/adminUrl.php
2 2 3 3 /** 4 4 * @group link 5 * 6 * @covers ::self_admin_url 5 7 */ 6 8 class Tests_Link_Admin extends WP_UnitTestCase { 7 9 8 10 /** 9 11 * @ticket 37446 12 * 13 * @covers ::self_admin_url 10 14 */ 11 15 public function test_self_admin_url() { 12 16 $this->assertSame( admin_url(), self_admin_url() ); … … 14 18 15 19 /** 16 20 * @ticket 37446 21 * 22 * @covers ::self_admin_url 17 23 */ 18 24 public function test_self_admin_url_with_path() { 19 25 $path = 'options-general.php'; … … 23 29 24 30 /** 25 31 * @ticket 37446 32 * 33 * @covers ::self_admin_url 26 34 */ 27 35 public function test_self_admin_url_with_path_and_scheme() { 28 36 $path = 'options-general.php'; … … 33 41 34 42 /** 35 43 * @ticket 37446 44 * 45 * @covers ::self_admin_url 36 46 */ 37 47 public function test_self_admin_url_filtered() { 38 48 $path = 'options-general.php'; -
tests/phpunit/tests/link/getAdjacentPost.php
1 1 <?php 2 2 /** 3 3 * @group link 4 * 4 5 * @covers ::get_adjacent_post 5 6 */ 6 7 class Tests_Link_GetAdjacentPost extends WP_UnitTestCase { … … 8 9 9 10 /** 10 11 * @ticket 17807 12 * 13 * @covers ::get_adjacent_post 11 14 */ 12 15 public function test_get_adjacent_post() { 13 16 // Need some sample posts to test adjacency. … … 88 91 89 92 /** 90 93 * @ticket 22112 94 * 95 * @covers ::get_adjacent_post 91 96 */ 92 97 function test_get_adjacent_post_exclude_self_term() { 93 98 // Bump term_taxonomy to mimic shared term offsets. … … 175 180 176 181 /** 177 182 * @ticket 32833 183 * 184 * @covers ::get_adjacent_post 178 185 */ 179 186 public function test_get_adjacent_post_excluded_terms() { 180 187 register_taxonomy( 'wptests_tax', 'post' ); … … 209 216 210 217 /** 211 218 * @ticket 32833 219 * 220 * @covers ::get_adjacent_post 212 221 */ 213 222 public function test_get_adjacent_post_excluded_terms_should_not_require_posts_to_have_terms_in_any_taxonomy() { 214 223 register_taxonomy( 'wptests_tax', 'post' ); … … 246 255 247 256 /** 248 257 * @ticket 35211 258 * 259 * @covers ::get_adjacent_post 249 260 */ 250 261 public function test_get_adjacent_post_excluded_terms_filter() { 251 262 register_taxonomy( 'wptests_tax', 'post' ); … … 280 291 281 292 /** 282 293 * @ticket 43521 294 * 295 * @covers ::get_adjacent_post 283 296 */ 284 297 public function test_get_adjacent_post_excluded_terms_filter_should_apply_to_empty_excluded_terms_parameter() { 285 298 register_taxonomy( 'wptests_tax', 'post' ); … … 314 327 315 328 /** 316 329 * @ticket 43521 330 * 331 * @covers ::get_adjacent_post 317 332 */ 318 333 public function test_excluded_terms_filter_empty() { 319 334 register_taxonomy( 'wptests_tax', 'post' ); -
tests/phpunit/tests/link/getAdjacentPostLink.php
2 2 3 3 /** 4 4 * @group link 5 * 6 * @covers ::get_next_post_link 7 * @covers ::get_previous_post_link 5 8 */ 6 9 class Tests_Link_GetAdjacentPostLink extends WP_UnitTestCase { 7 10 … … 53 56 $GLOBALS['post'] = get_post( $this->post_ids[2] ); 54 57 } 55 58 59 /** 60 * 61 * @covers ::get_next_post_link 62 */ 56 63 public function test_get_next_post_link_default() { 57 64 $actual = get_next_post_link(); 58 65 $title = get_post( $this->post_ids[1] )->post_title; … … 60 67 $this->assertSame( $expected, $actual ); 61 68 } 62 69 70 /** 71 * 72 * @covers ::get_previous_post_link 73 */ 63 74 public function test_get_previous_post_link_default() { 64 75 $actual = get_previous_post_link(); 65 76 $title = get_post( $this->post_ids[3] )->post_title; … … 67 78 $this->assertSame( $expected, $actual ); 68 79 } 69 80 81 /** 82 * 83 * @covers ::get_next_post_link 84 */ 70 85 public function test_get_next_post_link_same_category() { 71 86 $actual = get_next_post_link( '%link »', '%title', true ); 72 87 $title = get_post( $this->post_ids[1] )->post_title; … … 73 88 $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">' . $title . '</a> »'; 74 89 $this->assertSame( $expected, $actual ); 75 90 } 76 91 92 /** 93 * 94 * @covers ::get_previous_post_link 95 */ 77 96 public function test_get_previous_post_link_same_category() { 78 97 $actual = get_previous_post_link( '« %link', '%title', true ); 79 98 $title = get_post( $this->post_ids[3] )->post_title; … … 80 99 $expected = '« <a href="' . home_url( '?p=' . $this->post_ids[3] ) . '" rel="prev">' . $title . '</a>'; 81 100 $this->assertSame( $expected, $actual ); 82 101 } 83 102 103 /** 104 * 105 * @covers ::get_next_post_link 106 */ 84 107 public function test_get_next_post_link_exclude_category() { 85 108 $actual = get_next_post_link( '%link »', '%title', false, $this->cat_id ); 86 109 $title = get_post( $this->post_ids[1] )->post_title; … … 87 110 $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">' . $title . '</a> »'; 88 111 $this->assertSame( $expected, $actual ); 89 112 } 90 113 114 /** 115 * 116 * @covers ::get_previous_post_link 117 */ 91 118 public function test_get_previous_post_link_exclude_category() { 92 119 $actual = get_previous_post_link( '« %link', '%title', false, $this->cat_id ); 93 120 $title = get_post( $this->post_ids[3] )->post_title; -
tests/phpunit/tests/link/getDashboardUrl.php
2 2 3 3 /** 4 4 * @group link 5 * 6 * @covers ::get_dashboard_url 5 7 */ 6 8 class Tests_Link_GetDashboardUrl extends WP_UnitTestCase { 7 9 static $user_id = false; … … 20 22 21 23 /** 22 24 * @ticket 39065 25 * 26 * @covers ::get_dashboard_url 23 27 */ 24 28 public function test_get_dashboard_url_for_current_site_user() { 25 29 $this->assertSame( admin_url(), get_dashboard_url( self::$user_id ) ); … … 27 31 28 32 /** 29 33 * @ticket 39065 34 * 35 * @covers ::get_dashboard_url 30 36 */ 31 37 public function test_get_dashboard_url_for_user_with_no_sites() { 32 38 add_filter( 'get_blogs_of_user', '__return_empty_array' ); … … 39 45 /** 40 46 * @ticket 39065 41 47 * @group ms-required 48 * 49 * @covers ::get_dashboard_url 42 50 */ 43 51 public function test_get_dashboard_url_for_network_administrator_with_no_sites() { 44 52 grant_super_admin( self::$user_id ); … … 56 64 /** 57 65 * @ticket 39065 58 66 * @group ms-required 67 * 68 * @covers ::get_dashboard_url 59 69 */ 60 70 public function test_get_dashboard_url_for_administrator_of_different_site() { 61 71 $site_id = self::factory()->blog->create( array( 'user_id' => self::$user_id ) ); -
tests/phpunit/tests/link/getNextCommentsLink.php
23 23 24 24 /** 25 25 * @ticket 20319 26 * 27 * @covers ::get_next_comments_link 26 28 */ 27 29 public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() { 28 30 $p = self::factory()->post->create(); -
tests/phpunit/tests/link/getPostCommentsFeedLink.php
1 1 <?php 2 2 /** 3 3 * @group link 4 * 5 * @covers ::get_post_comments_feed_link 4 6 */ 5 7 class Tests_Link_GetPostCommentsFeedLink extends WP_UnitTestCase { 6 8 9 /** 10 * 11 * @covers ::get_post_comments_feed_link 12 */ 7 13 public function test_post_link() { 8 14 $post_id = self::factory()->post->create(); 9 15 … … 19 25 $this->assertSame( $expected, $link ); 20 26 } 21 27 28 /** 29 * 30 * @covers ::get_post_comments_feed_link 31 */ 22 32 public function test_post_pretty_link() { 23 33 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 24 34 … … 30 40 $this->assertSame( $expected, $link ); 31 41 } 32 42 43 /** 44 * 45 * @covers ::get_post_comments_feed_link 46 */ 33 47 public function test_attachment_link() { 34 48 $post_id = self::factory()->post->create(); 35 49 $attachment_id = self::factory()->attachment->create_object( … … 53 67 $this->assertSame( $expected, $link ); 54 68 } 55 69 70 /** 71 * 72 * @covers ::get_post_comments_feed_link 73 */ 56 74 public function test_attachment_pretty_link() { 57 75 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 58 76 … … 79 97 $this->assertSame( $expected, $link ); 80 98 } 81 99 100 /** 101 * 102 * @covers ::get_post_comments_feed_link 103 */ 82 104 public function test_attachment_no_name_pretty_link() { 83 105 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 84 106 … … 98 120 $this->assertSame( $expected, $link ); 99 121 } 100 122 123 /** 124 * 125 * @covers ::get_post_comments_feed_link 126 */ 101 127 public function test_unattached_link() { 102 128 $attachment_id = self::factory()->attachment->create_object( 103 129 'image.jpg', … … 120 146 $this->assertSame( $expected, $link ); 121 147 } 122 148 149 /** 150 * 151 * @covers ::get_post_comments_feed_link 152 */ 123 153 public function test_unattached_pretty_link() { 124 154 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 125 155 -
tests/phpunit/tests/link/getPostTypeArchiveLink.php
1 1 <?php 2 2 /** 3 3 * @group link 4 * 5 * @covers get_post_type_archive_link 4 6 */ 5 7 class Tests_Link_GetPostTypeArchiveLink extends WP_UnitTestCase { 6 8 7 9 /** 8 10 * @ticket 19902 11 * 12 * @covers get_post_type_archive_link 9 13 */ 10 14 public function test_get_post_archive_link_with_post_archive_on_front_page() { 11 15 update_option( 'show_on_front', 'posts' ); … … 16 20 17 21 /** 18 22 * @ticket 19902 23 * 24 * @covers get_post_type_archive_link 19 25 */ 20 26 public function test_get_post_archive_link_with_post_archive_on_a_blog_page() { 21 27 $page_for_posts = $this->factory->post->create( -
tests/phpunit/tests/link/getPreviewPostLink.php
5 5 */ 6 6 class Tests_Link_GetPreviewPostLink extends WP_UnitTestCase { 7 7 8 /** 9 * 10 * @covers ::get_preview_post_link 11 */ 8 12 public function test_get_preview_post_link() { 9 13 $post = self::factory()->post->create(); 10 14 … … 11 15 $this->assertSame( add_query_arg( 'preview', 'true', get_permalink( $post ) ), get_preview_post_link( $post ) ); 12 16 } 13 17 18 /** 19 * 20 * @covers ::get_preview_post_link 21 */ 14 22 public function test_get_preview_post_link_should_add_additional_query_vars() { 15 23 $post = self::factory()->post->create(); 16 24 … … 35 43 ); 36 44 } 37 45 46 /** 47 * 48 * @covers ::get_preview_post_link 49 */ 38 50 public function test_get_preview_post_link_should_use_custom_base_preview_link() { 39 51 $post = self::factory()->post->create(); 40 52 … … 53 65 ); 54 66 } 55 67 68 /** 69 * 70 * @covers ::get_preview_post_link 71 */ 56 72 public function test_get_preview_post_link_should_return_null_for_non_existent_post() { 57 73 $this->assertNull( get_preview_post_link() ); 58 74 $this->assertNull( get_preview_post_link( 9999 ) ); … … 59 75 $this->assertNull( get_preview_post_link( 'foo' ) ); 60 76 } 61 77 78 /** 79 * 80 * @covers ::get_preview_post_link 81 */ 62 82 public function test_get_preview_post_link_for_global_post() { 63 83 $post = self::factory()->post->create_and_get(); 64 84 … … 67 87 $this->assertSame( add_query_arg( 'preview', 'true', get_permalink( $post ) ), get_preview_post_link() ); 68 88 } 69 89 90 /** 91 * 92 * @covers ::get_preview_post_link 93 */ 70 94 public function test_get_preview_post_link_should_return_empty_string_for_non_viewable_post_type() { 71 95 $post_type = register_post_type( 72 96 'non_viewable_cpt', -
tests/phpunit/tests/link/getPreviousCommentsLink.php
21 21 set_query_var( 'cpage', $cpage ); 22 22 } 23 23 24 /** 25 * 26 * @covers ::get_previous_comments_link 27 */ 24 28 public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() { 25 29 $p = self::factory()->post->create(); 26 30 $this->go_to( get_permalink( $p ) ); -
tests/phpunit/tests/link/getThePrivacyPolicyLink.php
73 73 * The function should return a valid link if a privacy policy page has been 74 74 * created and set as the `wp_page_for_privacy_policy`. The post title should 75 75 * be used as the link text. 76 * 77 * @covers ::get_the_privacy_policy_link 76 78 */ 77 79 public function test_get_the_privacy_policy_link_should_return_valid_link_when_privacy_page_set() { 78 80 update_option( 'wp_page_for_privacy_policy', self::$privacy_policy_page_id ); … … 87 89 /** 88 90 * The function should prepend the supplied `$before` markup and append the 89 91 * supplied `$after` markup when the `wp_page_for_privacy_policy` is configured. 92 * 93 * @covers ::get_the_privacy_policy_link 90 94 */ 91 95 public function test_get_the_privacy_policy_link_should_prepend_and_append_supplied_markup_when_privacy_page_set() { 92 96 update_option( 'wp_page_for_privacy_policy', self::$privacy_policy_page_id ); … … 101 105 /** 102 106 * The function should _not_ prepend the supplied `$before` markup and append 103 107 * the supplied `$after` markup when the `wp_page_for_privacy_policy` is _not_ configured. 108 * 109 * @covers ::get_the_privacy_policy_link 104 110 */ 105 111 public function test_get_the_privacy_policy_link_should_not_prepend_and_append_supplied_markup_when_privacy_page_not_set() { 106 112 $actual_link = get_the_privacy_policy_link( self::$before, self::$after ); … … 113 119 * for the privacy policy. 114 120 * 115 121 * @ticket 44192 122 * 123 * @covers ::get_the_privacy_policy_link 116 124 */ 117 125 public function test_function_should_return_empty_string_when_privacy_page_title_empty() { 118 126 $nameless_page_id = $this->factory->post->create( … … 129 137 130 138 /** 131 139 * The function should return an empty string when `wp_page_for_privacy_policy` is _not_ configured. 140 * 141 * @covers ::get_the_privacy_policy_link 132 142 */ 133 143 public function test_get_the_privacy_policy_link_should_return_empty_string_when_privacy_page_not_set() { 134 144 $this->assertSame( '', get_the_privacy_policy_link() ); … … 136 146 137 147 /** 138 148 * The output of the get_the_privacy_policy_link() function should be filterable with the 'privacy_policy_link' filter. 149 * 150 * @covers ::get_the_privacy_policy_link 139 151 */ 140 152 public function test_get_the_privacy_policy_link_should_be_filterable() { 141 153 update_option( 'wp_page_for_privacy_policy', self::$privacy_policy_page_id ); -
tests/phpunit/tests/link/themeFile.php
45 45 * @ticket 18302 46 46 * 47 47 * @dataProvider data_theme_files 48 * 49 * @covers ::get_theme_file_uri 50 * @covers ::get_parent_theme_file_uri 48 51 */ 49 52 public function test_theme_file_uri_with_parent_theme( $file, $expected_theme, $existence ) { 50 53 switch_theme( 'theme-file-parent' ); … … 58 61 * @ticket 18302 59 62 * 60 63 * @dataProvider data_theme_files 64 * 65 * @covers ::get_theme_file_uri 66 * @covers ::get_parent_theme_file_uri 61 67 */ 62 68 public function test_theme_file_uri_with_child_theme( $file, $expected_theme, $existence ) { 63 69 switch_theme( 'theme-file-child' ); … … 73 79 * @ticket 18302 74 80 * 75 81 * @dataProvider data_theme_files 82 * 83 * @covers ::get_theme_file_path 84 * @covers ::get_parent_theme_file_path 76 85 */ 77 86 public function test_theme_file_path_with_parent_theme( $file, $expected_theme, $existence ) { 78 87 switch_theme( 'theme-file-parent' ); … … 86 95 * @ticket 18302 87 96 * 88 97 * @dataProvider data_theme_files 98 * 99 * @covers ::get_theme_file_path 100 * @covers ::get_parent_theme_file_path 89 101 */ 90 102 public function test_theme_file_path_with_child_theme( $file, $expected_theme, $existence ) { 91 103 switch_theme( 'theme-file-child' ); … … 124 136 * @ticket 18302 125 137 * 126 138 * @dataProvider data_theme_files 139 * 140 * @covers ::get_theme_file_uri 141 * @covers ::get_parent_theme_file_uri 127 142 */ 128 143 public function test_theme_file_uri_returns_valid_uri( $file, $expected_theme, $existence ) { 129 144 $uri = get_theme_file_uri( $file ); -
tests/phpunit/tests/link/wpGetCanonicalURL.php
19 19 20 20 /** 21 21 * Test for a non existing post. 22 * 23 * @covers ::wp_get_canonical_url 22 24 */ 23 25 public function test_non_existing_post() { 24 26 $this->assertFalse( wp_get_canonical_url( -1 ) ); … … 26 28 27 29 /** 28 30 * Test for a post that is not published. 31 * 32 * @covers ::wp_get_canonical_url 29 33 */ 30 34 public function test_post_status() { 31 35 $post_id = self::factory()->post->create( … … 39 43 40 44 /** 41 45 * Test for a page that is not the queried object. 46 * 47 * @covers ::wp_get_canonical_url 42 48 */ 43 49 public function test_non_current_page() { 44 50 $this->assertSame( get_permalink( self::$post_id ), wp_get_canonical_url( self::$post_id ) ); … … 46 52 47 53 /** 48 54 * Test non permalink structure page usage. 55 * 56 * @covers ::wp_get_canonical_url 49 57 */ 50 58 public function test_paged_with_plain_permalink_structure() { 51 59 $link = add_query_arg( … … 70 78 71 79 /** 72 80 * Test permalink structure page usage. 81 * 82 * @covers ::wp_get_canonical_url 73 83 */ 74 84 public function test_paged_with_custom_permalink_structure() { 75 85 $this->set_permalink_structure( '/%postname%/' ); … … 91 101 } 92 102 93 103 /** 94 * Test non permalink structure comment page usage. 104 * Test non permalink structure comment page usage. 105 * 106 * @covers ::wp_get_canonical_url 95 107 */ 96 108 public function test_comments_paged_with_plain_permalink_structure() { 97 109 $cpage = 2; … … 118 130 119 131 /** 120 132 * Test permalink structure comment page usage. 133 * 134 * @covers ::wp_get_canonical_url 121 135 */ 122 136 public function test_comments_paged_with_pretty_permalink_structure() { 123 137 global $wp_rewrite; … … 142 156 143 157 /** 144 158 * Test calling of filter. 159 * 160 * @covers ::wp_get_canonical_url 145 161 */ 146 162 public function test_get_canonical_url_filter() { 147 163 add_filter( 'get_canonical_url', array( $this, 'canonical_url_filter' ) ); -
tests/phpunit/tests/load/convertHrToBytes.php
15 15 * 16 16 * @param int|string $value The value passed to wp_convert_hr_to_bytes(). 17 17 * @param int $expected The expected output of wp_convert_hr_to_bytes(). 18 * 19 * @covers ::wp_convert_hr_to_bytes 18 20 */ 19 21 function test_wp_convert_hr_to_bytes( $value, $expected ) { 20 22 $this->assertSame( $expected, wp_convert_hr_to_bytes( $value ) ); -
tests/phpunit/tests/load/isIniValueChangeable.php
16 16 * 17 17 * @param string $setting The setting passed to wp_is_ini_value_changeable(). 18 18 * @param bool $expected The expected output of wp_convert_hr_to_bytes(). 19 * 20 * @covers ::wp_is_ini_value_changeable 19 21 */ 20 22 function test_wp_is_ini_value_changeable( $setting, $expected ) { 21 23 $this->assertSame( $expected, wp_is_ini_value_changeable( $setting ) );