Tests: Move some @covers tags in the formatting group to the class DocBlock.

This aims to bring more consistency, as these test classes typically cover a single function, unless noted otherwise.

Follow-up to [53562], [53571], [54051].

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@54728 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-10-31 13:54:00 +00:00
parent 8fd6b038ac
commit 18f244c440
9 changed files with 13 additions and 135 deletions

View File

@ -2,13 +2,13 @@
/**
* @group formatting
*
* @covers ::esc_url
*/
class Tests_Formatting_EscUrl extends WP_UnitTestCase {
/**
* @ticket 23605
*
* @covers ::esc_url
*/
public function test_spaces() {
$this->assertSame( 'http://example.com/Mr%20WordPress', esc_url( 'http://example.com/Mr WordPress' ) );
@ -21,9 +21,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
$this->assertSame( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one%20two%20three&bar=four' ) );
}
/**
* @covers ::esc_url
*/
public function test_bad_characters() {
$this->assertSame( 'http://example.com/watchthelinefeedgo', esc_url( 'http://example.com/watchthelinefeed%0Ago' ) );
$this->assertSame( 'http://example.com/watchthelinefeedgo', esc_url( 'http://example.com/watchthelinefeed%0ago' ) );
@ -38,9 +35,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
$this->assertSame( 'http://example.com/', esc_url( 'http://example.com/%0%0%0ADa' ) );
}
/**
* @covers ::esc_url
*/
public function test_relative() {
$this->assertSame( '/example.php', esc_url( '/example.php' ) );
$this->assertSame( 'example.php', esc_url( 'example.php' ) );
@ -49,7 +43,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
}
/**
* @covers ::esc_url
* @covers ::sanitize_url
*/
public function test_all_url_parts() {
@ -72,9 +65,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
$this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', esc_url( $url ) );
}
/**
* @covers ::esc_url
*/
public function test_bare() {
$this->assertSame( 'http://example.com?foo', esc_url( 'example.com?foo' ) );
$this->assertSame( 'http://example.com', esc_url( 'example.com' ) );
@ -84,7 +74,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
}
/**
* @covers ::esc_url
* @covers ::sanitize_url
*/
public function test_encoding() {
@ -101,7 +90,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
}
/**
* @covers ::esc_url
* @covers ::wp_allowed_protocols
*/
public function test_protocol() {
@ -168,34 +156,23 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
/**
* @ticket 23187
*
* @covers ::esc_url
*/
public function test_protocol_case() {
$this->assertSame( 'http://example.com', esc_url( 'HTTP://example.com' ) );
$this->assertSame( 'http://example.com', esc_url( 'Http://example.com' ) );
}
/**
* @covers ::esc_url
*/
public function test_display_extras() {
$this->assertSame( 'http://example.com/'quoted'', esc_url( 'http://example.com/\'quoted\'' ) );
$this->assertSame( 'http://example.com/\'quoted\'', esc_url( 'http://example.com/\'quoted\'', null, 'notdisplay' ) );
}
/**
* @covers ::esc_url
*/
public function test_non_ascii() {
$this->assertSame( 'http://example.org/баба', esc_url( 'http://example.org/баба' ) );
$this->assertSame( 'http://баба.org/баба', esc_url( 'http://баба.org/баба' ) );
$this->assertSame( 'http://müller.com/', esc_url( 'http://müller.com/' ) );
}
/**
* @covers ::esc_url
*/
public function test_feed() {
$this->assertSame( '', esc_url( 'feed:javascript:alert(1)' ) );
$this->assertSame( '', esc_url( 'feed:javascript:feed:alert(1)' ) );
@ -206,8 +183,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
/**
* @ticket 16859
*
* @covers ::esc_url
*/
public function test_square_brackets() {
$this->assertSame( '/example.php?one%5B%5D=two', esc_url( '/example.php?one[]=two' ) );
@ -233,8 +208,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
/**
* @ticket 21974
*
* @covers ::esc_url
*/
public function test_protocol_relative_with_colon() {
$this->assertSame( '//example.com/foo?foo=abc:def', esc_url( '//example.com/foo?foo=abc:def' ) );
@ -242,8 +215,6 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
/**
* @ticket 31632
*
* @covers ::esc_url
*/
public function test_mailto_with_newline() {
$body = <<<EOT
@ -259,8 +230,6 @@ EOT;
/**
* @ticket 31632
*
* @covers ::esc_url
*/
public function test_mailto_in_http_url_with_newline() {
$body = <<<EOT
@ -276,8 +245,6 @@ EOT;
/**
* @ticket 23605
*
* @covers ::esc_url
*/
public function test_mailto_with_spaces() {
$body = 'Hi there, I thought you might want to sign up for this newsletter';
@ -298,8 +265,6 @@ EOT;
/**
* @ticket 34202
*
* @covers ::esc_url
*/
public function test_ipv6_hosts() {
$this->assertSame( '//[::127.0.0.1]', esc_url( '//[::127.0.0.1]' ) );

View File

@ -3,6 +3,8 @@
/**
* @group formatting
* @ticket 46133
*
* @covers ::excerpt_remove_blocks
*/
class Tests_Formatting_ExcerptRemoveBlocks extends WP_UnitTestCase {
@ -90,8 +92,6 @@ class Tests_Formatting_ExcerptRemoveBlocks extends WP_UnitTestCase {
* Tests excerpt_remove_blocks().
*
* @ticket 46133
*
* @covers ::excerpt_remove_blocks
*/
public function test_excerpt_remove_blocks() {
// Simple dynamic block..

View File

@ -37,6 +37,7 @@ class Tests_Formatting_GetBloginfo extends WP_UnitTestCase {
/**
* @ticket 27942
*
* @covers ::sanitize_option
*/
public function test_bloginfo_sanitize_option() {

View File

@ -2,6 +2,7 @@
/**
* @group formatting
*
* @covers ::sanitize_key
*/
class Tests_Formatting_SanitizeKey extends WP_UnitTestCase {

View File

@ -3,6 +3,7 @@
* @group formatting
* @group post
*
* @covers ::sanitize_post
* @covers WP_Post::__construct
*/
class Tests_Formatting_SanitizePost extends WP_UnitTestCase {

View File

@ -2,7 +2,7 @@
/**
* @group formatting
*
* @covers ::wp_basename
*/
class Tests_Formatting_wpBasename extends WP_UnitTestCase {

View File

@ -2,6 +2,8 @@
/**
* @group formatting
*
* @covers ::wp_html_split
*/
class Tests_Formatting_wpHtmlSplit extends WP_UnitTestCase {
@ -9,8 +11,6 @@ class Tests_Formatting_wpHtmlSplit extends WP_UnitTestCase {
* Basic functionality goes here.
*
* @dataProvider data_basic_features
*
* @covers ::wp_html_split
*/
public function test_basic_features( $input, $output ) {
return $this->assertSame( $output, wp_html_split( $input ) );

View File

@ -2,6 +2,7 @@
/**
* @group formatting
*
* @covers ::wp_parse_str
*/
class Tests_Formatting_wpParseStr extends WP_UnitTestCase {

View File

@ -2,20 +2,16 @@
/**
* @group formatting
*
* @covers ::wptexturize
*/
class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @covers ::wptexturize
*/
public function test_dashes() {
$this->assertSame( 'Hey &#8212; boo?', wptexturize( 'Hey -- boo?' ) );
$this->assertSame( '<a href="http://xx--xx">Hey &#8212; boo?</a>', wptexturize( '<a href="http://xx--xx">Hey -- boo?</a>' ) );
}
/**
* @covers ::wptexturize
*/
public function test_disable() {
$this->assertSame( '<pre>---&</pre>', wptexturize( '<pre>---&</pre>' ) );
$this->assertSame( '<pre><code></code>--&</pre>', wptexturize( '<pre><code></code>--&</pre>' ) );
@ -41,8 +37,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 1418
*
* @covers ::wptexturize
*/
public function test_bracketed_quotes_1418() {
$this->assertSame( '(&#8220;test&#8221;)', wptexturize( '("test")' ) );
@ -52,8 +46,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 3810
*
* @covers ::wptexturize
*/
public function test_bracketed_quotes_3810() {
$this->assertSame( 'A dog (&#8220;Hubertus&#8221;) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) );
@ -61,8 +53,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 4539
*
* @covers ::wptexturize
*/
public function test_basic_quotes() {
$this->assertSame( 'test&#8217;s', wptexturize( 'test\'s' ) );
@ -86,8 +76,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 4539
* @ticket 15241
*
* @covers ::wptexturize
*/
public function test_full_sentences_with_unmatched_single_quotes() {
$this->assertSame(
@ -98,8 +86,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 4539
*
* @covers ::wptexturize
*/
public function test_quotes() {
$this->assertSame( '&#8220;Quoted String&#8221;', wptexturize( '"Quoted String"' ) );
@ -119,8 +105,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 4539
*
* @covers ::wptexturize
*/
public function test_quotes_before_s() {
$this->assertSame( 'test&#8217;s', wptexturize( "test's" ) );
@ -132,8 +116,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 4539
*
* @covers ::wptexturize
*/
public function test_quotes_before_numbers() {
$this->assertSame( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
@ -162,9 +144,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
$this->assertSame( '}&#8221;Class of &#8217;99&#8243;{', wptexturize( "}\"Class of '99\"{" ) );
}
/**
* @covers ::wptexturize
*/
public function test_quotes_after_numbers() {
$this->assertSame( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
}
@ -172,8 +151,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 4539
* @ticket 15241
*
* @covers ::wptexturize
*/
public function test_other_html() {
$this->assertSame( '&#8216;<strong>', wptexturize( "'<strong>" ) );
@ -181,16 +158,10 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
// $this->assertSame( '&#8220;<strong>Quoted Text</strong>&#8221;,', wptexturize( '"<strong>Quoted Text</strong>",' ) );
}
/**
* @covers ::wptexturize
*/
public function test_x() {
$this->assertSame( '14&#215;24', wptexturize( '14x24' ) );
}
/**
* @covers ::wptexturize
*/
public function test_minutes_seconds() {
$this->assertSame( '9&#8242;', wptexturize( '9\'' ) );
$this->assertSame( '9&#8243;', wptexturize( '9"' ) );
@ -204,8 +175,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 8775
*
* @covers ::wptexturize
*/
public function test_wptexturize_quotes_around_numbers() {
$this->assertSame( '&#8220;12345&#8221;', wptexturize( '"12345"' ) );
@ -216,8 +185,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 8912
*
* @covers ::wptexturize
*/
public function test_wptexturize_html_comments() {
$this->assertSame( '<!--[if !IE]>--><!--<![endif]-->', wptexturize( '<!--[if !IE]>--><!--<![endif]-->' ) );
@ -228,8 +195,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 4539
* @ticket 15241
*
* @covers ::wptexturize
*/
public function test_entity_quote_cuddling() {
$this->assertSame( '&nbsp;&#8220;Testing&#8221;', wptexturize( '&nbsp;"Testing"' ) );
@ -238,8 +203,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 22823
*
* @covers ::wptexturize
*/
public function test_apostrophes_before_primes() {
$this->assertSame( 'WordPress 3.5&#8217;s release date', wptexturize( "WordPress 3.5's release date" ) );
@ -247,8 +210,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 23185
*
* @covers ::wptexturize
*/
public function test_spaces_around_hyphens() {
$nbsp = "\xC2\xA0";
@ -272,8 +233,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
/**
* @ticket 31030
*
* @covers ::wptexturize
*/
public function test_hyphens_at_start_and_end() {
$this->assertSame( '&#8211; ', wptexturize( '- ' ) );
@ -291,8 +250,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
* These should never happen, even if the desired output changes some day.
*
* @ticket 22692
*
* @covers ::wptexturize
*/
public function test_spaces_around_quotes_never() {
$nbsp = "\xC2\xA0";
@ -310,8 +267,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_spaces_around_quotes
*
* @covers ::wptexturize
*/
public function test_spaces_around_quotes( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -368,8 +323,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_apos_before_digits
*
* @covers ::wptexturize
*/
public function test_apos_before_digits( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -411,8 +364,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_opening_single_quote
*
* @covers ::wptexturize
*/
public function test_opening_single_quote( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -542,8 +493,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_double_prime
*
* @covers ::wptexturize
*/
public function test_double_prime( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -577,8 +526,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_single_prime
*
* @covers ::wptexturize
*/
public function test_single_prime( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -612,8 +559,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_contractions
*
* @covers ::wptexturize
*/
public function test_contractions( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -655,8 +600,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_opening_quote
*
* @covers ::wptexturize
*/
public function test_opening_quote( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -734,8 +677,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_closing_quote
*
* @covers ::wptexturize
*/
public function test_closing_quote( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -825,8 +766,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_closing_single_quote
*
* @covers ::wptexturize
*/
public function test_closing_single_quote( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -917,8 +856,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
* @ticket 22692
* @ticket 30445
* @dataProvider data_multiplication
*
* @covers ::wptexturize
*/
public function test_multiplication( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -969,8 +906,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_ampersand
*
* @covers ::wptexturize
*/
public function test_ampersand( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1036,8 +971,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_cockney
*
* @covers ::wptexturize
*/
public function test_cockney( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1099,8 +1032,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_smart_dashes
*
* @covers ::wptexturize
*/
public function test_smart_dashes( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1154,8 +1085,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 22692
* @dataProvider data_misc_static_replacements
*
* @covers ::wptexturize
*/
public function test_misc_static_replacements( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1211,8 +1140,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 8775
* @dataProvider data_quoted_numbers
*
* @covers ::wptexturize
*/
public function test_quoted_numbers( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1264,8 +1191,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 20342
* @dataProvider data_quotes_and_dashes
*
* @covers ::wptexturize
*/
public function test_quotes_and_dashes( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1329,8 +1254,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 12690
* @dataProvider data_tag_avoidance
*
* @covers ::wptexturize
*/
public function test_tag_avoidance( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1554,8 +1477,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 26850
* @dataProvider data_year_abbr
*
* @covers ::wptexturize
*/
public function test_year_abbr( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1645,8 +1566,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 27426
* @dataProvider data_translate
*
* @covers ::wptexturize
*/
public function test_translate( $input, $output ) {
add_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
@ -1874,8 +1793,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 28483
* @dataProvider data_element_stack
*
* @covers ::wptexturize
*/
public function test_element_stack( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -1927,8 +1844,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 29557
* @dataProvider data_unregistered_shortcodes
*
* @covers ::wptexturize
*/
public function test_unregistered_shortcodes( $input, $output ) {
add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
@ -2014,8 +1929,6 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
*
* @ticket 29256
* @dataProvider data_primes_vs_quotes
*
* @covers ::wptexturize
*/
public function test_primes_vs_quotes( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
@ -2078,8 +1991,6 @@ String with a number followed by a single quote &#8216;Expendables 3&#8217; vest
*
* @ticket 29256
* @dataProvider data_primes_quotes_translation
*
* @covers ::wptexturize
*/
public function test_primes_quotes_translation( $input, $output ) {
add_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 );
@ -2196,8 +2107,6 @@ String with a number followed by a single quote !q1!Expendables 3!q1! vestibulum
* Ensure that a trailing less-than symbol doesn't cause a PHP warning.
*
* @ticket 35864
*
* @covers ::wptexturize
*/
public function test_trailing_less_than() {
$this->assertSame( 'F&#8211;oo<', wptexturize( 'F--oo<', true ) );