Ticket #39265: functions_folder.2.patch
File functions_folder.2.patch, 36.0 KB (added by , 4 years ago) |
---|
-
tests/phpunit/tests/functions/addMagicQuotes.php
13 13 * 14 14 * @param array $test_array Test value. 15 15 * @param array $expected Expected return value. 16 * 17 * @covers ::test_add_magic_quotes 16 18 */ 17 19 function test_add_magic_quotes( $test_array, $expected ) { 18 20 $this->assertSame( $expected, add_magic_quotes( $test_array ) ); -
tests/phpunit/tests/functions/allowedProtocols.php
8 8 9 9 /** 10 10 * @ticket 19354 11 * 12 * @covers ::wp_allowed_protocols 11 13 */ 12 14 function test_data_is_not_an_allowed_protocol() { 13 15 $this->assertNotContains( 'data', wp_allowed_protocols() ); 14 16 } 15 17 18 /** 19 * @covers ::wp_allowed_protocols 20 */ 16 21 function test_allowed_protocol_has_an_example() { 17 22 $example_protocols = array(); 18 23 foreach ( $this->data_example_urls() as $example ) { … … 27 32 * 28 33 * @param string The scheme. 29 34 * @param string Example URL. 35 * 36 * @covers ::wp_allowed_protocols 30 37 */ 31 38 function test_allowed_protocols( $protocol, $url ) { 32 39 $this->assertEquals( $url, esc_url( $url, $protocol ) ); -
tests/phpunit/tests/functions/anonymization.php
26 26 * 27 27 * @param string $raw_ip Raw IP address. 28 28 * @param string $expected_result Expected result. 29 * 30 * @covers ::wp_privacy_anonymize_data 29 31 */ 30 32 public function test_wp_privacy_anonymize_ip( $raw_ip, $expected_result ) { 31 33 if ( ! function_exists( 'inet_ntop' ) || ! function_exists( 'inet_pton' ) ) { … … 210 212 211 213 /** 212 214 * Test email anonymization of `wp_privacy_anonymize_data()`. 215 * 216 * @covers ::wp_privacy_anonymize_data 213 217 */ 214 218 public function test_anonymize_email() { 215 219 $this->assertSame( 'deleted@site.invalid', wp_privacy_anonymize_data( 'email', 'bar@example.com' ) ); … … 217 221 218 222 /** 219 223 * Test url anonymization of `wp_privacy_anonymize_data()`. 224 * 225 * @covers ::wp_privacy_anonymize_data 220 226 */ 221 227 public function test_anonymize_url() { 222 228 $this->assertSame( 'https://site.invalid', wp_privacy_anonymize_data( 'url', 'https://example.com/author/username' ) ); … … 224 230 225 231 /** 226 232 * Test date anonymization of `wp_privacy_anonymize_data()`. 233 * 234 * @covers ::wp_privacy_anonymize_data 227 235 */ 228 236 public function test_anonymize_date() { 229 237 $this->assertEquals( '0000-00-00 00:00:00', wp_privacy_anonymize_data( 'date', '2003-12-25 12:34:56' ) ); … … 231 239 232 240 /** 233 241 * Test text anonymization of `wp_privacy_anonymize_data()`. 242 * 243 * @covers ::wp_privacy_anonymize_data 234 244 */ 235 245 public function test_anonymize_text() { 236 246 $text = __( 'Four score and seven years ago' ); … … 239 249 240 250 /** 241 251 * Test long text anonymization of `wp_privacy_anonymize_data()`. 252 * 253 * @covers ::wp_privacy_anonymize_data 242 254 */ 243 255 public function test_anonymize_long_text() { 244 256 $text = __( 'Four score and seven years ago' ); … … 249 261 * Test text anonymization when a filter is added. 250 262 * 251 263 * @ticket 44141 264 * 265 * @covers ::wp_privacy_anonymize_data 252 266 */ 253 267 public function test_anonymize_with_filter() { 254 268 add_filter( 'wp_privacy_anonymize_data', array( $this, 'filter_wp_privacy_anonymize_data' ), 10, 3 ); -
tests/phpunit/tests/functions/canonicalCharset.php
8 8 9 9 class Tests_Functions_CanonicalCharset extends WP_UnitTestCase { 10 10 11 /** 12 * @covers ::_canonical_charset 13 */ 11 14 public function test_utf_8_lower() { 12 15 $this->assertEquals( 'UTF-8', _canonical_charset( 'utf-8' ) ); 13 16 } 14 17 18 /** 19 * @covers ::_canonical_charset 20 */ 15 21 public function test_utf_8_upper() { 16 22 $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF-8' ) ); 17 23 } 18 24 25 /** 26 * @covers ::_canonical_charset 27 */ 19 28 public function test_utf_8_mixxed() { 20 29 $this->assertEquals( 'UTF-8', _canonical_charset( 'Utf-8' ) ); 21 30 } 22 31 32 /** 33 * @covers ::_canonical_charset 34 */ 23 35 public function test_utf_8() { 24 36 $this->assertEquals( 'UTF-8', _canonical_charset( 'UTF8' ) ); 25 37 } 26 38 39 /** 40 * @covers ::_canonical_charset 41 */ 27 42 public function test_iso_lower() { 28 43 $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'iso-8859-1' ) ); 29 44 } 30 45 46 /** 47 * @covers ::_canonical_charset 48 */ 31 49 public function test_iso_upper() { 32 50 $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO-8859-1' ) ); 33 51 } 34 52 53 /** 54 * @covers ::_canonical_charset 55 */ 35 56 public function test_iso_mixxed() { 36 57 $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'Iso8859-1' ) ); 37 58 } 38 59 60 /** 61 * @covers ::_canonical_charset 62 */ 39 63 public function test_iso() { 40 64 $this->assertEquals( 'ISO-8859-1', _canonical_charset( 'ISO8859-1' ) ); 41 65 } 42 66 67 /** 68 * @covers ::_canonical_charset 69 */ 43 70 public function test_random() { 44 71 $this->assertEquals( 'random', _canonical_charset( 'random' ) ); 45 72 } 46 73 74 /** 75 * @covers ::_canonical_charset 76 */ 47 77 public function test_empty() { 48 78 $this->assertEquals( '', _canonical_charset( '' ) ); 49 79 } … … 50 80 51 81 /** 52 82 * @ticket 23688 83 * 84 * @covers ::get_option 53 85 */ 54 86 function test_update_option_blog_charset() { 55 87 $orig_blog_charset = get_option( 'blog_charset' ); -
tests/phpunit/tests/functions/cleanupHeaderComment.php
15 15 * 16 16 * @param string $test_string 17 17 * @param string $expected 18 * 19 * @covers ::_cleanup_header_comment 18 20 */ 19 21 public function test_cleanup_header_comment( $test_string, $expected ) { 20 22 $this->assertEqualsIgnoreEOL( $expected, _cleanup_header_comment( $test_string ) ); -
tests/phpunit/tests/functions/deprecated.php
140 140 * 141 141 * @ticket 6821 142 142 * @expectedDeprecated wp_save_image_file 143 * 144 * @covers ::wp_save_image_file 143 145 */ 144 146 public function test_wp_save_image_file_deprecated_with_gd_resource() { 145 147 if ( ! function_exists( 'imagejpeg' ) ) { … … 163 165 * Tests that wp_save_image_file() doesn't have a deprecated argument when passed a WP_Image_Editor. 164 166 * 165 167 * @ticket 6821 168 * 169 * @covers ::wp_save_image_file 166 170 */ 167 171 public function test_wp_save_image_file_not_deprecated_with_wp_image_editor() { 168 172 if ( ! function_exists( 'imagejpeg' ) ) { -
tests/phpunit/tests/functions/doEnclose.php
60 60 * @since 5.3.0 61 61 * 62 62 * @dataProvider data_test_do_enclose 63 * 64 * @covers ::do_enclose 63 65 */ 64 66 public function test_function_with_implicit_content_input( $content, $expected ) { 65 67 $post_id = self::factory()->post->create( … … 146 148 * The function should return false when the post ID input is invalid. 147 149 * 148 150 * @since 5.3.0 151 * 152 * @covers ::do_enclose 149 153 */ 150 154 public function test_function_should_return_false_when_invalid_post_id() { 151 155 $post_id = null; … … 157 161 * The function should delete an enclosed link when it's no longer in the post content. 158 162 * 159 163 * @since 5.3.0 164 * 165 * @covers ::do_enclose 160 166 */ 161 167 public function test_function_should_delete_enclosed_link_when_no_longer_in_post_content() { 162 168 $data = $this->data_test_do_enclose(); … … 191 197 * The function should support a post object input. 192 198 * 193 199 * @since 5.3.0 200 * 201 * @covers ::do_enclose 194 202 */ 195 203 public function test_function_should_support_post_object_input() { 196 204 $data = $this->data_test_do_enclose(); … … 211 219 * The enclosure links should be filterable with the `enclosure_links` filter. 212 220 * 213 221 * @since 5.3.0 222 * 223 * @covers ::do_enclose 214 224 */ 215 225 public function test_function_enclosure_links_should_be_filterable() { 216 226 $data = $this->data_test_do_enclose(); … … 253 263 * @since 5.3.0 254 264 * 255 265 * @param int $post_id Post ID. 256 * @return string 266 * @return string All enclosure data for the given post. 257 267 */ 258 268 protected function get_enclosed_by_post_id( $post_id ) { 259 269 return implode( '', (array) get_post_meta( $post_id, 'enclosure', false ) ); -
tests/phpunit/tests/functions/getStatusHeaderDesc.php
14 14 * 15 15 * @param int $code HTTP status code. 16 16 * @param string $expected Status description. 17 * 18 * @covers ::get_status_header_desc 17 19 */ 18 20 public function test_get_status_header_desc( $code, $expected ) { 19 21 $this->assertSame( get_status_header_desc( $code ), $expected ); -
tests/phpunit/tests/functions/getWeekstartend.php
5 5 */ 6 6 class Tests_Functions_GetWeekstartend extends WP_UnitTestCase { 7 7 8 /** 9 * 10 * @covers ::get_weekstartend 11 */ 8 12 public function test_default_start_of_week_option_is_monday() { 9 13 $expected = array( 10 14 'start' => 1454889600, … … 14 18 $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) ); 15 19 } 16 20 21 /** 22 * 23 * @covers ::get_weekstartend 24 */ 17 25 public function test_start_of_week_sunday() { 18 26 $expected = array( 19 27 'start' => 1454803200, … … 23 31 $this->assertEquals( $expected, get_weekstartend( '2016-02-12', 0 ) ); 24 32 } 25 33 34 /** 35 * 36 * @covers ::get_weekstartend 37 */ 26 38 public function test_start_of_week_should_fall_back_on_start_of_week_option() { 27 39 update_option( 'start_of_week', 2 ); 28 40 … … 34 46 $this->assertEquals( $expected, get_weekstartend( '2016-02-12' ) ); 35 47 } 36 48 49 /** 50 * 51 * @covers ::get_weekstartend 52 */ 37 53 public function test_start_of_week_should_fall_back_on_sunday_when_option_is_missing() { 38 54 delete_option( 'start_of_week' ); 39 55 -
tests/phpunit/tests/functions/isNewDay.php
15 15 * @param string $currentday_string The day of the current post in the loop. 16 16 * @param string $previousday_string The day of the previous post in the loop. 17 17 * @param bool $expected Expected result. 18 * 19 * @covers ::is_new_day 18 20 */ 19 21 public function test_is_new_date( $currentday_string, $previousday_string, $expected ) { 20 22 global $currentday, $previousday; -
tests/phpunit/tests/functions/isSerializedString.php
61 61 * 62 62 * @param array|object|int|string $data Data value to test. 63 63 * @param bool $expected Expected function result. 64 * 65 * @covers ::is_serialized_string 64 66 */ 65 67 public function test_is_serialized_string( $data, $expected ) { 66 68 $this->assertSame( $expected, is_serialized_string( $data ) ); -
tests/phpunit/tests/functions/listFiles.php
6 6 * @group functions.php 7 7 */ 8 8 class Tests_Functions_ListFiles extends WP_UnitTestCase { 9 10 /** 11 * 12 * @covers ::list_files 13 */ 9 14 public function test_list_files_returns_a_list_of_files() { 10 15 $admin_files = list_files( ABSPATH . 'wp-admin/' ); 11 16 $this->assertInternalType( 'array', $admin_files ); … … 13 18 $this->assertContains( ABSPATH . 'wp-admin/index.php', $admin_files ); 14 19 } 15 20 21 /** 22 * 23 * @covers ::list_files 24 */ 16 25 public function test_list_files_can_exclude_files() { 17 26 $admin_files = list_files( ABSPATH . 'wp-admin/', 100, array( 'index.php' ) ); 18 27 $this->assertNotContains( ABSPATH . 'wp-admin/index.php', $admin_files ); -
tests/phpunit/tests/functions/numberFormatI18n.php
7 7 * @group i18n 8 8 */ 9 9 class Tests_Functions_NumberFormatI18n extends WP_UnitTestCase { 10 11 /** 12 * 13 * @covers ::number_format_i18n 14 */ 10 15 public function test_should_fall_back_to_number_format_when_wp_locale_is_not_set() { 11 16 $locale = clone $GLOBALS['wp_locale']; 12 17 $GLOBALS['wp_locale'] = null; … … 20 25 $this->assertEquals( '123,456.7890', $actual_2 ); 21 26 } 22 27 28 /** 29 * 30 * @covers ::number_format_i18n 31 */ 23 32 public function test_should_respect_number_format_of_locale() { 24 33 $decimal_point = $GLOBALS['wp_locale']->number_format['decimal_point']; 25 34 $thousands_sep = $GLOBALS['wp_locale']->number_format['thousands_sep']; … … 37 46 $this->assertEquals( '123^456@7890', $actual_2 ); 38 47 } 39 48 49 /** 50 * 51 * @covers ::number_format_i18n 52 */ 40 53 public function test_should_default_to_en_us_format() { 41 54 $this->assertEquals( '123,457', number_format_i18n( 123456.789, 0 ) ); 42 55 $this->assertEquals( '123,456.7890', number_format_i18n( 123456.789, 4 ) ); 43 56 } 44 57 58 /** 59 * 60 * @covers ::number_format_i18n 61 */ 45 62 public function test_should_handle_negative_precision() { 46 63 $this->assertEquals( '123,457', number_format_i18n( 123456.789, 0 ) ); 47 64 $this->assertEquals( '123,456.7890', number_format_i18n( 123456.789, -4 ) ); -
tests/phpunit/tests/functions/pluginBasename.php
35 35 36 36 /** 37 37 * @ticket 29154 38 * 39 * @covers ::plugin_basename 38 40 */ 39 41 function test_return_correct_basename_for_symlinked_plugins() { 40 42 global $wp_plugin_paths; … … 49 51 50 52 /** 51 53 * @ticket 28441 54 * 55 * @covers ::plugin_basename 52 56 */ 53 57 function test_return_correct_basename_for_symlinked_plugins_with_path_conflicts() { 54 58 global $wp_plugin_paths; -
tests/phpunit/tests/functions/referer.php
32 32 return $hosts; 33 33 } 34 34 35 /** 36 * 37 * @covers ::wp_get_referer 38 */ 35 39 public function test_from_request_relative_referrer() { 36 40 $_REQUEST['_wp_http_referer'] = addslashes( '/test.php?id=123' ); 37 41 $_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' ); … … 38 42 $this->assertFalse( wp_get_referer() ); 39 43 } 40 44 45 /** 46 * 47 * @covers ::wp_get_referer 48 */ 41 49 public function test_from_request_same_url() { 42 50 $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?id=123' ); 43 51 $_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' ); … … 44 52 $this->assertFalse( wp_get_referer() ); 45 53 } 46 54 55 /** 56 * 57 * @covers ::wp_get_referer 58 */ 47 59 public function test_from_request_different_resource() { 48 60 $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123' ); 49 61 $_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' ); … … 50 62 $this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123', wp_get_referer() ); 51 63 } 52 64 65 /** 66 * 67 * @covers ::wp_get_referer 68 */ 53 69 public function test_from_request_different_query_args() { 54 70 $_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?another=555' ); 55 71 $_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' ); … … 58 74 59 75 /** 60 76 * @ticket 19856 77 * 78 * @covers ::wp_get_referer 61 79 */ 62 80 public function test_from_request_subfolder_install() { 63 81 add_filter( 'site_url', array( $this, '_fake_subfolder_install' ) ); … … 71 89 72 90 /** 73 91 * @ticket 19856 92 * 93 * @covers ::wp_get_referer 74 94 */ 75 95 public function test_from_request_subfolder_install_different_resource() { 76 96 add_filter( 'site_url', array( $this, '_fake_subfolder_install' ) ); … … 82 102 remove_filter( 'site_url', array( $this, '_fake_subfolder_install' ) ); 83 103 } 84 104 105 /** 106 * 107 * @covers ::wp_get_referer 108 */ 85 109 public function test_relative_referrer() { 86 110 $_REQUEST['HTTP_REFERER'] = addslashes( '/test.php?id=123' ); 87 111 $_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' ); … … 88 112 $this->assertFalse( wp_get_referer() ); 89 113 } 90 114 115 /** 116 * 117 * @covers ::wp_get_referer 118 */ 91 119 public function test_same_url() { 92 120 $_SERVER['HTTP_REFERER'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?id=123' ); 93 121 $_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' ); … … 94 122 $this->assertFalse( wp_get_referer() ); 95 123 } 96 124 125 /** 126 * 127 * @covers ::wp_get_referer 128 */ 97 129 public function test_different_resource() { 98 130 $_SERVER['HTTP_REFERER'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123' ); 99 131 $_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' ); … … 103 135 /** 104 136 * @ticket 19856 105 137 * @ticket 27152 138 * 139 * @covers ::wp_get_referer 106 140 */ 107 141 public function test_different_server() { 108 142 $_SERVER['HTTP_REFERER'] = addslashes( 'http://another.' . WP_TESTS_DOMAIN . '/test.php?id=123' ); … … 113 147 /** 114 148 * @ticket 19856 115 149 * @ticket 27152 150 * 151 * @covers ::wp_get_referer 116 152 */ 117 153 public function test_different_server_allowed_redirect_host() { 118 154 add_filter( 'allowed_redirect_hosts', array( $this, 'filter_allowed_redirect_hosts' ) ); … … 124 160 125 161 /** 126 162 * @ticket 27152 163 * 164 * @covers ::wp_get_raw_referer 127 165 */ 128 166 public function test_raw_referer_empty() { 129 167 $this->assertFalse( wp_get_raw_referer() ); … … 131 169 132 170 /** 133 171 * @ticket 27152 172 * 173 * @covers ::wp_get_raw_referer 134 174 */ 135 175 public function test_raw_referer() { 136 176 $_SERVER['HTTP_REFERER'] = addslashes( 'http://example.com/foo?bar' ); … … 139 179 140 180 /** 141 181 * @ticket 27152 182 * 183 * @covers ::wp_get_raw_referer 142 184 */ 143 185 public function test_raw_referer_from_request() { 144 186 $_REQUEST['_wp_http_referer'] = addslashes( 'http://foo.bar/baz' ); … … 147 189 148 190 /** 149 191 * @ticket 27152 192 * 193 * @covers ::wp_get_raw_referer 150 194 */ 151 195 public function test_raw_referer_both() { 152 196 $_SERVER['HTTP_REFERER'] = addslashes( 'http://example.com/foo?bar' ); -
tests/phpunit/tests/functions/removeQueryArg.php
6 6 class Tests_Functions_RemoveQueryArg extends WP_UnitTestCase { 7 7 /** 8 8 * @dataProvider remove_query_arg_provider 9 * 10 * @covers ::remove_query_arg 9 11 */ 10 12 public function test_remove_query_arg( $keys_to_remove, $url, $expected ) { 11 13 $actual = remove_query_arg( $keys_to_remove, $url ); … … 24 26 ); 25 27 } 26 28 29 /** 30 * 31 * @covers ::remove_query_arg 32 */ 27 33 public function test_should_fall_back_on_current_url() { 28 34 $old_request_uri = $_SERVER['REQUEST_URI']; 29 35 $_SERVER['REQUEST_URI'] = 'edit.php?foo=bar&baz=quz'; -
tests/phpunit/tests/functions/sizeFormat.php
7 7 * @ticket 36635 8 8 */ 9 9 class Tests_Functions_SizeFormat extends WP_UnitTestCase { 10 10 11 public function _data_size_format() { 11 12 return array( 12 13 array( array(), 0, false ), … … 45 46 * @param $bytes 46 47 * @param $decimals 47 48 * @param $expected 49 * 50 * @covers ::size_format 48 51 */ 49 52 public function test_size_format( $bytes, $decimals, $expected ) { 50 53 $this->assertSame( $expected, size_format( $bytes, $decimals ) ); -
tests/phpunit/tests/functions/underscoreReturn.php
8 8 */ 9 9 class Tests_Functions_UnderscoreReturn extends WP_UnitTestCase { 10 10 11 /** 12 * 13 * @covers ::__return_true 14 */ 11 15 public function test__return_true() { 12 16 $this->assertTrue( __return_true() ); 13 17 } 14 18 19 /** 20 * 21 * @covers ::__return_false 22 */ 15 23 public function test__return_false() { 16 24 $this->assertFalse( __return_false() ); 17 25 } 18 26 27 /** 28 * 29 * @covers ::__return_zero 30 */ 19 31 public function test__return_zero() { 20 32 $this->assertSame( 0, __return_zero() ); 21 33 } 22 34 35 /** 36 * 37 * @covers ::__return_empty_array 38 */ 23 39 public function test__return_empty_array() { 24 40 $this->assertSame( array(), __return_empty_array() ); 25 41 } 26 42 43 /** 44 * 45 * @covers ::__return_null 46 */ 27 47 public function test__return_null() { 28 48 $this->assertNull( __return_null() ); 29 49 } 30 50 51 /** 52 * 53 * @covers ::__return_empty_string 54 */ 31 55 public function test__return_empty_string() { 32 56 $this->assertSame( '', __return_empty_string() ); 33 57 } -
tests/phpunit/tests/functions/wp.php
6 6 */ 7 7 class Tests_Functions_WP extends WP_UnitTestCase { 8 8 9 /** 10 * 11 * @covers ::wp 12 */ 9 13 public function test_wp_sets_global_vars() { 10 14 global $wp, $wp_query, $wp_the_query; 11 15 -
tests/phpunit/tests/functions/wpArraySliceAssoc.php
20 20 * @param array $target_array The original array. 21 21 * @param array $keys The list of keys. 22 22 * @param array $expected The expected result. 23 * 24 * @covers ::wp_array_slice_assoc 23 25 */ 24 26 public function test_wp_array_slice_assoc( $target_array, $keys, $expected ) { 25 27 $this->assertSame( wp_array_slice_assoc( $target_array, $keys ), $expected ); -
tests/phpunit/tests/functions/wpAuthCheck.php
11 11 * Run with user not logged in. 12 12 * 13 13 * @ticket 41860 14 * 15 * @covers ::is_user_logged_in 16 * @covers ::wp_auth_check 14 17 */ 15 18 function test_wp_auth_check_user_not_logged_in() { 16 19 $expected = array( … … 25 28 * Run with user logged in. 26 29 * 27 30 * @ticket 41860 31 * 32 * @covers ::is_user_logged_in 33 * @covers ::wp_auth_check 28 34 */ 29 35 function test_wp_auth_check_user_logged_in() { 30 36 // Log user in. … … 42 48 * Run with user logged in but with expired state. 43 49 * 44 50 * @ticket 41860 51 * 52 * @covers ::is_user_logged_in 53 * @covers ::wp_auth_check 45 54 */ 46 55 function test_wp_auth_check_user_logged_in_login_grace_period_set() { 47 56 // Log user in. -
tests/phpunit/tests/functions/wpGetArchives.php
29 29 ); 30 30 } 31 31 32 /** 33 * 34 * @covers ::wp_get_archives 35 */ 32 36 function test_wp_get_archives_default() { 33 37 $expected['default'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>'; 34 38 $this->assertEquals( $expected['default'], trim( wp_get_archives( array( 'echo' => false ) ) ) ); 35 39 } 36 40 41 /** 42 * 43 * @covers ::wp_get_archives 44 */ 37 45 function test_wp_get_archives_type() { 38 46 $expected['type'] = "<li><a href='" . $this->year_url . "'>" . gmdate( 'Y' ) . '</a></li>'; 39 47 $this->assertEquals( … … 49 57 ); 50 58 } 51 59 60 /** 61 * 62 * @covers ::wp_get_archives 63 */ 52 64 function test_wp_get_archives_limit() { 53 65 $ids = array_slice( array_reverse( self::$post_ids ), 0, 5 ); 54 66 … … 85 97 ); 86 98 } 87 99 100 /** 101 * 102 * @covers ::wp_get_archives 103 */ 88 104 function test_wp_get_archives_format() { 89 105 $expected['format'] = "<option value='" . $this->month_url . "'> " . gmdate( 'F Y' ) . ' </option>'; 90 106 $this->assertEquals( … … 100 116 ); 101 117 } 102 118 119 /** 120 * 121 * @covers ::wp_get_archives 122 */ 103 123 function test_wp_get_archives_before_and_after() { 104 124 $expected['before_and_after'] = "<div><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></div>'; 105 125 $this->assertEquals( … … 117 137 ); 118 138 } 119 139 140 /** 141 * 142 * @covers ::wp_get_archives 143 */ 120 144 function test_wp_get_archives_show_post_count() { 121 145 $expected['show_post_count'] = "<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a> (8)</li>'; 122 146 $this->assertEquals( … … 132 156 ); 133 157 } 134 158 159 /** 160 * 161 * @covers ::wp_get_archives 162 */ 135 163 function test_wp_get_archives_echo() { 136 164 $expected['echo'] = "\t<li><a href='" . $this->month_url . "'>" . gmdate( 'F Y' ) . '</a></li>' . "\n"; 137 165 $this->expectOutputString( $expected['echo'] ); … … 138 166 wp_get_archives( array( 'echo' => true ) ); 139 167 } 140 168 169 /** 170 * 171 * @covers ::wp_get_archives 172 */ 141 173 function test_wp_get_archives_order() { 142 174 self::factory()->post->create( 143 175 array( … … 184 216 185 217 /** 186 218 * @ticket 21596 219 * 220 * @covers ::wp_get_archives 187 221 */ 188 222 function test_wp_get_archives_post_type() { 189 223 register_post_type( 'taco', array( 'public' => true ) ); -
tests/phpunit/tests/functions/wpGetMimeTypes.php
9 9 10 10 /** 11 11 * @ticket 47701 12 * 13 * @covers ::wp_get_mime_types 12 14 */ 13 15 public function test_all_mime_match() { 14 16 $mime_types_start = wp_get_mime_types(); -
tests/phpunit/tests/functions/wpListFilter.php
39 39 $this->object_list[ $key ] = (object) $value; 40 40 } 41 41 } 42 42 /** 43 * 44 * @covers ::wp_filter_object_list 45 */ 43 46 function test_filter_object_list_and() { 44 47 $list = wp_filter_object_list( 45 48 $this->object_list, … … 54 57 $this->assertArrayHasKey( 'bar', $list ); 55 58 } 56 59 60 /** 61 * 62 * @covers ::wp_filter_object_list 63 */ 57 64 function test_filter_object_list_or() { 58 65 $list = wp_filter_object_list( 59 66 $this->object_list, … … 69 76 $this->assertArrayHasKey( 'baz', $list ); 70 77 } 71 78 79 /** 80 * 81 * @covers ::wp_filter_object_list 82 */ 72 83 function test_filter_object_list_not() { 73 84 $list = wp_filter_object_list( 74 85 $this->object_list, … … 82 93 $this->assertArrayHasKey( 'baz', $list ); 83 94 } 84 95 96 /** 97 * 98 * @covers ::wp_filter_object_list 99 */ 85 100 function test_filter_object_list_and_field() { 86 101 $list = wp_filter_object_list( 87 102 $this->object_list, … … 101 116 ); 102 117 } 103 118 119 /** 120 * 121 * @covers ::wp_filter_object_list 122 */ 104 123 function test_filter_object_list_or_field() { 105 124 $list = wp_filter_object_list( 106 125 $this->object_list, … … 120 139 ); 121 140 } 122 141 142 /** 143 * 144 * @covers ::wp_filter_object_list 145 */ 123 146 function test_filter_object_list_not_field() { 124 147 $list = wp_filter_object_list( 125 148 $this->object_list, … … 133 156 $this->assertEquals( array( 'baz' => 'baz' ), $list ); 134 157 } 135 158 159 /** 160 * 161 * @covers ::wp_filter_object_list 162 */ 136 163 function test_wp_list_pluck() { 137 164 $list = wp_list_pluck( $this->object_list, 'name' ); 138 165 $this->assertEquals( … … 157 184 158 185 /** 159 186 * @ticket 28666 187 * 188 * @covers ::wp_filter_object_list 160 189 */ 161 190 function test_wp_list_pluck_index_key() { 162 191 $list = wp_list_pluck( $this->array_list, 'name', 'id' ); … … 172 201 173 202 /** 174 203 * @ticket 28666 204 * 205 * @covers ::wp_list_pluck 175 206 */ 176 207 function test_wp_list_pluck_object_index_key() { 177 208 $list = wp_list_pluck( $this->object_list, 'name', 'id' ); … … 187 218 188 219 /** 189 220 * @ticket 28666 221 * 222 * @covers ::wp_list_pluck 190 223 */ 191 224 function test_wp_list_pluck_missing_index_key() { 192 225 $list = wp_list_pluck( $this->array_list, 'name', 'nonexistent' ); … … 202 235 203 236 /** 204 237 * @ticket 28666 238 * 239 * @covers ::wp_list_pluck 205 240 */ 206 241 function test_wp_list_pluck_partial_missing_index_key() { 207 242 $array_list = $this->array_list; … … 219 254 220 255 /** 221 256 * @ticket 28666 257 * 258 * @covers ::wp_list_pluck 222 259 */ 223 260 function test_wp_list_pluck_mixed_index_key() { 224 261 $mixed_list = $this->array_list; … … 236 273 237 274 /** 238 275 * @ticket 16895 276 * 277 * @covers ::wp_list_pluck 239 278 */ 240 279 function test_wp_list_pluck_containing_references() { 241 280 $ref_list = array( … … 261 300 262 301 /** 263 302 * @ticket 16895 303 * 304 * @covers ::wp_list_pluck 264 305 */ 265 306 function test_wp_list_pluck_containing_references_keys() { 266 307 $ref_list = array( … … 284 325 $this->assertInstanceOf( 'stdClass', $ref_list[1] ); 285 326 } 286 327 328 /** 329 * 330 * @covers ::wp_filter_object_list 331 */ 287 332 function test_filter_object_list_nested_array_and() { 288 333 $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND' ); 289 334 $this->assertEquals( 1, count( $list ) ); … … 290 335 $this->assertArrayHasKey( 'baz', $list ); 291 336 } 292 337 338 /** 339 * 340 * @covers ::wp_filter_object_list 341 */ 293 342 function test_filter_object_list_nested_array_not() { 294 343 $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'red' ) ), 'NOT' ); 295 344 $this->assertEquals( 2, count( $list ) ); … … 297 346 $this->assertArrayHasKey( 'baz', $list ); 298 347 } 299 348 349 /** 350 * 351 * @covers ::wp_filter_object_list 352 */ 300 353 function test_filter_object_list_nested_array_or() { 301 354 $list = wp_filter_object_list( 302 355 $this->object_list, … … 311 364 $this->assertArrayHasKey( 'baz', $list ); 312 365 } 313 366 367 /** 368 * 369 * @covers ::wp_filter_object_list 370 */ 314 371 function test_filter_object_list_nested_array_or_singular() { 315 372 $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'OR' ); 316 373 $this->assertEquals( 1, count( $list ) ); … … 317 374 $this->assertArrayHasKey( 'baz', $list ); 318 375 } 319 376 320 377 /** 378 * 379 * @covers ::wp_filter_object_list 380 */ 321 381 function test_filter_object_list_nested_array_and_field() { 322 382 $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' ); 323 383 $this->assertEquals( array( 'baz' => 'baz' ), $list ); 324 384 } 325 385 386 /** 387 * 388 * @covers ::wp_filter_object_list 389 */ 326 390 function test_filter_object_list_nested_array_not_field() { 327 391 $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'green' ) ), 'NOT', 'name' ); 328 392 $this->assertEquals( … … 334 398 ); 335 399 } 336 400 401 /** 402 * 403 * @covers ::wp_filter_object_list 404 */ 337 405 function test_filter_object_list_nested_array_or_field() { 338 406 $list = wp_filter_object_list( 339 407 $this->object_list, -
tests/phpunit/tests/functions/wpListUtil.php
159 159 * @param int|string $field Field from the object to place instead of the entire object 160 160 * @param int|string $index_key Field from the object to use as keys for the new array. 161 161 * @param array $expected Expected result. 162 * 163 * @covers ::wp_list_pluck 162 164 */ 163 165 public function test_wp_list_pluck( $list, $field, $index_key, $expected ) { 164 166 $this->assertEqualSetsWithIndex( $expected, wp_list_pluck( $list, $field, $index_key ) ); … … 364 366 * against each object. 365 367 * @param string $operator The logical operation to perform. 366 368 * @param array $expected Expected result. 369 * 370 * @covers ::wp_list_filter 367 371 */ 368 372 public function test_wp_list_filter( $list, $args, $operator, $expected ) { 369 373 $this->assertEqualSetsWithIndex( $expected, wp_list_filter( $list, $args, $operator ) ); … … 689 693 * @param string|array $orderby Either the field name to order by or an array 690 694 * of multiple orderby fields as $orderby => $order. 691 695 * @param string $order Either 'ASC' or 'DESC'. 696 * 697 * @covers ::wp_list_sort 692 698 */ 693 699 public function test_wp_list_sort( $list, $orderby, $order, $expected ) { 694 700 $this->assertEquals( $expected, wp_list_sort( $list, $orderby, $order ) ); … … 1014 1020 * @param string|array $orderby Either the field name to order by or an array 1015 1021 * of multiple orderby fields as $orderby => $order. 1016 1022 * @param string $order Either 'ASC' or 'DESC'. 1023 * 1024 * @covers ::wp_list_sort 1017 1025 */ 1018 1026 public function test_wp_list_sort_preserve_keys( $list, $orderby, $order, $expected ) { 1019 1027 $this->assertEquals( $expected, wp_list_sort( $list, $orderby, $order, true ) ); 1020 1028 } 1021 1029 1030 /** 1031 * 1032 * 1033 * @covers WP_List_Util::get_input 1034 */ 1022 1035 public function test_wp_list_util_get_input() { 1023 1036 $input = array( 'foo', 'bar' ); 1024 1037 $util = new WP_List_Util( $input ); … … 1026 1039 $this->assertEqualSets( $input, $util->get_input() ); 1027 1040 } 1028 1041 1042 /** 1043 * 1044 * 1045 * @covers WP_List_Util::get_output 1046 */ 1029 1047 public function test_wp_list_util_get_output_immediately() { 1030 1048 $input = array( 'foo', 'bar' ); 1031 1049 $util = new WP_List_Util( $input ); … … 1033 1051 $this->assertEqualSets( $input, $util->get_output() ); 1034 1052 } 1035 1053 1054 /** 1055 * 1056 * 1057 * @covers WP_List_Util::get_output 1058 */ 1036 1059 public function test_wp_list_util_get_output() { 1037 1060 $expected = array( 1038 1061 (object) array( -
tests/phpunit/tests/functions/wpRemoteFopen.php
8 8 9 9 /** 10 10 * @ticket 48845 11 * 12 * @covers ::wp_remote_fopen 11 13 */ 12 14 public function test_wp_remote_fopen_empty() { 13 15 $this->assertFalse( wp_remote_fopen( '' ) ); … … 15 17 16 18 /** 17 19 * @ticket 48845 20 * 21 * @covers ::wp_remote_fopen 18 22 */ 19 23 public function test_wp_remote_fopen_bad_url() { 20 24 $this->assertFalse( wp_remote_fopen( 'wp.com' ) ); … … 22 26 23 27 /** 24 28 * @ticket 48845 29 * 30 * @covers ::wp_remote_fopen 25 31 */ 26 32 public function test_wp_remote_fopen() { 27 33 // This URL gives a direct 200 response. -
tests/phpunit/tests/functions/wpValidateBoolean.php
52 52 * 53 53 * @ticket 30238 54 54 * @ticket 39868 55 * 56 * @covers ::wp_validate_boolean 55 57 */ 56 58 public function test_wp_validate_boolean( $test_value, $expected ) { 57 59 $this->assertSame( wp_validate_boolean( $test_value ), $expected );