Ticket #39265: formatting.2.patch
File formatting.2.patch, 56.4 KB (added by , 4 years ago) |
---|
-
tests/phpunit/tests/formatting/Autop.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wpautop 5 7 */ 6 8 class Tests_Formatting_Autop extends WP_UnitTestCase { 7 9 8 10 /** 9 * @ticket 11008 11 * @ticket 11008:wpautop 10 12 */ 11 13 function test_first_post() { 12 14 $expected = '<p>Welcome to WordPress! This post contains important information. After you read it, you can make it private to hide it from visitors but still have the information handy for future reference.</p> … … 68 70 /** 69 71 * wpautop() Should not alter the contents of "<pre>" elements 70 72 * 71 * @ticket 19855 73 * @ticket 19855:wpautop 72 74 */ 73 75 public function test_skip_pre_elements() { 74 76 $code = file_get_contents( DIR_TESTDATA . '/formatting/sizzle.js' ); … … 95 97 /** 96 98 * wpautop() Should not add <br/> to "<input>" elements 97 99 * 98 * @ticket 16456 100 * @ticket 16456:wpautop 99 101 */ 100 102 public function test_skip_input_elements() { 101 103 $str = 'Username: <input type="text" id="username" name="username" /><br />Password: <input type="password" id="password1" name="password1" />'; … … 105 107 /** 106 108 * wpautop() Should not add <p> and <br/> around <source> and <track> 107 109 * 108 * @ticket 26864 110 * @ticket 26864:wpautop 109 111 */ 110 112 public function test_source_track_elements() { 111 113 $content = "Paragraph one.\n\n" . … … 191 193 /** 192 194 * wpautop() Should not add <p> and <br/> around <param> and <embed> 193 195 * 194 * @ticket 26864 196 * @ticket 26864:wpautop 195 197 */ 196 198 public function test_param_embed_elements() { 197 199 $content1 = ' … … 270 272 /** 271 273 * wpautop() Should not add <br/> to "<select>" or "<option>" elements 272 274 * 273 * @ticket 22230 275 * @ticket 22230:wpautop 274 276 */ 275 277 public function test_skip_select_option_elements() { 276 278 $str = 'Country: <select id="state" name="state"><option value="1">Alabama</option><option value="2">Alaska</option><option value="3">Arizona</option><option value="4">Arkansas</option><option value="5">California</option></select>'; … … 280 282 /** 281 283 * wpautop() should treat block level HTML elements as blocks. 282 284 * 283 * @ticket 27268 285 * @ticket 27268:wpautop 284 286 */ 285 287 function test_that_wpautop_treats_block_level_elements_as_blocks() { 286 288 $blocks = array( … … 386 388 /** 387 389 * wpautop() should treat inline HTML elements as inline. 388 390 * 389 * @ticket 27268 391 * @ticket 27268:wpautop 390 392 */ 391 393 function test_that_wpautop_treats_inline_elements_as_inline() { 392 394 $inlines = array( … … 436 438 * Do not allow newlines within HTML elements to become mangled. 437 439 * 438 440 * @ticket 33106 439 * @dataProvider data_element_sanity 441 * @dataProvider data_element_sanity:wpautop 440 442 */ 441 443 function test_element_sanity( $input, $output ) { 442 444 return $this->assertSame( $output, wpautop( $input ) ); … … 488 490 /** 489 491 * wpautop() should not convert line breaks after <br /> tags 490 492 * 491 * @ticket 33377 493 * @ticket 33377:wpautop 492 494 */ 493 495 function test_that_wpautop_skips_line_breaks_after_br() { 494 496 $content = ' … … 511 513 /** 512 514 * wpautop() should convert multiple line breaks into a paragraph regarless of <br /> format 513 515 * 514 * @ticket 33377 516 * @ticket 33377:wpautop 515 517 */ 516 518 function test_that_wpautop_adds_a_paragraph_after_multiple_br() { 517 519 $content = ' … … 529 531 530 532 531 533 /** 532 * @ticket 4857 534 * @ticket 4857:wpautop 533 535 */ 534 536 function test_that_text_before_blocks_is_peed() { 535 537 $content = 'a<div>b</div>'; … … 539 541 } 540 542 541 543 /** 542 * wpautop() should not add extra </p> before <figcaption> 543 * 544 * @covers ::wpautop 544 * wpautop() should not add extra </p> before <figcaption>:wpautop 545 545 * @uses ::trim 546 546 * 547 * @ticket 39307 547 * @ticket 39307:wpautop 548 548 */ 549 549 function test_that_wpautop_does_not_add_extra_closing_p_in_figure() { 550 550 $content1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>'; … … 563 563 } 564 564 565 565 /** 566 * @ticket 14674 566 * @ticket 14674:wpautop 567 567 */ 568 568 function test_the_hr_is_not_peed() { 569 569 $content = 'paragraph1<hr>paragraph2'; … … 575 575 /** 576 576 * wpautop() should ignore inline SVG graphics 577 577 * 578 * @ticket 9437 578 * @ticket 9437:wpautop 579 579 */ 580 580 function test_that_wpautop_ignores_inline_svgs() { 581 581 $content = … … 593 593 /** 594 594 * wpautop() should ignore inline scripts 595 595 * 596 * @ticket 9437 596 * @ticket 9437:wpautop 597 597 */ 598 598 function test_that_wpautop_ignores_inline_scripts() { 599 599 $content = -
tests/phpunit/tests/formatting/balanceTags.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::balanceTags 5 7 */ 6 8 class Tests_Formatting_BalanceTags extends WP_UnitTestCase { 7 9 … … 236 238 } 237 239 } 238 240 241 239 242 function test_closes_unclosed_single_tags_having_attributes() { 240 243 $inputs = array( 241 244 '<img src="/images/example.png">', … … 251 254 } 252 255 } 253 256 257 254 258 function test_allows_validly_closed_single_tags() { 255 259 $inputs = array( 256 260 '<br />', … … 284 288 } 285 289 } 286 290 291 287 292 function test_allows_adjacent_nestable_tags() { 288 293 $inputs = array( 289 294 '<blockquote><blockquote>Example quote</blockquote></blockquote>', … … 306 311 $this->assertSame( $object, balanceTags( $object, true ) ); 307 312 } 308 313 314 309 315 function test_balances_nested_non_nestable_tags() { 310 316 $inputs = array( 311 317 '<b><b>This is bold</b></b>', … … 321 327 } 322 328 } 323 329 330 324 331 function test_fixes_improper_closing_tag_sequence() { 325 332 $inputs = array( 326 333 '<p>Here is a <strong class="part">bold <em>and emphasis</p></em></strong>', … … 336 343 } 337 344 } 338 345 346 339 347 function test_adds_missing_closing_tags() { 340 348 $inputs = array( 341 349 '<b><i>Test</b>', … … 357 365 } 358 366 } 359 367 368 360 369 function test_removes_extraneous_closing_tags() { 361 370 $inputs = array( 362 371 '<b>Test</b></b>', -
tests/phpunit/tests/formatting/BlogInfo.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::get_bloginfo 5 7 */ 6 8 class Tests_Formatting_BlogInfo extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/CapitalPDangit.php
3 3 4 4 /** 5 5 * @group formatting 6 * 7 * @covers ::capital_P_dangit 6 8 */ 7 9 class Tests_Formatting_CapitalPDangit extends WP_UnitTestCase { 8 10 function test_esc_attr_quotes() { -
tests/phpunit/tests/formatting/CleanPre.php
6 6 * 7 7 * @group formatting 8 8 * @expectedDeprecated clean_pre 9 * 10 * @covers ::clean_pre 9 11 */ 10 12 class Tests_Formatting_CleanPre extends WP_UnitTestCase { 11 13 … … 22 24 $this->assertSame( $res, clean_pre( $source ) ); 23 25 } 24 26 25 // I don't think this can ever happen in production; 26 // <br> is changed to <br /> elsewhere. Left in because 27 // that replacement shouldn't happen (what if you want 28 // HTML 4 output?). 27 28 /** 29 * I don't think this can ever happen in production; 30 * <br> is changed to <br /> elsewhere. Left in because 31 * that replacement shouldn't happen (what if you want 32 * HTML 4 output?). 33 */ 29 34 function test_removes_html_br() { 30 35 $source = 'a b c\n<br>sldfj<br>'; 31 36 $res = 'a b c\nsldfj'; -
tests/phpunit/tests/formatting/ConvertInvalidEntries.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::convert_invalid_entities 5 7 */ 6 8 class Tests_Formatting_ConvertInvalidEntities extends WP_UnitTestCase { 9 7 10 function test_replaces_windows1252_entities_with_unicode_ones() { 8 11 $input = '‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ'; 9 12 $output = '‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ'; -
tests/phpunit/tests/formatting/date.php
10 10 * Unpatched, this test passes only when Europe/London is not observing DST. 11 11 * 12 12 * @ticket 20328 13 * 14 * @covers ::get_date_from_gmt 13 15 */ 14 16 function test_get_date_from_gmt_outside_of_dst() { 15 17 update_option( 'timezone_string', 'Europe/London' ); … … 22 24 * Unpatched, this test passes only when Europe/London is observing DST. 23 25 * 24 26 * @ticket 20328 27 * 28 * @covers ::get_date_from_gmt 25 29 */ 26 30 function test_get_date_from_gmt_during_dst() { 27 31 update_option( 'timezone_string', 'Europe/London' ); … … 32 36 33 37 /** 34 38 * @ticket 20328 39 * 40 * @covers ::get_gmt_from_date 35 41 */ 36 42 function test_get_gmt_from_date_outside_of_dst() { 37 43 update_option( 'timezone_string', 'Europe/London' ); … … 42 48 43 49 /** 44 50 * @ticket 20328 51 * 52 * @covers ::get_gmt_from_date 45 53 */ 46 54 function test_get_gmt_from_date_during_dst() { 47 55 update_option( 'timezone_string', 'Europe/London' ); … … 52 60 53 61 /** 54 62 * @ticket 34279 63 * 64 * @covers ::get_date_from_gmt 65 * 55 66 */ 56 67 function test_get_date_and_time_from_gmt_no_timezone() { 57 68 $local = '2012-01-01 12:34:56'; … … 61 72 62 73 /** 63 74 * @ticket 34279 75 * 76 * @covers ::get_gmt_from_date 64 77 */ 65 78 function test_get_gmt_from_date_no_timezone() { 66 79 $gmt = '2012-12-01 00:00:00'; … … 70 83 71 84 /** 72 85 * @ticket 34279 86 * 87 * @covers ::get_gmt_from_date 73 88 */ 74 89 function test_get_gmt_from_date_short_date() { 75 90 update_option( 'timezone_string', 'Europe/London' ); … … 80 95 81 96 /** 82 97 * @ticket 34279 98 * 99 * @covers ::get_gmt_from_date 83 100 */ 84 101 function test_get_gmt_from_date_string_date() { 85 102 update_option( 'timezone_string', 'Europe/London' ); … … 90 107 91 108 /** 92 109 * @ticket 34279 110 * 111 * @covers ::get_gmt_from_date 93 112 */ 94 113 function test_get_gmt_from_date_string_date_no_timezone() { 95 114 $local = 'now'; … … 101 120 * @ticket 31809 102 121 * 103 122 * @dataProvider timezone_provider 123 * 124 * @covers ::get_gmt_from_date 104 125 */ 105 126 public function test_gmt_from_date_correct_time( $timezone_string, $gmt_offset ) { 106 127 update_option( 'timezone_string', $timezone_string ); … … 117 138 * @ticket 31809 118 139 * 119 140 * @dataProvider timezone_provider 141 * 142 * @covers ::get_date_from_gmt 120 143 */ 121 144 public function test_date_from_gmt_correct_time( $timezone_string, $gmt_offset ) { 122 145 update_option( 'timezone_string', $timezone_string ); … … 133 156 * @ticket 31809 134 157 * 135 158 * @dataProvider timezone_provider 159 * 160 * @covers ::iso8601_to_datetime 136 161 */ 137 162 public function test_is8601_to_datetime_correct_time( $timezone_string, $gmt_offset ) { 138 163 update_option( 'timezone_string', $timezone_string ); -
tests/phpunit/tests/formatting/Emoji.php
11 11 12 12 /** 13 13 * @ticket 36525 14 * 15 * @covers ::_print_emoji_detection_script 14 16 */ 15 17 public function test_unfiltered_emoji_cdns() { 16 18 // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present: … … 27 29 28 30 /** 29 31 * @ticket 36525 32 * 33 * @covers ::_print_emoji_detection_script 30 34 */ 31 35 public function test_filtered_emoji_svn_cdn() { 32 36 $filtered_svn_cdn = $this->_filtered_emoji_svn_cdn(); … … 50 54 51 55 /** 52 56 * @ticket 36525 57 * 58 * @covers ::_print_emoji_detection_script 53 59 */ 54 60 public function test_filtered_emoji_png_cdn() { 55 61 $filtered_png_cdn = $this->_filtered_emoji_png_cdn(); … … 69 75 70 76 /** 71 77 * @ticket 41501 78 * 79 * @covers ::_wp_emoji_list 72 80 */ 73 81 public function test_wp_emoji_list_returns_data() { 74 82 $default = _wp_emoji_list(); … … 113 121 /** 114 122 * @ticket 35293 115 123 * @dataProvider data_wp_encode_emoji 124 * 125 * @covers ::wp_encode_emoji 116 126 */ 117 127 public function test_wp_encode_emoji( $emoji, $expected ) { 118 128 $this->assertSame( $expected, wp_encode_emoji( $emoji ) ); … … 148 158 /** 149 159 * @ticket 35293 150 160 * @dataProvider data_wp_staticize_emoji 161 * 162 * @covers ::wp_staticize_emoji 151 163 */ 152 164 public function test_wp_staticize_emoji( $emoji, $expected ) { 153 165 $this->assertSame( $expected, wp_staticize_emoji( $emoji ) ); -
tests/phpunit/tests/formatting/ent2ncr.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::ent2ncr 5 7 */ 6 8 class Tests_Formatting_Ent2NCR extends WP_UnitTestCase { 7 9 /** -
tests/phpunit/tests/formatting/EscAttr.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::esc_attr 5 7 */ 6 8 class Tests_Formatting_EscAttr extends WP_UnitTestCase { 9 7 10 function test_esc_attr_quotes() { 8 11 $attr = '"double quotes"'; 9 12 $this->assertSame( '"double quotes"', esc_attr( $attr ) ); -
tests/phpunit/tests/formatting/EscHtml.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::esc_html 5 7 */ 6 8 class Tests_Formatting_EscHtml extends WP_UnitTestCase { 9 7 10 function test_esc_html_basics() { 8 11 // Simple string. 9 12 $html = 'The quick brown fox.'; -
tests/phpunit/tests/formatting/EscTextarea.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::esc_textarea 5 7 */ 6 8 class Tests_Formatting_EscTextarea extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/EscUrl.php
7 7 8 8 /** 9 9 * @ticket 23605 10 * 11 * @covers ::esc_url 10 12 */ 11 13 function test_spaces() { 12 14 $this->assertSame( 'http://example.com/Mr%20WordPress', esc_url( 'http://example.com/Mr WordPress' ) ); … … 19 21 $this->assertSame( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one%20two%20three&bar=four' ) ); 20 22 } 21 23 24 /** 25 * @covers ::esc_url 26 */ 22 27 function test_bad_characters() { 23 28 $this->assertSame( 'http://example.com/watchthelinefeedgo', esc_url( 'http://example.com/watchthelinefeed%0Ago' ) ); 24 29 $this->assertSame( 'http://example.com/watchthelinefeedgo', esc_url( 'http://example.com/watchthelinefeed%0ago' ) ); … … 33 38 $this->assertSame( 'http://example.com/', esc_url( 'http://example.com/%0%0%0ADa' ) ); 34 39 } 35 40 41 /** 42 * @covers ::esc_url 43 */ 36 44 function test_relative() { 37 45 $this->assertSame( '/example.php', esc_url( '/example.php' ) ); 38 46 $this->assertSame( 'example.php', esc_url( 'example.php' ) ); … … 40 48 $this->assertSame( '?foo=bar', esc_url( '?foo=bar' ) ); 41 49 } 42 50 51 /** 52 * @covers ::esc_url 53 * @covers ::esc_url_raw 54 */ 43 55 function test_all_url_parts() { 44 56 $url = 'https://user:pass@host.example.com:1234/path;p=1?query=2&r[]=3#fragment'; 45 57 … … 60 72 $this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', esc_url( $url ) ); 61 73 } 62 74 75 /** 76 * @covers ::esc_url 77 */ 63 78 function test_bare() { 64 79 $this->assertSame( 'http://example.com?foo', esc_url( 'example.com?foo' ) ); 65 80 $this->assertSame( 'http://example.com', esc_url( 'example.com' ) ); … … 68 83 $this->assertSame( 'http://баба.org/баба', esc_url( 'баба.org/баба' ) ); 69 84 } 70 85 86 /** 87 * @covers ::esc_url 88 * @covers ::esc_url_raw 89 */ 71 90 function test_encoding() { 72 91 $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) ); 73 92 $this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) ); … … 81 100 $this->assertSame( "http://example.com?url={$param}", esc_url( "http://example.com?url={$param}" ) ); 82 101 } 83 102 103 /** 104 * @covers ::esc_url 105 * @covers ::esc_url_raw 106 */ 84 107 function test_protocol() { 85 108 $this->assertSame( 'http://example.com', esc_url( 'http://example.com' ) ); 86 109 $this->assertSame( '', esc_url( 'nasty://example.com/' ) ); … … 145 168 146 169 /** 147 170 * @ticket 23187 171 * 172 * @covers ::esc_url 148 173 */ 149 174 function test_protocol_case() { 150 175 $this->assertSame( 'http://example.com', esc_url( 'HTTP://example.com' ) ); … … 151 176 $this->assertSame( 'http://example.com', esc_url( 'Http://example.com' ) ); 152 177 } 153 178 179 /** 180 * @covers ::esc_url 181 */ 154 182 function test_display_extras() { 155 183 $this->assertSame( 'http://example.com/'quoted'', esc_url( 'http://example.com/\'quoted\'' ) ); 156 184 $this->assertSame( 'http://example.com/\'quoted\'', esc_url( 'http://example.com/\'quoted\'', null, 'notdisplay' ) ); 157 185 } 158 186 187 /** 188 * @covers ::esc_url 189 */ 159 190 function test_non_ascii() { 160 191 $this->assertSame( 'http://example.org/баба', esc_url( 'http://example.org/баба' ) ); 161 192 $this->assertSame( 'http://баба.org/баба', esc_url( 'http://баба.org/баба' ) ); … … 162 193 $this->assertSame( 'http://müller.com/', esc_url( 'http://müller.com/' ) ); 163 194 } 164 195 196 /** 197 * @covers ::esc_url 198 */ 165 199 function test_feed() { 166 200 $this->assertSame( '', esc_url( 'feed:javascript:alert(1)' ) ); 167 201 $this->assertSame( '', esc_url( 'feed:javascript:feed:alert(1)' ) ); … … 172 206 173 207 /** 174 208 * @ticket 16859 209 * 210 * @covers ::esc_url 175 211 */ 176 212 function test_square_brackets() { 177 213 $this->assertSame( '/example.php?one%5B%5D=two', esc_url( '/example.php?one[]=two' ) ); … … 187 223 188 224 /** 189 225 * Courtesy of http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding 226 * 227 * @covers ::esc_url_raw 190 228 */ 191 229 function test_reserved_characters() { 192 230 $url = "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$%27()*+,;=/?:@-._~!$%27()*+,;==#/?:@-._~!$&'()*+,;="; … … 195 233 196 234 /** 197 235 * @ticket 21974 236 * 237 * @covers ::esc_url 198 238 */ 199 239 function test_protocol_relative_with_colon() { 200 240 $this->assertSame( '//example.com/foo?foo=abc:def', esc_url( '//example.com/foo?foo=abc:def' ) ); … … 202 242 203 243 /** 204 244 * @ticket 31632 245 * 246 * @covers ::esc_url 205 247 */ 206 248 function test_mailto_with_newline() { 207 249 $body = <<<EOT … … 217 259 218 260 /** 219 261 * @ticket 31632 262 * 263 * @covers ::esc_url 220 264 */ 221 265 function test_mailto_in_http_url_with_newline() { 222 266 $body = <<<EOT … … 232 276 233 277 /** 234 278 * @ticket 23605 279 * 280 * @covers ::esc_url 235 281 */ 236 282 function test_mailto_with_spaces() { 237 283 $body = 'Hi there, I thought you might want to sign up for this newsletter'; … … 243 289 244 290 /** 245 291 * @ticket 28015 292 * 293 * @covers ::esc_url_raw 246 294 */ 247 295 function test_invalid_charaters() { 248 296 $this->assertEmpty( esc_url_raw( '"^<>{}`' ) ); … … 250 298 251 299 /** 252 300 * @ticket 34202 301 * 302 * @covers ::esc_url 253 303 */ 254 304 function test_ipv6_hosts() { 255 305 $this->assertSame( '//[::127.0.0.1]', esc_url( '//[::127.0.0.1]' ) ); -
tests/phpunit/tests/formatting/EscXml.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::esc_xml 5 7 */ 6 8 class Tests_Formatting_EscXml extends WP_UnitTestCase { 7 9 /** -
tests/phpunit/tests/formatting/ExcerptRemoveBlocks.php
22 22 <!-- wp:column --> 23 23 <div class="wp-block-column"> 24 24 <!-- wp:archives {"displayAsDropdown":false,"showPostCounts":false} /--> 25 25 26 26 <!-- wp:paragraph --> 27 27 <p>paragraph inside column</p> 28 28 <!-- /wp:paragraph --> … … 40 40 41 41 42 42 <p>paragraph inside column</p> 43 43 44 44 '; 45 45 46 46 /** … … 91 91 * Tests excerpt_remove_blocks(). 92 92 * 93 93 * @ticket 46133 94 * 95 * @covers ::excerpt_remove_blocks 94 96 */ 95 97 function test_excerpt_remove_blocks() { 96 98 // Simple dynamic block.. … … 116 118 * `the_content` gets applied, just like shortcodes. 117 119 * 118 120 * @ticket 46133 121 * 122 * @covers ::do_blocks 119 123 */ 120 124 function test_excerpt_infinite_loop() { 121 125 $query = new WP_Query( -
tests/phpunit/tests/formatting/GetUrlInContent.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::get_url_in_content 5 7 */ 6 8 class Tests_Formatting_GetUrlInContent extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/HtmlExcerpt.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_html_excerpt 5 7 */ 6 8 class Tests_Formatting_HtmlExcerpt extends WP_UnitTestCase { 9 7 10 function test_simple() { 8 11 $this->assertSame( 'Baba', wp_html_excerpt( 'Baba told me not to come', 4 ) ); 9 12 } 13 10 14 function test_html() { 11 15 $this->assertSame( 'Baba', wp_html_excerpt( "<a href='http://baba.net/'>Baba</a> told me not to come", 4 ) ); 12 16 } 17 13 18 function test_entities() { 14 19 $this->assertSame( 'Baba', wp_html_excerpt( 'Baba & Dyado', 8 ) ); 15 20 $this->assertSame( 'Baba', wp_html_excerpt( 'Baba & Dyado', 8 ) ); -
tests/phpunit/tests/formatting/HumanTimeDiff.php
3 3 /** 4 4 * @group formatting 5 5 * @ticket 38773 6 * 7 * @covers ::human_time_diff 6 8 */ 7 9 class Tests_Formatting_HumanTimeDiff extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/IsEmail.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::is_email 5 7 */ 6 8 class Tests_Formatting_IsEmail extends WP_UnitTestCase { 9 7 10 function test_returns_the_email_address_if_it_is_valid() { 8 11 $data = array( 9 12 'bob@example.com', -
tests/phpunit/tests/formatting/isoDescrambler.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_iso_descrambler 5 7 */ 6 8 class Test_WP_ISO_Descrambler extends WP_UnitTestCase { 7 9 /* -
tests/phpunit/tests/formatting/JSEscape.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::esc_js 5 7 */ 6 8 class Tests_Formatting_JSEscape extends WP_UnitTestCase { 9 7 10 function test_js_escape_simple() { 8 11 $out = esc_js( 'foo bar baz();' ); 9 12 $this->assertSame( 'foo bar baz();', $out ); -
tests/phpunit/tests/formatting/LikeEscape.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::like_escape 5 7 */ 6 8 class Tests_Formatting_LikeEscape extends WP_UnitTestCase { 7 9 /** -
tests/phpunit/tests/formatting/LinksAddTarget.php
1 1 <?php 2 2 /** 3 3 * @group formatting 4 * 5 * @covers ::links_add_target 4 6 */ 5 7 class Tests_Formatting_LinksAddTarget extends WP_UnitTestCase { 6 8 /** -
tests/phpunit/tests/formatting/MakeClickable.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::make_clickable 5 7 */ 6 8 class Tests_Formatting_MakeClickable extends WP_UnitTestCase { 9 7 10 function test_mailto_xss() { 8 11 $in = 'testzzz@"STYLE="behavior:url(\'#default#time2\')"onBegin="alert(\'refresh-XSS\')"'; 9 12 $this->assertSame( $in, make_clickable( $in ) ); -
tests/phpunit/tests/formatting/MapDeep.php
3 3 /** 4 4 * @group formatting 5 5 * @ticket 22300 6 * 7 * @covers ::map_deep 6 8 */ 7 9 class Tests_Formatting_MapDeep extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/NormalizeWhitespace.php
1 1 <?php 2 2 /** 3 3 * @group formatting 4 * 5 * @covers ::normalize_whitespace 4 6 */ 5 7 class Tests_Formatting_NormalizeWhitespace extends WP_UnitTestCase { 6 8 /** -
tests/phpunit/tests/formatting/redirect.php
6 6 * @group redirect 7 7 */ 8 8 class Tests_Formatting_Redirect extends WP_UnitTestCase { 9 9 10 function setUp() { 10 11 parent::setUp(); 11 12 add_filter( 'home_url', array( $this, 'home_url' ) ); … … 22 23 * 23 24 * @param string $location The path or URL to redirect to. 24 25 * @param int $status HTTP response status code to use. 26 * 27 * @covers ::wp_redirect 25 28 */ 26 29 public function test_wp_redirect_bad_status_code( $location, $status ) { 27 30 $this->expectException( 'WPDieException' ); … … 41 44 ); 42 45 } 43 46 47 /** 48 * @covers ::wp_sanitize_redirect 49 */ 44 50 function test_wp_sanitize_redirect() { 45 51 $this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0Ago' ) ); 46 52 $this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0ago' ) ); … … 59 65 60 66 /** 61 67 * @ticket 36998 68 * 69 * @covers ::wp_sanitize_redirect 62 70 */ 63 71 function test_wp_sanitize_redirect_should_encode_spaces() { 64 72 $this->assertSame( 'http://example.com/test%20spaces', wp_sanitize_redirect( 'http://example.com/test%20spaces' ) ); … … 67 75 68 76 /** 69 77 * @dataProvider valid_url_provider 78 * 79 * @covers ::wp_validate_redirect 70 80 */ 71 81 function test_wp_validate_redirect_valid_url( $url, $expected ) { 72 82 $this->assertSame( $expected, wp_validate_redirect( $url ) ); … … 74 84 75 85 /** 76 86 * @dataProvider invalid_url_provider 87 * 88 * @covers ::wp_validate_redirect 77 89 */ 78 90 function test_wp_validate_redirect_invalid_url( $url ) { 79 91 $this->assertEquals( false, wp_validate_redirect( $url, false ) ); … … 166 178 /** 167 179 * @ticket 47980 168 180 * @dataProvider relative_url_provider 181 * 182 * @covers ::wp_validate_redirect 169 183 */ 170 184 function test_wp_validate_redirect_relative_url( $current_uri, $url, $expected ) { 171 185 // Backup the global. -
tests/phpunit/tests/formatting/RemoveAccents.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::remove_accents 5 7 */ 6 8 class Tests_Formatting_RemoveAccents extends WP_UnitTestCase { 9 7 10 public function test_remove_accents_simple() { 8 11 $this->assertSame( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) ); 9 12 } -
tests/phpunit/tests/formatting/SanitizeFileName.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::sanitize_file_name 5 7 */ 6 8 class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase { 9 7 10 function test_munges_extensions() { 8 11 // r17990 9 12 $file_name = sanitize_file_name( 'test.phtml.txt' ); -
tests/phpunit/tests/formatting/SanitizeMimeType.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::sanitize_mime_type 5 7 */ 6 8 class Tests_Formatting_SanitizeMimeType extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/SanitizeOrderby.php
2 2 3 3 /** 4 4 * @group sanitize_sql_orderby 5 * 6 * @covers ::sanitize_sql_orderby 5 7 */ 6 8 class Tests_Formatting_SanitizeOrderby extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/SanitizeTextField.php
127 127 /** 128 128 * @ticket 32257 129 129 * @dataProvider data_sanitize_text_field 130 * 131 * @covers ::sanitize_text_field 132 * @covers ::sanitize_textarea_field 130 133 */ 131 134 function test_sanitize_text_field( $string, $expected ) { 132 135 if ( is_array( $expected ) ) { -
tests/phpunit/tests/formatting/SanitizeTitle.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::sanitize_title 5 7 */ 6 8 class Tests_Formatting_SanitizeTitle extends WP_UnitTestCase { 9 10 7 11 function test_strips_html() { 8 12 $input = 'Captain <strong>Awesome</strong>'; 9 13 $expected = 'captain-awesome'; -
tests/phpunit/tests/formatting/SanitizeTitleWithDashes.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::sanitize_title_with_dashes 5 7 */ 6 8 class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase { 7 9 function test_strips_html() { … … 107 109 function test_replaces_bullet() { 108 110 $this->assertSame( 'fancy-title-amazing', sanitize_title_with_dashes( 'Fancy Title • Amazing', '', 'save' ) ); 109 111 } 110 111 112 function test_replaces_copy_reg_deg_trade() { 112 113 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( 'Just © a Slug', '', 'save' ) ); 113 114 $this->assertSame( 'just-a-slug', sanitize_title_with_dashes( '® Just a Slug', '', 'save' ) ); -
tests/phpunit/tests/formatting/SanitizeTrackbackUrls.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::sanitize_trackback_urls 5 7 */ 6 8 class Tests_Formatting_SanitizeTrackbackUrls extends WP_UnitTestCase { 7 9 /** -
tests/phpunit/tests/formatting/SanitizeUser.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::sanitize_user 5 7 */ 6 8 class Tests_Formatting_SanitizeUser extends WP_UnitTestCase { 9 7 10 function test_strips_html() { 8 11 $input = 'Captain <strong>Awesome</strong>'; 9 12 $expected = is_multisite() ? 'captain awesome' : 'Captain Awesome'; … … 36 39 $expected = is_multisite() ? 'franois' : 'Franois'; 37 40 $this->assertSame( $expected, sanitize_user( 'Fran%c3%a7ois' ) ); 38 41 } 42 39 43 function test_optional_strict_mode_reduces_to_safe_ascii_subset() { 40 44 $this->assertSame( 'abc', sanitize_user( '()~ab~ˆcˆ!', true ) ); 41 45 } -
tests/phpunit/tests/formatting/SeemsUtf8.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::seems_utf8 5 7 */ 6 8 class Tests_Formatting_SeemsUtf8 extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/Slashit.php
4 4 * @group formatting 5 5 */ 6 6 class Tests_Formatting_Slashit extends WP_UnitTestCase { 7 8 /** 9 * @covers ::backslashit 10 */ 7 11 function test_backslashes_middle_numbers() { 8 12 $this->assertSame( "\\a-!9\\a943\\b\\c", backslashit( 'a-!9a943bc' ) ); 9 13 } 10 14 15 /** 16 * @covers ::backslashit 17 */ 11 18 function test_backslashes_alphas() { 12 19 $this->assertSame( "\\a943\\b\\c", backslashit( 'a943bc' ) ); 13 20 } 14 21 22 /** 23 * @covers ::backslashit 24 */ 15 25 function test_double_backslashes_leading_numbers() { 16 26 $this->assertSame( '\\\\95', backslashit( '95' ) ); 17 27 } 18 28 29 /** 30 * @covers ::untrailingslashit 31 */ 19 32 function test_removes_trailing_slashes() { 20 33 $this->assertSame( 'a', untrailingslashit( 'a/' ) ); 21 34 $this->assertSame( 'a', untrailingslashit( 'a////' ) ); … … 23 36 24 37 /** 25 38 * @ticket 22267 39 * 40 * @covers ::untrailingslashit 26 41 */ 27 42 function test_removes_trailing_backslashes() { 28 43 $this->assertSame( 'a', untrailingslashit( 'a\\' ) ); … … 31 46 32 47 /** 33 48 * @ticket 22267 49 * 50 * @covers ::untrailingslashit 34 51 */ 35 52 function test_removes_trailing_mixed_slashes() { 36 53 $this->assertSame( 'a', untrailingslashit( 'a/\\' ) ); … … 37 54 $this->assertSame( 'a', untrailingslashit( 'a\\/\\///\\\\//' ) ); 38 55 } 39 56 57 /** 58 * @covers ::trailingslashit 59 */ 40 60 function test_adds_trailing_slash() { 41 61 $this->assertSame( 'a/', trailingslashit( 'a' ) ); 42 62 } 43 63 64 /** 65 * @covers ::trailingslashit 66 */ 44 67 function test_does_not_add_trailing_slash_if_one_exists() { 45 68 $this->assertSame( 'a/', trailingslashit( 'a/' ) ); 46 69 } … … 47 70 48 71 /** 49 72 * @ticket 22267 73 * 74 * @covers ::trailingslashit 50 75 */ 51 76 function test_converts_trailing_backslash_to_slash_if_one_exists() { 52 77 $this->assertSame( 'a/', trailingslashit( 'a\\' ) ); -
tests/phpunit/tests/formatting/Smilies.php
3 3 /** 4 4 * @group formatting 5 5 * @group emoji 6 * 7 * @covers ::convert_smilies 6 8 */ 7 9 class Tests_Formatting_Smilies extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/StripSlashesDeep.php
3 3 /** 4 4 * @group formatting 5 5 * @group slashes 6 * 7 * @covers ::stripslashes_deep 6 8 */ 7 9 class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase { 8 10 /** -
tests/phpunit/tests/formatting/UrlencodeDeep.php
3 3 /** 4 4 * @group formatting 5 5 * @ticket 22300 6 * 7 * @covers ::urlencode_deep 6 8 */ 7 9 class Tests_Formatting_UrlencodeDeep extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/URLShorten.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::url_shorten 5 7 */ 6 8 class Tests_Formatting_URLShorten extends WP_UnitTestCase { 9 7 10 function test_shorten_url() { 8 11 $tests = array( 9 12 'wordpress\.org/about/philosophy' => 'wordpress\.org/about/philosophy', // No longer strips slashes. -
tests/phpunit/tests/formatting/Utf8UriEncode.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::utf8_uri_encode 5 7 */ 6 8 class Tests_Formatting_Utf8UriEncode extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/WPBasename.php
1 1 <?php 2 2 3 3 /** 4 * @group formatting 4 * @group formatting * @covers ::wp_basename 5 5 */ 6 6 class Tests_Formatting_WP_Basename extends WP_UnitTestCase { 7 7 … … 31 31 32 32 /** 33 33 * @ticket 22138 34 * 35 * @covers ::wp_basename 34 36 */ 35 37 function test_wp_basename_windows_utf8_support() { 36 38 $this->assertSame( -
tests/phpunit/tests/formatting/WpHtmlEditPre.php
3 3 /** 4 4 * @group formatting 5 5 * @expectedDeprecated wp_htmledit_pre 6 * 7 * @covers ::wp_htmledit_pre 6 8 */ 7 9 class Tests_Formatting_WpHtmlEditPre extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/WpHtmlSplit.php
9 9 * Basic functionality goes here. 10 10 * 11 11 * @dataProvider data_basic_features 12 * 13 * @covers ::wp_html_split 12 14 */ 13 15 function test_basic_features( $input, $output ) { 14 16 return $this->assertSame( $output, wp_html_split( $input ) ); … … 39 41 * Automated performance testing of the main regex. 40 42 * 41 43 * @dataProvider data_whole_posts 44 * 45 * @covers ::preg_split 42 46 */ 43 47 function test_pcre_performance( $input ) { 44 48 $regex = get_html_split_regex(); -
tests/phpunit/tests/formatting/WPMakeLinkRelative.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_make_link_relative 5 7 */ 6 8 class Tests_Formatting_WPMakeLinkRelative extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/WPRelNoFollow.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_rel_nofollow 5 7 */ 6 8 class Tests_Rel_No_Follow extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/WPRelUgc.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_rel_ugc 5 7 */ 6 8 class Tests_Rel_Ugc extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/WpReplaceInHtmlTags.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_replace_in_html_tags 5 7 */ 6 8 class Tests_Formatting_WpReplaceInTags extends WP_UnitTestCase { 7 9 /** -
tests/phpunit/tests/formatting/WpRichEditPre.php
3 3 /** 4 4 * @group formatting 5 5 * @expectedDeprecated wp_richedit_pre 6 * 7 * @covers ::wp_richedit_pre 6 8 */ 7 9 class Tests_Formatting_WpRichEditPre extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/WPSlash.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_slash 5 7 */ 6 8 class Tests_Formatting_WPSlash extends WP_UnitTestCase { 7 9 -
tests/phpunit/tests/formatting/WPSpecialchars.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::_wp_specialchars 5 7 */ 6 8 class Tests_Formatting_WPSpecialchars extends WP_UnitTestCase { 9 7 10 function test_wp_specialchars_basics() { 8 11 $html = '&<hello world>'; 9 12 $this->assertSame( $html, _wp_specialchars( $html ) ); -
tests/phpunit/tests/formatting/WPStripAllTags.php
3 3 * Test wp_strip_all_tags() 4 4 * 5 5 * @group formatting 6 * 7 * @covers ::wp_strip_all_tags 6 8 */ 7 9 class Tests_Formatting_WPStripAllTags extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/WPTargetedLinkRel.php
3 3 /** 4 4 * @group formatting 5 5 * @ticket 43187 6 * 7 * @covers ::wp_targeted_link_rel 6 8 */ 7 9 class Tests_Targeted_Link_Rel extends WP_UnitTestCase { 8 10 -
tests/phpunit/tests/formatting/WPTexturize.php
4 4 * @group formatting 5 5 */ 6 6 class Tests_Formatting_WPTexturize extends WP_UnitTestCase { 7 8 /** 9 * @covers ::wptexturize 10 */ 7 11 function test_dashes() { 8 12 $this->assertSame( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) ); 9 13 $this->assertSame( '<a href="http://xx--xx">Hey — boo?</a>', wptexturize( '<a href="http://xx--xx">Hey -- boo?</a>' ) ); 10 14 } 11 15 16 /** 17 * @covers ::wptexturize 18 */ 12 19 function test_disable() { 13 20 $this->assertSame( '<pre>---&</pre>', wptexturize( '<pre>---&</pre>' ) ); 14 21 $this->assertSame( '<pre><code></code>--&</pre>', wptexturize( '<pre><code></code>--&</pre>' ) ); … … 34 41 35 42 /** 36 43 * @ticket 1418 44 * 45 * @covers ::wptexturize 37 46 */ 38 47 function test_bracketed_quotes_1418() { 39 48 $this->assertSame( '(“test”)', wptexturize( '("test")' ) ); … … 43 52 44 53 /** 45 54 * @ticket 3810 55 * 56 * @covers ::wptexturize 46 57 */ 47 58 function test_bracketed_quotes_3810() { 48 59 $this->assertSame( 'A dog (“Hubertus”) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) ); … … 50 61 51 62 /** 52 63 * @ticket 4539 64 * 65 * @covers ::wptexturize 53 66 */ 54 67 function test_basic_quotes() { 55 68 $this->assertSame( 'test’s', wptexturize( 'test\'s' ) ); … … 73 86 /** 74 87 * @ticket 4539 75 88 * @ticket 15241 89 * 90 * @covers ::wptexturize 76 91 */ 77 92 function test_full_sentences_with_unmatched_single_quotes() { 78 93 $this->assertSame( … … 83 98 84 99 /** 85 100 * @ticket 4539 101 * 102 * @covers ::wptexturize 86 103 */ 87 104 function test_quotes() { 88 105 $this->assertSame( '“Quoted String”', wptexturize( '"Quoted String"' ) ); … … 102 119 103 120 /** 104 121 * @ticket 4539 122 * 123 * @covers ::wptexturize 105 124 */ 106 125 function test_quotes_before_s() { 107 126 $this->assertSame( 'test’s', wptexturize( "test's" ) ); … … 113 132 114 133 /** 115 134 * @ticket 4539 135 * 136 * @covers ::wptexturize 116 137 */ 117 138 function test_quotes_before_numbers() { 118 139 $this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) ); … … 141 162 $this->assertSame( '}”Class of ’99″{', wptexturize( "}\"Class of '99\"{" ) ); 142 163 } 143 164 165 /** 166 * @covers ::wptexturize 167 */ 144 168 function test_quotes_after_numbers() { 145 169 $this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) ); 146 170 } … … 148 172 /** 149 173 * @ticket 4539 150 174 * @ticket 15241 175 * 176 * @covers ::wptexturize 151 177 */ 152 178 function test_other_html() { 153 179 $this->assertSame( '‘<strong>', wptexturize( "'<strong>" ) ); … … 155 181 // $this->assertSame( '“<strong>Quoted Text</strong>”,', wptexturize( '"<strong>Quoted Text</strong>",' ) ); 156 182 } 157 183 184 /** 185 * @covers ::wptexturize 186 */ 158 187 function test_x() { 159 188 $this->assertSame( '14×24', wptexturize( '14x24' ) ); 160 189 } 161 190 191 /** 192 * @covers ::wptexturize 193 */ 162 194 function test_minutes_seconds() { 163 195 $this->assertSame( '9′', wptexturize( '9\'' ) ); 164 196 $this->assertSame( '9″', wptexturize( '9"' ) ); … … 172 204 173 205 /** 174 206 * @ticket 8775 207 * 208 * @covers ::wptexturize 175 209 */ 176 210 function test_wptexturize_quotes_around_numbers() { 177 211 $this->assertSame( '“12345”', wptexturize( '"12345"' ) ); … … 182 216 183 217 /** 184 218 * @ticket 8912 219 * 220 * @covers ::wptexturize 185 221 */ 186 222 function test_wptexturize_html_comments() { 187 223 $this->assertSame( '<!--[if !IE]>--><!--<![endif]-->', wptexturize( '<!--[if !IE]>--><!--<![endif]-->' ) ); … … 192 228 /** 193 229 * @ticket 4539 194 230 * @ticket 15241 231 * 232 * @covers ::wptexturize 195 233 */ 196 234 function test_entity_quote_cuddling() { 197 235 $this->assertSame( ' “Testing”', wptexturize( ' "Testing"' ) ); … … 200 238 201 239 /** 202 240 * @ticket 22823 241 * 242 * @covers ::wptexturize 203 243 */ 204 244 function test_apostrophes_before_primes() { 205 245 $this->assertSame( 'WordPress 3.5’s release date', wptexturize( "WordPress 3.5's release date" ) ); … … 207 247 208 248 /** 209 249 * @ticket 23185 250 * 251 * @covers ::wptexturize 210 252 */ 211 253 function test_spaces_around_hyphens() { 212 254 $nbsp = "\xC2\xA0"; … … 230 272 231 273 /** 232 274 * @ticket 31030 275 * 276 * @covers ::wptexturize 233 277 */ 234 278 function test_hyphens_at_start_and_end() { 235 279 $this->assertSame( '– ', wptexturize( '- ' ) ); … … 247 291 * These should never happen, even if the desired output changes some day. 248 292 * 249 293 * @ticket 22692 294 * 295 * @covers ::wptexturize 250 296 */ 251 297 function test_spaces_around_quotes_never() { 252 298 $nbsp = "\xC2\xA0"; … … 264 310 * 265 311 * @ticket 22692 266 312 * @dataProvider data_spaces_around_quotes 313 * 314 * @covers ::wptexturize 267 315 */ 268 316 function test_spaces_around_quotes( $input, $output ) { 269 317 return $this->assertSame( $output, wptexturize( $input ) ); … … 320 368 * 321 369 * @ticket 22692 322 370 * @dataProvider data_apos_before_digits 371 * 372 * @covers ::wptexturize 323 373 */ 324 374 function test_apos_before_digits( $input, $output ) { 325 375 return $this->assertSame( $output, wptexturize( $input ) ); … … 361 411 * 362 412 * @ticket 22692 363 413 * @dataProvider data_opening_single_quote 414 * 415 * @covers ::wptexturize 364 416 */ 365 417 function test_opening_single_quote( $input, $output ) { 366 418 return $this->assertSame( $output, wptexturize( $input ) ); … … 490 542 * 491 543 * @ticket 22692 492 544 * @dataProvider data_double_prime 545 * 546 * @covers ::wptexturize 493 547 */ 494 548 function test_double_prime( $input, $output ) { 495 549 return $this->assertSame( $output, wptexturize( $input ) ); … … 523 577 * 524 578 * @ticket 22692 525 579 * @dataProvider data_single_prime 580 * 581 * @covers ::wptexturize 526 582 */ 527 583 function test_single_prime( $input, $output ) { 528 584 return $this->assertSame( $output, wptexturize( $input ) ); … … 556 612 * 557 613 * @ticket 22692 558 614 * @dataProvider data_contractions 615 * 616 * @covers ::wptexturize 559 617 */ 560 618 function test_contractions( $input, $output ) { 561 619 return $this->assertSame( $output, wptexturize( $input ) ); … … 597 655 * 598 656 * @ticket 22692 599 657 * @dataProvider data_opening_quote 658 * 659 * @covers ::wptexturize 600 660 */ 601 661 function test_opening_quote( $input, $output ) { 602 662 return $this->assertSame( $output, wptexturize( $input ) ); … … 674 734 * 675 735 * @ticket 22692 676 736 * @dataProvider data_closing_quote 737 * 738 * @covers ::wptexturize 677 739 */ 678 740 function test_closing_quote( $input, $output ) { 679 741 return $this->assertSame( $output, wptexturize( $input ) ); … … 763 825 * 764 826 * @ticket 22692 765 827 * @dataProvider data_closing_single_quote 828 * 829 * @covers ::wptexturize 766 830 */ 767 831 function test_closing_single_quote( $input, $output ) { 768 832 return $this->assertSame( $output, wptexturize( $input ) ); … … 853 917 * @ticket 22692 854 918 * @ticket 30445 855 919 * @dataProvider data_multiplication 920 * 921 * @covers ::wptexturize 856 922 */ 857 923 function test_multiplication( $input, $output ) { 858 924 return $this->assertSame( $output, wptexturize( $input ) ); … … 903 969 * 904 970 * @ticket 22692 905 971 * @dataProvider data_ampersand 972 * 973 * @covers ::wptexturize 906 974 */ 907 975 function test_ampersand( $input, $output ) { 908 976 return $this->assertSame( $output, wptexturize( $input ) ); … … 968 1036 * 969 1037 * @ticket 22692 970 1038 * @dataProvider data_cockney 1039 * 1040 * @covers ::wptexturize 971 1041 */ 972 1042 function test_cockney( $input, $output ) { 973 1043 return $this->assertSame( $output, wptexturize( $input ) ); … … 1029 1099 * 1030 1100 * @ticket 22692 1031 1101 * @dataProvider data_smart_dashes 1102 * 1103 * @covers ::wptexturize 1032 1104 */ 1033 1105 function test_smart_dashes( $input, $output ) { 1034 1106 return $this->assertSame( $output, wptexturize( $input ) ); … … 1082 1154 * 1083 1155 * @ticket 22692 1084 1156 * @dataProvider data_misc_static_replacements 1157 * 1158 * @covers ::wptexturize 1085 1159 */ 1086 1160 function test_misc_static_replacements( $input, $output ) { 1087 1161 return $this->assertSame( $output, wptexturize( $input ) ); … … 1137 1211 * 1138 1212 * @ticket 8775 1139 1213 * @dataProvider data_quoted_numbers 1214 * 1215 * @covers ::wptexturize 1140 1216 */ 1141 1217 function test_quoted_numbers( $input, $output ) { 1142 1218 return $this->assertSame( $output, wptexturize( $input ) ); … … 1188 1264 * 1189 1265 * @ticket 20342 1190 1266 * @dataProvider data_quotes_and_dashes 1267 * 1268 * @covers ::wptexturize 1191 1269 */ 1192 1270 function test_quotes_and_dashes( $input, $output ) { 1193 1271 return $this->assertSame( $output, wptexturize( $input ) ); … … 1251 1329 * 1252 1330 * @ticket 12690 1253 1331 * @dataProvider data_tag_avoidance 1332 * 1333 * @covers ::wptexturize 1254 1334 */ 1255 1335 function test_tag_avoidance( $input, $output ) { 1256 1336 return $this->assertSame( $output, wptexturize( $input ) ); … … 1474 1554 * 1475 1555 * @ticket 26850 1476 1556 * @dataProvider data_year_abbr 1557 * 1558 * @covers ::wptexturize 1477 1559 */ 1478 1560 function test_year_abbr( $input, $output ) { 1479 1561 return $this->assertSame( $output, wptexturize( $input ) ); … … 1563 1645 * 1564 1646 * @ticket 27426 1565 1647 * @dataProvider data_translate 1648 * 1649 * @covers ::wptexturize 1566 1650 */ 1567 1651 function test_translate( $input, $output ) { 1568 1652 add_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 ); … … 1790 1874 * 1791 1875 * @ticket 28483 1792 1876 * @dataProvider data_element_stack 1877 * 1878 * @covers ::wptexturize 1793 1879 */ 1794 1880 function test_element_stack( $input, $output ) { 1795 1881 return $this->assertSame( $output, wptexturize( $input ) ); … … 1841 1927 * 1842 1928 * @ticket 29557 1843 1929 * @dataProvider data_unregistered_shortcodes 1930 * 1931 * @covers ::wptexturize 1844 1932 */ 1845 1933 function test_unregistered_shortcodes( $input, $output ) { 1846 1934 add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 ); … … 1926 2014 * 1927 2015 * @ticket 29256 1928 2016 * @dataProvider data_primes_vs_quotes 2017 * 2018 * @covers ::wptexturize 1929 2019 */ 1930 2020 function test_primes_vs_quotes( $input, $output ) { 1931 2021 return $this->assertSame( $output, wptexturize( $input ) ); … … 1988 2078 * 1989 2079 * @ticket 29256 1990 2080 * @dataProvider data_primes_quotes_translation 2081 * 2082 * @covers ::wptexturize 1991 2083 */ 1992 2084 function test_primes_quotes_translation( $input, $output ) { 1993 2085 add_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 ); … … 2081 2173 * Automated performance testing of the main regex. 2082 2174 * 2083 2175 * @dataProvider data_whole_posts 2176 * 2177 * @covers ::preg_split 2084 2178 */ 2085 2179 function test_pcre_performance( $input ) { 2086 2180 global $shortcode_tags; … … 2101 2195 * Ensure that a trailing less-than symbol doesn't cause a PHP warning. 2102 2196 * 2103 2197 * @ticket 35864 2198 * 2199 * @covers ::wptexturize 2104 2200 */ 2105 2201 function test_trailing_less_than() { 2106 2202 $this->assertSame( 'F–oo<', wptexturize( 'F--oo<', true ) ); -
tests/phpunit/tests/formatting/WpTrimExcerpt.php
2 2 3 3 /** 4 4 * @group formatting 5 * 5 6 * @covers ::wp_trim_excerpt 6 7 */ 7 8 class Tests_Formatting_WpTrimExcerpt extends WP_UnitTestCase { -
tests/phpunit/tests/formatting/WPTrimWords.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::wp_trim_words 5 7 */ 6 8 class Tests_Formatting_WPTrimWords extends WP_UnitTestCase { 7 9 … … 35 37 $this->assertSame( $trimmed, wp_trim_words( $text, 5 ) ); 36 38 } 37 39 38 /**39 * @ticket 1872640 */41 40 function test_strips_script_and_style_content() { 42 41 $trimmed = 'This text contains. It should go.'; 43 42 -
tests/phpunit/tests/formatting/Zeroise.php
2 2 3 3 /** 4 4 * @group formatting 5 * 6 * @covers ::zeroise 5 7 */ 6 8 class Tests_Formatting_Zeroise extends WP_UnitTestCase { 9 7 10 function test_pads_with_leading_zeroes() { 8 11 $this->assertSame( '00005', zeroise( 5, 5 ) ); 9 12 }