mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
Build/Test Tools, Formatting group:
- Add and update @covers tags. - Add and improve docs and inline comments. Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev. See #39265. git-svn-id: https://develop.svn.wordpress.org/trunk@53562 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::balanceTags
|
||||
*/
|
||||
class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
|
||||
|
||||
@@ -78,7 +80,7 @@ class Tests_Formatting_BalanceTags extends WP_UnitTestCase {
|
||||
/**
|
||||
* These are valid custom elements but we don't support them yet.
|
||||
*
|
||||
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
||||
* @see https://w3c.github.io/webcomponents/spec/custom/#valid-custom-element-name
|
||||
*/
|
||||
public function unsupported_valid_tag_names() {
|
||||
return array(
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::capital_P_dangit
|
||||
*/
|
||||
class Tests_Formatting_CapitalPDangit extends WP_UnitTestCase {
|
||||
public function test_esc_attr_quotes() {
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*
|
||||
* @group formatting
|
||||
* @expectedDeprecated clean_pre
|
||||
*
|
||||
* @covers ::clean_pre
|
||||
*/
|
||||
class Tests_Formatting_CleanPre extends WP_UnitTestCase {
|
||||
|
||||
@@ -22,10 +24,13 @@ class Tests_Formatting_CleanPre extends WP_UnitTestCase {
|
||||
$this->assertSame( $res, clean_pre( $source ) );
|
||||
}
|
||||
|
||||
// I don't think this can ever happen in production;
|
||||
// <br> is changed to <br /> elsewhere. Left in because
|
||||
// that replacement shouldn't happen (what if you want
|
||||
// HTML 4 output?).
|
||||
|
||||
/**
|
||||
* I don't think this can ever happen in production;
|
||||
* <br> is changed to <br /> elsewhere. Left in because
|
||||
* that replacement shouldn't happen (what if you want
|
||||
* HTML 4 output?).
|
||||
*/
|
||||
public function test_removes_html_br() {
|
||||
$source = 'a b c\n<br>sldfj<br>';
|
||||
$res = 'a b c\nsldfj';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::convert_invalid_entities
|
||||
*/
|
||||
class Tests_Formatting_ConvertInvalidEntities extends WP_UnitTestCase {
|
||||
public function test_replaces_windows1252_entities_with_unicode_ones() {
|
||||
@@ -19,6 +21,9 @@ class Tests_Formatting_ConvertInvalidEntities extends WP_UnitTestCase {
|
||||
$this->assertSame( $output, convert_invalid_entities( $input ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::convert_chars
|
||||
*/
|
||||
public function test_escapes_lone_ampersands() {
|
||||
$this->assertSame( 'at&t', convert_chars( 'at&t' ) );
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @group emoji
|
||||
*
|
||||
* @covers ::convert_smilies
|
||||
*/
|
||||
class Tests_Formatting_ConvertSmilies extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
* Unpatched, this test passes only when Europe/London is not observing DST.
|
||||
*
|
||||
* @ticket 20328
|
||||
*
|
||||
* @covers ::get_date_from_gmt
|
||||
*/
|
||||
public function test_get_date_from_gmt_outside_of_dst() {
|
||||
update_option( 'timezone_string', 'Europe/London' );
|
||||
@@ -22,6 +24,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
* Unpatched, this test passes only when Europe/London is observing DST.
|
||||
*
|
||||
* @ticket 20328
|
||||
*
|
||||
* @covers ::get_date_from_gmt
|
||||
*/
|
||||
public function test_get_date_from_gmt_during_dst() {
|
||||
update_option( 'timezone_string', 'Europe/London' );
|
||||
@@ -32,6 +36,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 20328
|
||||
*
|
||||
* @covers ::get_gmt_from_date
|
||||
*/
|
||||
public function test_get_gmt_from_date_outside_of_dst() {
|
||||
update_option( 'timezone_string', 'Europe/London' );
|
||||
@@ -42,6 +48,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 20328
|
||||
*
|
||||
* @covers ::get_gmt_from_date
|
||||
*/
|
||||
public function test_get_gmt_from_date_during_dst() {
|
||||
update_option( 'timezone_string', 'Europe/London' );
|
||||
@@ -52,6 +60,9 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 34279
|
||||
*
|
||||
* @covers ::get_date_from_gmt
|
||||
*
|
||||
*/
|
||||
public function test_get_date_and_time_from_gmt_no_timezone() {
|
||||
$local = '2012-01-01 12:34:56';
|
||||
@@ -61,6 +72,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 34279
|
||||
*
|
||||
* @covers ::get_gmt_from_date
|
||||
*/
|
||||
public function test_get_gmt_from_date_no_timezone() {
|
||||
$gmt = '2012-12-01 00:00:00';
|
||||
@@ -70,6 +83,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 34279
|
||||
*
|
||||
* @covers ::get_gmt_from_date
|
||||
*/
|
||||
public function test_get_gmt_from_date_short_date() {
|
||||
update_option( 'timezone_string', 'Europe/London' );
|
||||
@@ -80,6 +95,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 34279
|
||||
*
|
||||
* @covers ::get_gmt_from_date
|
||||
*/
|
||||
public function test_get_gmt_from_date_string_date() {
|
||||
update_option( 'timezone_string', 'Europe/London' );
|
||||
@@ -90,6 +107,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 34279
|
||||
*
|
||||
* @covers ::get_gmt_from_date
|
||||
*/
|
||||
public function test_get_gmt_from_date_string_date_no_timezone() {
|
||||
$local = 'now';
|
||||
@@ -101,6 +120,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
* @ticket 31809
|
||||
*
|
||||
* @dataProvider timezone_provider
|
||||
*
|
||||
* @covers ::get_gmt_from_date
|
||||
*/
|
||||
public function test_gmt_from_date_correct_time( $timezone_string, $gmt_offset ) {
|
||||
update_option( 'timezone_string', $timezone_string );
|
||||
@@ -117,6 +138,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
* @ticket 31809
|
||||
*
|
||||
* @dataProvider timezone_provider
|
||||
*
|
||||
* @covers ::get_date_from_gmt
|
||||
*/
|
||||
public function test_date_from_gmt_correct_time( $timezone_string, $gmt_offset ) {
|
||||
update_option( 'timezone_string', $timezone_string );
|
||||
@@ -133,6 +156,8 @@ class Tests_Formatting_Date extends WP_UnitTestCase {
|
||||
* @ticket 31809
|
||||
*
|
||||
* @dataProvider timezone_provider
|
||||
*
|
||||
* @covers ::iso8601_to_datetime
|
||||
*/
|
||||
public function test_is8601_to_datetime_correct_time( $timezone_string, $gmt_offset ) {
|
||||
update_option( 'timezone_string', $timezone_string );
|
||||
|
||||
@@ -11,6 +11,8 @@ class Tests_Formatting_Emoji extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 36525
|
||||
*
|
||||
* @covers ::_print_emoji_detection_script
|
||||
*/
|
||||
public function test_unfiltered_emoji_cdns() {
|
||||
// `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present:
|
||||
@@ -27,6 +29,8 @@ class Tests_Formatting_Emoji extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 36525
|
||||
*
|
||||
* @covers ::_print_emoji_detection_script
|
||||
*/
|
||||
public function test_filtered_emoji_svn_cdn() {
|
||||
$filtered_svn_cdn = $this->_filtered_emoji_svn_cdn();
|
||||
@@ -50,6 +54,8 @@ class Tests_Formatting_Emoji extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 36525
|
||||
*
|
||||
* @covers ::_print_emoji_detection_script
|
||||
*/
|
||||
public function test_filtered_emoji_png_cdn() {
|
||||
$filtered_png_cdn = $this->_filtered_emoji_png_cdn();
|
||||
@@ -69,6 +75,8 @@ class Tests_Formatting_Emoji extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 41501
|
||||
*
|
||||
* @covers ::_wp_emoji_list
|
||||
*/
|
||||
public function test_wp_emoji_list_returns_data() {
|
||||
$default = _wp_emoji_list();
|
||||
@@ -113,6 +121,8 @@ class Tests_Formatting_Emoji extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 35293
|
||||
* @dataProvider data_wp_encode_emoji
|
||||
*
|
||||
* @covers ::wp_encode_emoji
|
||||
*/
|
||||
public function test_wp_encode_emoji( $emoji, $expected ) {
|
||||
$this->assertSame( $expected, wp_encode_emoji( $emoji ) );
|
||||
@@ -148,6 +158,8 @@ class Tests_Formatting_Emoji extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 35293
|
||||
* @dataProvider data_wp_staticize_emoji
|
||||
*
|
||||
* @covers ::wp_staticize_emoji
|
||||
*/
|
||||
public function test_wp_staticize_emoji( $emoji, $expected ) {
|
||||
$this->assertSame( $expected, wp_staticize_emoji( $emoji ) );
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::ent2ncr
|
||||
*/
|
||||
class Tests_Formatting_Ent2ncr extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::esc_attr
|
||||
*/
|
||||
class Tests_Formatting_EscAttr extends WP_UnitTestCase {
|
||||
public function test_esc_attr_quotes() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::esc_html
|
||||
*/
|
||||
class Tests_Formatting_EscHtml extends WP_UnitTestCase {
|
||||
public function test_esc_html_basics() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::esc_js
|
||||
*/
|
||||
class Tests_Formatting_EscJs extends WP_UnitTestCase {
|
||||
public function test_js_escape_simple() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::esc_textarea
|
||||
*/
|
||||
class Tests_Formatting_EscTextarea extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ 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' ) );
|
||||
@@ -19,6 +21,9 @@ 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' ) );
|
||||
@@ -33,6 +38,9 @@ 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' ) );
|
||||
@@ -40,6 +48,10 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
|
||||
$this->assertSame( '?foo=bar', esc_url( '?foo=bar' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::esc_url
|
||||
* @covers ::esc_url_raw
|
||||
*/
|
||||
public function test_all_url_parts() {
|
||||
$url = 'https://user:pass@host.example.com:1234/path;p=1?query=2&r[]=3#fragment';
|
||||
|
||||
@@ -56,10 +68,13 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
|
||||
),
|
||||
parse_url( $url )
|
||||
);
|
||||
$this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', sanitize_url( $url ) );
|
||||
$this->assertSame( 'https://user:pass@host.example.com:1234/path;p=1?query=2&r%5B%5D=3#fragment', esc_url_raw( $url ) );
|
||||
$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' ) );
|
||||
@@ -68,10 +83,14 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
|
||||
$this->assertSame( 'http://баба.org/баба', esc_url( 'баба.org/баба' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::esc_url
|
||||
* @covers ::esc_url_raw
|
||||
*/
|
||||
public function test_encoding() {
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) );
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) );
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', sanitize_url( 'http://example.com?foo=1&bar=2' ) );
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) );
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) );
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', esc_url_raw( 'http://example.com?foo=1&bar=2' ) );
|
||||
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', esc_url( 'http://example.com?foo=1&bar=2' ) );
|
||||
$this->assertSame( 'http://example.com?foo=1&bar=2', esc_url( 'http://example.com?foo=1&bar=2' ) );
|
||||
@@ -81,6 +100,10 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
|
||||
$this->assertSame( "http://example.com?url={$param}", esc_url( "http://example.com?url={$param}" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::esc_url
|
||||
* @covers ::wp_allowed_protocols
|
||||
*/
|
||||
public function test_protocol() {
|
||||
$this->assertSame( 'http://example.com', esc_url( 'http://example.com' ) );
|
||||
$this->assertSame( '', esc_url( 'nasty://example.com/' ) );
|
||||
@@ -145,23 +168,34 @@ 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)' ) );
|
||||
@@ -172,6 +206,8 @@ 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' ) );
|
||||
@@ -187,14 +223,18 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* Courtesy of http://blog.lunatech.com/2009/02/03/what-every-web-developer-must-know-about-url-encoding
|
||||
*
|
||||
* @covers ::esc_url_raw
|
||||
*/
|
||||
public function test_reserved_characters() {
|
||||
$url = "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$%27()*+,;=/?:@-._~!$%27()*+,;==#/?:@-._~!$&'()*+,;=";
|
||||
$this->assertSame( $url, sanitize_url( $url ) );
|
||||
$this->assertSame( $url, esc_url_raw( $url ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @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' ) );
|
||||
@@ -202,6 +242,8 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 31632
|
||||
*
|
||||
* @covers ::esc_url
|
||||
*/
|
||||
public function test_mailto_with_newline() {
|
||||
$body = <<<EOT
|
||||
@@ -217,6 +259,8 @@ EOT;
|
||||
|
||||
/**
|
||||
* @ticket 31632
|
||||
*
|
||||
* @covers ::esc_url
|
||||
*/
|
||||
public function test_mailto_in_http_url_with_newline() {
|
||||
$body = <<<EOT
|
||||
@@ -232,6 +276,8 @@ 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';
|
||||
@@ -243,13 +289,17 @@ EOT;
|
||||
|
||||
/**
|
||||
* @ticket 28015
|
||||
*
|
||||
* @covers ::esc_url_raw
|
||||
*/
|
||||
public function test_invalid_charaters() {
|
||||
$this->assertEmpty( sanitize_url( '"^<>{}`' ) );
|
||||
$this->assertEmpty( esc_url_raw( '"^<>{}`' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 34202
|
||||
*
|
||||
* @covers ::esc_url
|
||||
*/
|
||||
public function test_ipv6_hosts() {
|
||||
$this->assertSame( '//[::127.0.0.1]', esc_url( '//[::127.0.0.1]' ) );
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::esc_xml
|
||||
*/
|
||||
class Tests_Formatting_EscXml extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
* @covers ::excerpt_remove_blocks
|
||||
* @ticket 46133
|
||||
*/
|
||||
class Tests_Formatting_ExcerptRemoveBlocks extends WP_UnitTestCase {
|
||||
@@ -91,6 +90,8 @@ 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..
|
||||
@@ -116,6 +117,8 @@ class Tests_Formatting_ExcerptRemoveBlocks extends WP_UnitTestCase {
|
||||
* `the_content` gets applied, just like shortcodes.
|
||||
*
|
||||
* @ticket 46133
|
||||
*
|
||||
* @covers ::do_blocks
|
||||
*/
|
||||
public function test_excerpt_infinite_loop() {
|
||||
$query = new WP_Query(
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::get_bloginfo
|
||||
*/
|
||||
class Tests_Formatting_GetBloginfo extends WP_UnitTestCase {
|
||||
|
||||
@@ -35,6 +37,7 @@ class Tests_Formatting_GetBloginfo extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 27942
|
||||
* @covers ::sanitize_option
|
||||
*/
|
||||
public function test_bloginfo_sanitize_option() {
|
||||
$old_values = array(
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::get_url_in_content
|
||||
*/
|
||||
class Tests_Formatting_GetUrlInContent extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @ticket 38773
|
||||
*
|
||||
* @covers ::human_time_diff
|
||||
*/
|
||||
class Tests_Formatting_HumanTimeDiff extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::is_email
|
||||
*/
|
||||
class Tests_Formatting_IsEmail extends WP_UnitTestCase {
|
||||
public function test_returns_the_email_address_if_it_is_valid() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::like_escape
|
||||
*/
|
||||
class Tests_Formatting_LikeEscape extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::links_add_target
|
||||
*/
|
||||
class Tests_Formatting_LinksAddTarget extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::make_clickable
|
||||
*/
|
||||
class Tests_Formatting_MakeClickable extends WP_UnitTestCase {
|
||||
public function test_mailto_xss() {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @ticket 22300
|
||||
*
|
||||
* @covers ::map_deep
|
||||
*/
|
||||
class Tests_Formatting_MapDeep extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::normalize_whitespace
|
||||
*/
|
||||
class Tests_Formatting_NormalizeWhitespace extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,8 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
|
||||
*
|
||||
* @param string $location The path or URL to redirect to.
|
||||
* @param int $status HTTP response status code to use.
|
||||
*
|
||||
* @covers ::wp_redirect
|
||||
*/
|
||||
public function test_wp_redirect_bad_status_code( $location, $status ) {
|
||||
$this->expectException( 'WPDieException' );
|
||||
@@ -41,6 +43,9 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wp_sanitize_redirect
|
||||
*/
|
||||
public function test_wp_sanitize_redirect() {
|
||||
$this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0Ago' ) );
|
||||
$this->assertSame( 'http://example.com/watchthelinefeedgo', wp_sanitize_redirect( 'http://example.com/watchthelinefeed%0ago' ) );
|
||||
@@ -59,6 +64,8 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 36998
|
||||
*
|
||||
* @covers ::wp_sanitize_redirect
|
||||
*/
|
||||
public function test_wp_sanitize_redirect_should_encode_spaces() {
|
||||
$this->assertSame( 'http://example.com/test%20spaces', wp_sanitize_redirect( 'http://example.com/test%20spaces' ) );
|
||||
@@ -67,6 +74,8 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider valid_url_provider
|
||||
*
|
||||
* @covers ::wp_validate_redirect
|
||||
*/
|
||||
public function test_wp_validate_redirect_valid_url( $url, $expected ) {
|
||||
$this->assertSame( $expected, wp_validate_redirect( $url ) );
|
||||
@@ -74,6 +83,8 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider invalid_url_provider
|
||||
*
|
||||
* @covers ::wp_validate_redirect
|
||||
*/
|
||||
public function test_wp_validate_redirect_invalid_url( $url ) {
|
||||
$this->assertEquals( false, wp_validate_redirect( $url, false ) );
|
||||
@@ -166,6 +177,8 @@ class Tests_Formatting_Redirect extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 47980
|
||||
* @dataProvider relative_url_provider
|
||||
*
|
||||
* @covers ::wp_validate_redirect
|
||||
*/
|
||||
public function test_wp_validate_redirect_relative_url( $current_uri, $url, $expected ) {
|
||||
// Backup the global.
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::remove_accents
|
||||
*/
|
||||
class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
|
||||
|
||||
public function test_remove_accents_simple() {
|
||||
$this->assertSame( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) );
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::sanitize_file_name
|
||||
*/
|
||||
class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
|
||||
public function test_munges_extensions() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::sanitize_mime_type
|
||||
*/
|
||||
class Tests_Formatting_SanitizeMimeType extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
/**
|
||||
* @group sanitize_sql_orderby
|
||||
*
|
||||
* @covers ::sanitize_sql_orderby
|
||||
*/
|
||||
class Tests_Formatting_SanitizeOrderby extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::sanitize_sql_orderby
|
||||
* @dataProvider valid_orderbys
|
||||
*/
|
||||
public function test_valid( $orderby ) {
|
||||
@@ -33,7 +34,6 @@ class Tests_Formatting_SanitizeOrderby extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::sanitize_sql_orderby
|
||||
* @dataProvider invalid_orderbys
|
||||
*/
|
||||
public function test_invalid( $orderby ) {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @group post
|
||||
*
|
||||
* @covers WP_Post::__construct
|
||||
*/
|
||||
class Tests_Formatting_SanitizePost extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::sanitize_text_field
|
||||
* @covers ::sanitize_textarea_field
|
||||
*/
|
||||
class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
|
||||
public function data_sanitize_text_field() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::sanitize_title
|
||||
*/
|
||||
class Tests_Formatting_SanitizeTitle extends WP_UnitTestCase {
|
||||
public function test_strips_html() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::sanitize_title_with_dashes
|
||||
*/
|
||||
class Tests_Formatting_SanitizeTitleWithDashes extends WP_UnitTestCase {
|
||||
public function test_strips_html() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::sanitize_trackback_urls
|
||||
*/
|
||||
class Tests_Formatting_SanitizeTrackbackUrls extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::sanitize_user
|
||||
*/
|
||||
class Tests_Formatting_SanitizeUser extends WP_UnitTestCase {
|
||||
public function test_strips_html() {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::seems_utf8
|
||||
*/
|
||||
class Tests_Formatting_SeemsUtf8 extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -4,18 +4,31 @@
|
||||
* @group formatting
|
||||
*/
|
||||
class Tests_Formatting_Slashit extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::backslashit
|
||||
*/
|
||||
public function test_backslashes_middle_numbers() {
|
||||
$this->assertSame( "\\a-!9\\a943\\b\\c", backslashit( 'a-!9a943bc' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::backslashit
|
||||
*/
|
||||
public function test_backslashes_alphas() {
|
||||
$this->assertSame( "\\a943\\b\\c", backslashit( 'a943bc' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::backslashit
|
||||
*/
|
||||
public function test_double_backslashes_leading_numbers() {
|
||||
$this->assertSame( '\\\\95', backslashit( '95' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::untrailingslashit
|
||||
*/
|
||||
public function test_removes_trailing_slashes() {
|
||||
$this->assertSame( 'a', untrailingslashit( 'a/' ) );
|
||||
$this->assertSame( 'a', untrailingslashit( 'a////' ) );
|
||||
@@ -23,6 +36,8 @@ class Tests_Formatting_Slashit extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 22267
|
||||
*
|
||||
* @covers ::untrailingslashit
|
||||
*/
|
||||
public function test_removes_trailing_backslashes() {
|
||||
$this->assertSame( 'a', untrailingslashit( 'a\\' ) );
|
||||
@@ -31,22 +46,32 @@ class Tests_Formatting_Slashit extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 22267
|
||||
*
|
||||
* @covers ::untrailingslashit
|
||||
*/
|
||||
public function test_removes_trailing_mixed_slashes() {
|
||||
$this->assertSame( 'a', untrailingslashit( 'a/\\' ) );
|
||||
$this->assertSame( 'a', untrailingslashit( 'a\\/\\///\\\\//' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::trailingslashit
|
||||
*/
|
||||
public function test_adds_trailing_slash() {
|
||||
$this->assertSame( 'a/', trailingslashit( 'a' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::trailingslashit
|
||||
*/
|
||||
public function test_does_not_add_trailing_slash_if_one_exists() {
|
||||
$this->assertSame( 'a/', trailingslashit( 'a/' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 22267
|
||||
*
|
||||
* @covers ::trailingslashit
|
||||
*/
|
||||
public function test_converts_trailing_backslash_to_slash_if_one_exists() {
|
||||
$this->assertSame( 'a/', trailingslashit( 'a\\' ) );
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @group slashes
|
||||
*
|
||||
* @covers ::stripslashes_deep
|
||||
*/
|
||||
class Tests_Formatting_StripslashesDeep extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::url_shorten
|
||||
*/
|
||||
class Tests_Formatting_UrlShorten extends WP_UnitTestCase {
|
||||
public function test_url_shorten() {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @ticket 22300
|
||||
*
|
||||
* @covers ::urlencode_deep
|
||||
*/
|
||||
class Tests_Formatting_UrlencodeDeep extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::utf8_uri_encode
|
||||
*/
|
||||
class Tests_Formatting_Utf8UriEncode extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wpautop
|
||||
*/
|
||||
class Tests_Formatting_wpAutop extends WP_UnitTestCase {
|
||||
|
||||
@@ -541,10 +543,9 @@ line 2<br/>
|
||||
/**
|
||||
* wpautop() should not add extra </p> before <figcaption>
|
||||
*
|
||||
* @covers ::wpautop
|
||||
* @uses ::trim
|
||||
*
|
||||
* @ticket 39307
|
||||
*
|
||||
* @uses ::trim
|
||||
*/
|
||||
public function test_that_wpautop_does_not_add_extra_closing_p_in_figure() {
|
||||
$content1 = '<figure><img src="example.jpg" /><figcaption>Caption</figcaption></figure>';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
|
||||
* @covers ::wp_basename
|
||||
*/
|
||||
class Tests_Formatting_wpBasename extends WP_UnitTestCase {
|
||||
|
||||
@@ -38,5 +40,4 @@ class Tests_Formatting_wpBasename extends WP_UnitTestCase {
|
||||
wp_basename( 'C:\test\щипцы.txt' )
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_html_excerpt
|
||||
*/
|
||||
class Tests_Formatting_wpHtmlExcerpt extends WP_UnitTestCase {
|
||||
public function test_simple() {
|
||||
|
||||
@@ -9,6 +9,8 @@ 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 ) );
|
||||
@@ -39,6 +41,8 @@ class Tests_Formatting_wpHtmlSplit extends WP_UnitTestCase {
|
||||
* Automated performance testing of the main regex.
|
||||
*
|
||||
* @dataProvider data_whole_posts
|
||||
*
|
||||
* @covers ::preg_split
|
||||
*/
|
||||
public function test_pcre_performance( $input ) {
|
||||
$regex = get_html_split_regex();
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @expectedDeprecated wp_htmledit_pre
|
||||
*
|
||||
* @covers ::wp_htmledit_pre
|
||||
*/
|
||||
class Tests_Formatting_wpHtmleditPre extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_iso_descrambler
|
||||
*/
|
||||
class Tests_Formatting_wpIsoDescrambler extends WP_UnitTestCase {
|
||||
/*
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_make_link_relative
|
||||
*/
|
||||
class Tests_Formatting_wpMakeLinkRelative extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_rel_nofollow
|
||||
*/
|
||||
class Tests_Formatting_wpRelNofollow extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_rel_ugc
|
||||
*/
|
||||
class Tests_Formatting_wpRelUgc extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_replace_in_html_tags
|
||||
*/
|
||||
class Tests_Formatting_wpReplaceInHtmlTags extends WP_UnitTestCase {
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @expectedDeprecated wp_richedit_pre
|
||||
*
|
||||
* @covers ::wp_richedit_pre
|
||||
*/
|
||||
class Tests_Formatting_wpRicheditPre extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_slash
|
||||
*/
|
||||
class Tests_Formatting_wpSlash extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::_wp_specialchars
|
||||
*/
|
||||
class Tests_Formatting_wpSpecialchars extends WP_UnitTestCase {
|
||||
public function test_wp_specialchars_basics() {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Test wp_strip_all_tags()
|
||||
*
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_strip_all_tags
|
||||
*/
|
||||
class Tests_Formatting_wpStripAllTags extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @ticket 43187
|
||||
*
|
||||
* @covers ::wp_targeted_link_rel
|
||||
*/
|
||||
class Tests_Formatting_wpTargetedLinkRel extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -4,11 +4,18 @@
|
||||
* @group formatting
|
||||
*/
|
||||
class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_dashes() {
|
||||
$this->assertSame( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) );
|
||||
$this->assertSame( '<a href="http://xx--xx">Hey — 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>' ) );
|
||||
@@ -34,6 +41,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 1418
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_bracketed_quotes_1418() {
|
||||
$this->assertSame( '(“test”)', wptexturize( '("test")' ) );
|
||||
@@ -43,6 +52,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 3810
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_bracketed_quotes_3810() {
|
||||
$this->assertSame( 'A dog (“Hubertus”) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) );
|
||||
@@ -50,6 +61,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 4539
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_basic_quotes() {
|
||||
$this->assertSame( 'test’s', wptexturize( 'test\'s' ) );
|
||||
@@ -73,6 +86,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 4539
|
||||
* @ticket 15241
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_full_sentences_with_unmatched_single_quotes() {
|
||||
$this->assertSame(
|
||||
@@ -83,6 +98,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 4539
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_quotes() {
|
||||
$this->assertSame( '“Quoted String”', wptexturize( '"Quoted String"' ) );
|
||||
@@ -102,6 +119,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 4539
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_quotes_before_s() {
|
||||
$this->assertSame( 'test’s', wptexturize( "test's" ) );
|
||||
@@ -113,6 +132,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 4539
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_quotes_before_numbers() {
|
||||
$this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) );
|
||||
@@ -141,6 +162,9 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
$this->assertSame( '}”Class of ’99″{', wptexturize( "}\"Class of '99\"{" ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_quotes_after_numbers() {
|
||||
$this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) );
|
||||
}
|
||||
@@ -148,6 +172,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 4539
|
||||
* @ticket 15241
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_other_html() {
|
||||
$this->assertSame( '‘<strong>', wptexturize( "'<strong>" ) );
|
||||
@@ -155,10 +181,16 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
// $this->assertSame( '“<strong>Quoted Text</strong>”,', wptexturize( '"<strong>Quoted Text</strong>",' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_x() {
|
||||
$this->assertSame( '14×24', wptexturize( '14x24' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_minutes_seconds() {
|
||||
$this->assertSame( '9′', wptexturize( '9\'' ) );
|
||||
$this->assertSame( '9″', wptexturize( '9"' ) );
|
||||
@@ -172,6 +204,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 8775
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_wptexturize_quotes_around_numbers() {
|
||||
$this->assertSame( '“12345”', wptexturize( '"12345"' ) );
|
||||
@@ -182,6 +216,8 @@ 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]-->' ) );
|
||||
@@ -192,6 +228,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
/**
|
||||
* @ticket 4539
|
||||
* @ticket 15241
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_entity_quote_cuddling() {
|
||||
$this->assertSame( ' “Testing”', wptexturize( ' "Testing"' ) );
|
||||
@@ -200,6 +238,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 22823
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_apostrophes_before_primes() {
|
||||
$this->assertSame( 'WordPress 3.5’s release date', wptexturize( "WordPress 3.5's release date" ) );
|
||||
@@ -207,6 +247,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 23185
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_spaces_around_hyphens() {
|
||||
$nbsp = "\xC2\xA0";
|
||||
@@ -230,6 +272,8 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 31030
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_hyphens_at_start_and_end() {
|
||||
$this->assertSame( '– ', wptexturize( '- ' ) );
|
||||
@@ -247,6 +291,8 @@ 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";
|
||||
@@ -264,9 +310,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_spaces_around_quotes
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_spaces_around_quotes( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_spaces_around_quotes() {
|
||||
@@ -320,9 +368,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_apos_before_digits
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_apos_before_digits( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_apos_before_digits() {
|
||||
@@ -361,9 +411,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_opening_single_quote
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_opening_single_quote( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_opening_single_quote() {
|
||||
@@ -490,9 +542,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_double_prime
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_double_prime( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_double_prime() {
|
||||
@@ -523,9 +577,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_single_prime
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_single_prime( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_single_prime() {
|
||||
@@ -556,9 +612,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_contractions
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_contractions( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_contractions() {
|
||||
@@ -597,9 +655,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_opening_quote
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_opening_quote( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_opening_quote() {
|
||||
@@ -674,9 +734,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_closing_quote
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_closing_quote( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_closing_quote() {
|
||||
@@ -763,9 +825,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_closing_single_quote
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_closing_single_quote( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_closing_single_quote() {
|
||||
@@ -853,9 +917,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
* @ticket 22692
|
||||
* @ticket 30445
|
||||
* @dataProvider data_multiplication
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_multiplication( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_multiplication() {
|
||||
@@ -903,9 +969,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_ampersand
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_ampersand( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_ampersand() {
|
||||
@@ -968,9 +1036,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_cockney
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_cockney( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_cockney() {
|
||||
@@ -1029,9 +1099,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_smart_dashes
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_smart_dashes( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_smart_dashes() {
|
||||
@@ -1082,9 +1154,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 22692
|
||||
* @dataProvider data_misc_static_replacements
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_misc_static_replacements( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_misc_static_replacements() {
|
||||
@@ -1137,9 +1211,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 8775
|
||||
* @dataProvider data_quoted_numbers
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_quoted_numbers( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_quoted_numbers() {
|
||||
@@ -1188,9 +1264,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 20342
|
||||
* @dataProvider data_quotes_and_dashes
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_quotes_and_dashes( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_quotes_and_dashes() {
|
||||
@@ -1251,9 +1329,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 12690
|
||||
* @dataProvider data_tag_avoidance
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_tag_avoidance( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_tag_avoidance() {
|
||||
@@ -1474,9 +1554,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 26850
|
||||
* @dataProvider data_year_abbr
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_year_abbr( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_year_abbr() {
|
||||
@@ -1563,6 +1645,8 @@ 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 );
|
||||
@@ -1572,7 +1656,7 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
remove_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
|
||||
wptexturize( 'reset', true );
|
||||
|
||||
return $this->assertSame( $output, $result );
|
||||
$this->assertSame( $output, $result );
|
||||
}
|
||||
|
||||
public function filter_translate( $translations, $text, $context, $domain ) {
|
||||
@@ -1790,9 +1874,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 28483
|
||||
* @dataProvider data_element_stack
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_element_stack( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_element_stack() {
|
||||
@@ -1841,6 +1927,8 @@ 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 );
|
||||
@@ -1926,9 +2014,11 @@ class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 29256
|
||||
* @dataProvider data_primes_vs_quotes
|
||||
*
|
||||
* @covers ::wptexturize
|
||||
*/
|
||||
public function test_primes_vs_quotes( $input, $output ) {
|
||||
return $this->assertSame( $output, wptexturize( $input ) );
|
||||
$this->assertSame( $output, wptexturize( $input ) );
|
||||
}
|
||||
|
||||
public function data_primes_vs_quotes() {
|
||||
@@ -1988,6 +2078,8 @@ String with a number followed by a single quote ‘Expendables 3’ 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 );
|
||||
@@ -1997,7 +2089,7 @@ String with a number followed by a single quote ‘Expendables 3’ vest
|
||||
remove_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 );
|
||||
wptexturize( 'reset', true );
|
||||
|
||||
return $this->assertSame( $output, $result );
|
||||
$this->assertSame( $output, $result );
|
||||
}
|
||||
|
||||
public function filter_translate2( $translations, $text, $context, $domain ) {
|
||||
@@ -2081,6 +2173,8 @@ String with a number followed by a single quote !q1!Expendables 3!q1! vestibulum
|
||||
* Automated performance testing of the main regex.
|
||||
*
|
||||
* @dataProvider data_whole_posts
|
||||
*
|
||||
* @covers ::preg_split
|
||||
*/
|
||||
public function test_pcre_performance( $input ) {
|
||||
global $shortcode_tags;
|
||||
@@ -2101,6 +2195,8 @@ 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–oo<', wptexturize( 'F--oo<', true ) );
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_trim_excerpt
|
||||
*/
|
||||
class Tests_Formatting_wpTrimExcerpt extends WP_UnitTestCase {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::wp_trim_words
|
||||
*/
|
||||
class Tests_Formatting_wpTrimWords extends WP_UnitTestCase {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*
|
||||
* @covers ::zeroise
|
||||
*/
|
||||
class Tests_Formatting_Zeroise extends WP_UnitTestCase {
|
||||
public function test_pads_with_leading_zeroes() {
|
||||
|
||||
Reference in New Issue
Block a user