assertSame( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) ); $this->assertSame( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) ); } public function test_disable() { $this->assertSame( '
---&', wptexturize( '
---&' ) ); $this->assertSame( '
--&', wptexturize( '--&' ) );
$this->assertSame( '---&', wptexturize( '---&' ) );
$this->assertSame( '---&', wptexturize( '---&' ) );
$this->assertSame( '', wptexturize( '' ) );
$this->assertSame( '', wptexturize( '' ) );
$this->assertSame( '---&', wptexturize( '---&' ) );
$this->assertSame( 'href="baba" “baba”', wptexturize( 'href="baba" "baba"' ) );
$enabled_tags_inside_code = 'curl -s baba | grep sfive | cut -d "\"" -f 10 > topmp3.txt';
$this->assertSame( $enabled_tags_inside_code, wptexturize( $enabled_tags_inside_code ) );
$double_nest = '"baba""baba""baba"';
$this->assertSame( $double_nest, wptexturize( $double_nest ) );
$invalid_nest = '"baba"'; $this->assertSame( $invalid_nest, wptexturize( $invalid_nest ) ); } /** * @ticket 1418 */ public function test_bracketed_quotes_1418() { $this->assertSame( '(“test”)', wptexturize( '("test")' ) ); $this->assertSame( '(‘test’)', wptexturize( "('test')" ) ); $this->assertSame( '(’twas)', wptexturize( "('twas)" ) ); } /** * @ticket 3810 */ public function test_bracketed_quotes_3810() { $this->assertSame( 'A dog (“Hubertus”) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) ); } /** * @ticket 4539 */ public function test_basic_quotes() { $this->assertSame( 'test’s', wptexturize( 'test\'s' ) ); $this->assertSame( '‘quoted’', wptexturize( '\'quoted\'' ) ); $this->assertSame( '“quoted”', wptexturize( '"quoted"' ) ); $this->assertSame( 'space before ‘quoted’ space after', wptexturize( 'space before \'quoted\' space after' ) ); $this->assertSame( 'space before “quoted” space after', wptexturize( 'space before "quoted" space after' ) ); $this->assertSame( '(‘quoted’)', wptexturize( '(\'quoted\')' ) ); $this->assertSame( '{“quoted”}', wptexturize( '{"quoted"}' ) ); $this->assertSame( '‘qu(ot)ed’', wptexturize( '\'qu(ot)ed\'' ) ); $this->assertSame( '“qu{ot}ed”', wptexturize( '"qu{ot}ed"' ) ); $this->assertSame( ' ‘test’s quoted’ ', wptexturize( ' \'test\'s quoted\' ' ) ); $this->assertSame( ' “test’s quoted” ', wptexturize( ' "test\'s quoted" ' ) ); } /** * @ticket 4539 * @ticket 15241 */ public function test_full_sentences_with_unmatched_single_quotes() { $this->assertSame( 'That means every moment you’re working on something without it being in the public it’s actually dying.', wptexturize( "That means every moment you're working on something without it being in the public it's actually dying." ) ); } /** * @ticket 4539 */ public function test_quotes() { $this->assertSame( '“Quoted String”', wptexturize( '"Quoted String"' ) ); // $this->assertSame( 'Here is “a test with a link”', wptexturize( 'Here is "a test with a link"' ) ); // $this->assertSame( 'Here is “a test with a link and a period”.', wptexturize( 'Here is "a test with a link and a period".' ) ); $this->assertSame( 'Here is “a test with a link” and a space.', wptexturize( 'Here is "a test with a link" and a space.' ) ); $this->assertSame( 'Here is “a test with a link and some text quoted”', wptexturize( 'Here is "a test with a link and some text quoted"' ) ); // $this->assertSame( 'Here is “a test with a link”, and a comma.', wptexturize( 'Here is "a test with a link", and a comma.' ) ); // $this->assertSame( 'Here is “a test with a link”; and a semi-colon.', wptexturize( 'Here is "a test with a link"; and a semi-colon.' ) ); // $this->assertSame( 'Here is “a test with a link”- and a dash.', wptexturize( 'Here is "a test with a link"- and a dash.' ) ); // $this->assertSame( 'Here is “a test with a link”… and ellipses.', wptexturize( 'Here is "a test with a link"... and ellipses.' ) ); // $this->assertSame( 'Here is “a test with a link”.', wptexturize( 'Here is "a test with a link".' ) ); // $this->assertSame( 'Here is “a test with a link”and a work stuck to the end.', wptexturize( 'Here is "a test with a link"and a work stuck to the end.' ) ); $this->assertSame( 'A test with a finishing number, “like 23”.', wptexturize( 'A test with a finishing number, "like 23".' ) ); $this->assertSame( 'A test with a number, “like 62”, is nice to have.', wptexturize( 'A test with a number, "like 62", is nice to have.' ) ); } /** * @ticket 4539 */ public function test_quotes_before_s() { $this->assertSame( 'test’s', wptexturize( "test's" ) ); $this->assertSame( '‘test’s', wptexturize( "'test's" ) ); $this->assertSame( '‘test’s’', wptexturize( "'test's'" ) ); $this->assertSame( '‘string’', wptexturize( "'string'" ) ); $this->assertSame( '‘string’s’', wptexturize( "'string's'" ) ); } /** * @ticket 4539 */ public function test_quotes_before_numbers() { $this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) ); $this->assertSame( 'Class of ’99’s', wptexturize( "Class of '99's" ) ); $this->assertSame( '‘Class of ’99’', wptexturize( "'Class of '99'" ) ); $this->assertSame( '‘Class of ’99’ ', wptexturize( "'Class of '99' " ) ); $this->assertSame( '‘Class of ’99’.', wptexturize( "'Class of '99'." ) ); $this->assertSame( '‘Class of ’99’, she said', wptexturize( "'Class of '99', she said" ) ); $this->assertSame( '‘Class of ’99’:', wptexturize( "'Class of '99':" ) ); $this->assertSame( '‘Class of ’99’;', wptexturize( "'Class of '99';" ) ); $this->assertSame( '‘Class of ’99’!', wptexturize( "'Class of '99'!" ) ); $this->assertSame( '‘Class of ’99’?', wptexturize( "'Class of '99'?" ) ); $this->assertSame( '‘Class of ’99’s’', wptexturize( "'Class of '99's'" ) ); $this->assertSame( '‘Class of ’99’s’', wptexturize( "'Class of '99’s'" ) ); $this->assertSame( '“Class of 99”', wptexturize( '"Class of 99"' ) ); $this->assertSame( '“Class of ’99”', wptexturize( "\"Class of '99\"" ) ); $this->assertSame( '{“Class of ’99”}', wptexturize( "{\"Class of '99\"}" ) ); $this->assertSame( ' “Class of ’99” ', wptexturize( " \"Class of '99\" " ) ); $this->assertSame( ' “Class of ’99”.', wptexturize( " \"Class of '99\"." ) ); $this->assertSame( ' “Class of ’99”, she said', wptexturize( " \"Class of '99\", she said" ) ); $this->assertSame( ' “Class of ’99”:', wptexturize( " \"Class of '99\":" ) ); $this->assertSame( ' “Class of ’99”;', wptexturize( " \"Class of '99\";" ) ); $this->assertSame( ' “Class of ’99”!', wptexturize( " \"Class of '99\"!" ) ); $this->assertSame( ' “Class of ’99”?', wptexturize( " \"Class of '99\"?" ) ); // Not a quotation, may be between two other quotations. $this->assertSame( '}”Class of ’99″{', wptexturize( "}\"Class of '99\"{" ) ); } public function test_quotes_after_numbers() { $this->assertSame( 'Class of ’99', wptexturize( "Class of '99" ) ); } /** * @ticket 4539 * @ticket 15241 */ public function test_other_html() { $this->assertSame( '‘', wptexturize( "'" ) ); // $this->assertSame( '‘Quoted Text’,', wptexturize( "'Quoted Text'," ) ); // $this->assertSame( '“Quoted Text”,', wptexturize( '"Quoted Text",' ) ); } public function test_x() { $this->assertSame( '14×24', wptexturize( '14x24' ) ); } public function test_minutes_seconds() { $this->assertSame( '9′', wptexturize( '9\'' ) ); $this->assertSame( '9″', wptexturize( '9"' ) ); $this->assertSame( 'a 9′ b', wptexturize( 'a 9\' b' ) ); $this->assertSame( 'a 9″ b', wptexturize( 'a 9" b' ) ); $this->assertSame( '“a 9′ b”', wptexturize( '"a 9\' b"' ) ); $this->assertSame( '‘a 9″ b’', wptexturize( "'a 9\" b'" ) ); } /** * @ticket 8775 */ public function test_wptexturize_quotes_around_numbers() { $this->assertSame( '“12345”', wptexturize( '"12345"' ) ); $this->assertSame( '‘12345’', wptexturize( '\'12345\'' ) ); $this->assertSame( '“a 9′ plus a ‘9’, maybe a 9′ ‘9’”', wptexturize( '"a 9\' plus a \'9\', maybe a 9\' \'9\'"' ) ); $this->assertSame( '
’99
‘123’
’tis
‘s’
\'99
\'123\'
\'tis
\'s\'
word', // Ensure we are not corrupting image URLs.
'word
word',
),
array(
'[ do texturize "[quote]" here ]',
'[ do texturize “[quote]” here ]',
),
array(
'[ regex catches this here ]',
'[ regex catches this here ]',
),
array(
'[ but also catches the styled "[quote]" here ]',
'[ but also catches the styled “[quote]” here ]',
),
array(
'[Let\'s get crazy[caption code="hello"]world]', // [caption] shortcode is invalid here because it contains '[]' chars.
'[Let’s get crazy[caption code=”hello“]world]',
),
array(
'<> ... <>',
'<> … <>',
),
array(
'<> ... <> ... >',
'<> … <> … >',
),
array(
'<> ... < ... > ... <>',
'<> … < ... > … <>',
),
);
}
/**
* Year abbreviations consist of exactly two digits.
*
* @ticket 26850
* @dataProvider data_year_abbr
*/
public function test_year_abbr( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
}
public function data_year_abbr() {
return array(
array(
"word '99 word",
'word ’99 word',
),
array(
"word '99. word",
'word ’99. word',
),
array(
"word '99, word",
'word ’99, word',
),
array(
"word '99; word",
'word ’99; word',
),
array(
"word '99' word", // For this pattern, prime doesn't make sense. Should get apos and a closing quote.
'word ’99’ word',
),
array(
"word '99'. word",
'word ’99’. word',
),
array(
"word '99', word",
'word ’99’, word',
),
array(
"word '99.' word",
'word ’99.’ word',
),
array(
"word '99",
'word ’99',
),
array(
"'99 word",
'’99 word',
),
array(
"word '999 word", // Does not match the apos pattern, should be opening quote.
'word ‘999 word',
),
array(
"word '99% word",
'word ‘99% word',
),
array(
"word '9 word",
'word ‘9 word',
),
array(
"word '99.9 word",
'word ‘99.9 word',
),
array(
"word '999",
'word ‘999',
),
array(
"word '9",
'word ‘9',
),
array(
"in '4 years, 3 months,' Obama cut the deficit",
'in ‘4 years, 3 months,’ Obama cut the deficit',
),
array(
"testing's '4' through 'quotes'",
'testing’s ‘4’ through ‘quotes’',
),
);
}
/**
* Make sure translation actually works.
*
* Also make sure apostrophes and closing quotes aren't being confused by default.
*
* @ticket 27426
* @dataProvider data_translate
*/
public function test_translate( $input, $output ) {
add_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
$result = wptexturize( $input, true );
remove_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
wptexturize( 'reset', true );
$this->assertSame( $output, $result );
}
public function filter_translate( $translations, $text, $context, $domain ) {
switch ( $text ) {
case '–':
return '!endash!';
case '—':
return '!emdash!';
case '‘':
return '!openq1!';
case '’':
if ( 'apostrophe' === $context ) {
return '!apos!';
} else {
return '!closeq1!';
}
case '“':
return '!openq2!';
case '”':
return '!closeq2!';
case '′':
return '!prime1!';
case '″':
return '!prime2!';
case '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em':
return '!apos!tain!apos!t,!apos!twere,!apos!twas,!apos!tis,!apos!twill,!apos!til,!apos!bout,!apos!nuff,!apos!round,!apos!cause,!apos!em';
default:
return $translations;
}
}
public function data_translate() {
return array(
array(
"word '99 word",
'word !apos!99 word',
),
array(
"word'99 word",
'word!apos!99 word',
),
array(
"word 'test sentence' word",
'word !openq1!test sentence!closeq1! word',
),
array(
"'test sentence'",
'!openq1!test sentence!closeq1!',
),
array(
'word "test sentence" word',
'word !openq2!test sentence!closeq2! word',
),
array(
'"test sentence"',
'!openq2!test sentence!closeq2!',
),
array(
"word 'word word",
'word !openq1!word word',
),
array(
"word ('word word",
'word (!openq1!word word',
),
array(
"word ['word word",
'word [!openq1!word word',
),
array(
'word 99" word',
'word 99!prime2! word',
),
array(
'word 99"word',
'word 99!prime2!word',
),
array(
'word99" word',
'word99!prime2! word',
),
array(
'word99"word',
'word99!prime2!word',
),
array(
"word 99' word",
'word 99!prime1! word',
),
array(
"word99' word",
'word99!prime1! word',
),
array(
"word word's word",
'word word!apos!s word',
),
array(
"word word'. word",
'word word!closeq1!. word',
),
array(
"word ]'. word",
'word ]!closeq1!. word',
),
array(
'word "word word',
'word !openq2!word word',
),
array(
'word ("word word',
'word (!openq2!word word',
),
array(
'word ["word word',
'word [!openq2!word word',
),
array(
'word word" word',
'word word!closeq2! word',
),
array(
'word word") word',
'word word!closeq2!) word',
),
array(
'word word"] word',
'word word!closeq2!] word',
),
array(
'word word"',
'word word!closeq2!',
),
array(
'word word"word',
'word word!closeq2!word',
),
array(
'test sentence".',
'test sentence!closeq2!.',
),
array(
'test sentence."',
'test sentence.!closeq2!',
),
array(
'test sentence." word',
'test sentence.!closeq2! word',
),
array(
"word word' word",
'word word!closeq1! word',
),
array(
"word word'. word",
'word word!closeq1!. word',
),
array(
"word word'.word",
'word word!closeq1!.word',
),
array(
"word word'",
'word word!closeq1!',
),
array(
"test sentence'.",
'test sentence!closeq1!.',
),
array(
"test sentence.'",
'test sentence.!closeq1!',
),
array(
"test sentence'. word",
'test sentence!closeq1!. word',
),
array(
"test sentence.' word",
'test sentence.!closeq1! word',
),
array(
"word 'tain't word",
'word !apos!tain!apos!t word',
),
array(
"word 'twere word",
'word !apos!twere word',
),
array(
'word "42.00" word',
'word !openq2!42.00!closeq2! word',
),
array(
"word '42.00' word",
'word !openq1!42.00!closeq1! word',
),
array(
"word word'. word",
'word word!closeq1!. word',
),
array(
"word word'.word",
'word word!closeq1!.word',
),
array(
"word word', she said",
'word word!closeq1!, she said',
),
);
}
/**
* Extra sanity checks for _wptexturize_pushpop_element()
*
* @ticket 28483
* @dataProvider data_element_stack
*/
public function test_element_stack( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
}
public function data_element_stack() {
return array(
array(
'hello---',
'hello—',
),
array(
'hello---',
'hello—',
),
array(
'hello---',
'hello—',
),
array(
'hello---',
'hello—',
),
array(
'hello---',
'hello---',
),
array(
'hello---',
'hello---',
),
array(
'hello---',
'hello---',
),
array(
'hello---',
'hello—',
),
array(
'helloworld---',
'helloworld—',
),
);
}
/**
* Test disabling shortcode texturization.
*
* @ticket 29557
* @dataProvider data_unregistered_shortcodes
*/
public function test_unregistered_shortcodes( $input, $output ) {
add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
$output = $this->assertSame( $output, wptexturize( $input ) );
remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
return $output;
}
public function filter_shortcodes( $disabled ) {
$disabled[] = 'audio';
return $disabled;
}
public function data_unregistered_shortcodes() {
return array(
array(
'[a]a--b[audio]---[/audio]a--b[/a]',
'[a]a–b[audio]---[/audio]a–b[/a]',
),
array(
'[code ...]...[/code]', // '[code]' is not a registered shortcode.
'[code …]…[/code]',
),
array(
'[hello ...]...[/hello]', // '[hello]' is not a registered shortcode.
'[hello …]…[/hello]',
),
array(
'[...]...[/...]', // These are potentially usable shortcodes.
'[…]…[/…]',
),
array(
'[gal>ery ...]',
'[gal>ery …]',
),
array(
'[randomthing param="test"]',
'[randomthing param=”test”]',
),
array(
'[[audio]...[/audio]...', // These are potentially usable shortcodes.
'[[audio]…[/audio]…', // Unfortunately, the meaning of [[audio] is ambiguous unless we run the entire shortcode regexp.
),
array(
'[audio]...[/audio]]...', // These are potentially usable shortcodes.
'[audio]...[/audio]]...', // Unfortunately, the meaning of [/audio]] is ambiguous unless we run the entire shortcode regexp.
), // This test would not pass in 3.9 because the extra brace was always ignored by texturize.
array(
'hello[/audio]---',
'hello[/audio]—',
),
array(
'[/audio]hello---',
'[/audio]hello—',
),
array(
'[audio]hello[/audio]---',
'[audio]hello[/audio]—',
),
array(
'hello---[audio]',
'hello—[audio]',
),
array(
'hello[audio]---',
'hello[audio]---',
),
array(
'[audio]hello---',
'[audio]hello---',
),
array(
'[audio]hello---',
'[audio]hello---',
),
);
}
/**
* Ensure primes logic is not too greedy at the end of a quotation.
*
* @ticket 29256
* @dataProvider data_primes_vs_quotes
*/
public function test_primes_vs_quotes( $input, $output ) {
$this->assertSame( $output, wptexturize( $input ) );
}
public function data_primes_vs_quotes() {
return array(
array(
"George's porch is 99' long.",
'George’s porch is 99′ long.',
),
array(
'The best year "was that time in 2012" when everyone partied, he said.',
'The best year “was that time in 2012” when everyone partied, he said.',
),
array(
"I need 4 x 20' = 80' of trim.", // Works only with a space before the '=' char.
'I need 4 x 20′ = 80′ of trim.',
),
array(
'"Lorem ipsum dolor sit amet 1234"',
'“Lorem ipsum dolor sit amet 1234”',
),
array(
"'Etiam eu egestas dui 1234'",
'‘Etiam eu egestas dui 1234’',
),
array(
'according to our source, "33% of all students scored less than 50" on the test.',
'according to our source, “33% of all students scored less than 50” on the test.',
),
array(
"The doctor said, 'An average height is between 5' and 6' in study group 7'. He then produced a 6' chart of averages. A man of 7', incredibly, is very possible.",
'The doctor said, ‘An average height is between 5′ and 6′ in study group 7’. He then produced a 6′ chart of averages. A man of 7′, incredibly, is very possible.',
),
array(
'Pirates have voted on "The Expendables 3" with their clicks -- and it turns out the Sylvester Stallone-starrer hasn\'t been astoundingly popular among digital thieves, relatively speaking.
As of Sunday, 5.12 million people worldwide had pirated "Expendables 3" since a high-quality copy hit torrent-sharing sites July 23, according to piracy-tracking firm Excipio.
That likely contributed to the action movie\'s dismal box-office debut this weekend. But over the same July 23-Aug. 18 time period, the movie was No. 4 in downloads, after "Captain America: The Winter Soldier" (7.31 million), "Divergent" (6.29 million) and "The Amazing Spider-Man 2" (5.88 million). Moreover, that\'s despite "Expendables 3" becoming available more than three weeks prior to the film\'s U.S. theatrical debut.
String with a number followed by a single quote \'Expendables 3\' vestibulum in arcu mi.',
'Pirates have voted on “The Expendables 3” with their clicks — and it turns out the Sylvester Stallone-starrer hasn’t been astoundingly popular among digital thieves, relatively speaking.
As of Sunday, 5.12 million people worldwide had pirated “Expendables 3” since a high-quality copy hit torrent-sharing sites July 23, according to piracy-tracking firm Excipio.
That likely contributed to the action movie’s dismal box-office debut this weekend. But over the same July 23-Aug. 18 time period, the movie was No. 4 in downloads, after “Captain America: The Winter Soldier” (7.31 million), “Divergent” (6.29 million) and “The Amazing Spider-Man 2” (5.88 million). Moreover, that’s despite “Expendables 3” becoming available more than three weeks prior to the film’s U.S. theatrical debut.
String with a number followed by a single quote ‘Expendables 3’ vestibulum in arcu mi.',
),
);
}
/**
* Make sure translation actually works.
*
* Also make sure opening and closing quotes are allowed to be identical.
*
* @ticket 29256
* @dataProvider data_primes_quotes_translation
*/
public function test_primes_quotes_translation( $input, $output ) {
add_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 );
$result = wptexturize( $input, true );
remove_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 );
wptexturize( 'reset', true );
$this->assertSame( $output, $result );
}
public function filter_translate2( $translations, $text, $context, $domain ) {
switch ( $text ) {
case '–':
return '!endash!';
case '—':
return '!emdash!';
case '‘':
return '!q1!';
case '’':
if ( 'apostrophe' === $context ) {
return '!apos!';
} else {
return '!q1!';
}
case '“':
return '!q2!';
case '”':
return '!q2!';
case '′':
return '!prime1!';
case '″':
return '!prime2!';
default:
return $translations;
}
}
public function data_primes_quotes_translation() {
return array(
array(
"George's porch is 99' long.",
'George!apos!s porch is 99!prime1! long.',
),
array(
'The best year "was that time in 2012" when everyone partied, he said.',
'The best year !q2!was that time in 2012!q2! when everyone partied, he said.',
),
array(
"I need 4 x 20' = 80' of trim.", // Works only with a space before the '=' char.
'I need 4 x 20!prime1! = 80!prime1! of trim.',
),
array(
'"Lorem ipsum dolor sit amet 1234"',
'!q2!Lorem ipsum dolor sit amet 1234!q2!',
),
array(
"'Etiam eu egestas dui 1234'",
'!q1!Etiam eu egestas dui 1234!q1!',
),
array(
'according to our source, "33% of all students scored less than 50" on the test.',
'according to our source, !q2!33% of all students scored less than 50!q2! on the test.',
),
array(
"The doctor said, 'An average height is between 5' and 6' in study group 7'. He then produced a 6' chart of averages. A man of 7', incredibly, is very possible.",
'The doctor said, !q1!An average height is between 5!prime1! and 6!prime1! in study group 7!q1!. He then produced a 6!prime1! chart of averages. A man of 7!prime1!, incredibly, is very possible.',
),
array(
'Pirates have voted on "The Expendables 3" with their clicks -- and it turns out the Sylvester Stallone-starrer hasn\'t been astoundingly popular among digital thieves, relatively speaking.
As of Sunday, 5.12 million people worldwide had pirated "Expendables 3" since a high-quality copy hit torrent-sharing sites July 23, according to piracy-tracking firm Excipio.
That likely contributed to the action movie\'s dismal box-office debut this weekend. But over the same July 23-Aug. 18 time period, the movie was No. 4 in downloads, after "Captain America: The Winter Soldier" (7.31 million), "Divergent" (6.29 million) and "The Amazing Spider-Man 2" (5.88 million). Moreover, that\'s despite "Expendables 3" becoming available more than three weeks prior to the film\'s U.S. theatrical debut.
String with a number followed by a single quote \'Expendables 3\' vestibulum in arcu mi.',
'Pirates have voted on !q2!The Expendables 3!q2! with their clicks !emdash! and it turns out the Sylvester Stallone-starrer hasn!apos!t been astoundingly popular among digital thieves, relatively speaking.
As of Sunday, 5.12 million people worldwide had pirated !q2!Expendables 3!q2! since a high-quality copy hit torrent-sharing sites July 23, according to piracy-tracking firm Excipio.
That likely contributed to the action movie!apos!s dismal box-office debut this weekend. But over the same July 23-Aug. 18 time period, the movie was No. 4 in downloads, after !q2!Captain America: The Winter Soldier!q2! (7.31 million), !q2!Divergent!q2! (6.29 million) and !q2!The Amazing Spider-Man 2!q2! (5.88 million). Moreover, that!apos!s despite !q2!Expendables 3!q2! becoming available more than three weeks prior to the film!apos!s U.S. theatrical debut.
String with a number followed by a single quote !q1!Expendables 3!q1! vestibulum in arcu mi.',
),
);
}
/**
* Automated performance testing of the main regex.
*
* @dataProvider data_whole_posts
*
* @covers ::_get_wptexturize_split_regex
* @covers ::_get_wptexturize_shortcode_regex
*/
public function test_pcre_performance( $input ) {
global $shortcode_tags;
// With shortcodes disabled.
$regex = _get_wptexturize_split_regex();
$result = benchmark_pcre_backtracking( $regex, $input, 'split' );
$this->assertLessThan( 200, $result );
// With shortcodes enabled.
$shortcode_regex = _get_wptexturize_shortcode_regex( array_keys( $shortcode_tags ) );
$regex = _get_wptexturize_split_regex( $shortcode_regex );
$result = benchmark_pcre_backtracking( $regex, $input, 'split' );
return $this->assertLessThan( 200, $result );
}
/**
* Ensure that a trailing less-than symbol doesn't cause a PHP warning.
*
* @ticket 35864
*/
public function test_trailing_less_than() {
$this->assertSame( 'F–oo<', wptexturize( 'F--oo<', true ) );
}
public function data_whole_posts() {
require_once DIR_TESTDATA . '/formatting/whole-posts.php';
return data_whole_posts();
}
}