wordpress-develop/tests/phpunit/tests/formatting/GetUrlInContent.php
Sergey Biryukov b09823a1d3 Update Tests_Formatting_GetUrlInContent::get_input_output() after [33858].
Props gitlost.
Fixes #23605.

git-svn-id: https://develop.svn.wordpress.org/trunk@33905 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-05 14:05:05 +00:00

50 lines
1.2 KiB
PHP

<?php
/**
* @group formatting
*/
class Tests_Formatting_GetUrlInContent extends WP_UnitTestCase {
/**
* URL Content Data Provider
*
* array ( input_txt, converted_output_txt )
*/
public function get_input_output() {
return array (
array (
"",
false
), //empty content
array (
"<div>NO URL CONTENT</div>",
false
), //no URLs
array (
'<div href="/relative.php">NO URL CONTENT</div>',
false
), // ignore none link elements
array (
'ABC<div><a href="/relative.php">LINK</a> CONTENT</div>',
"/relative.php"
), // single link
array (
'ABC<div><a href="/relative.php">LINK</a> CONTENT <a href="/suppress.php">LINK</a></div>',
"/relative.php"
), // multiple links
array (
'ABC<div><a href="http://example.com/Mr%20WordPress 2">LINK</a> CONTENT </div>',
"http://example.com/Mr%20WordPress%202"
), // escape link
);
}
/**
* Validate the get_url_in_content function
* @dataProvider get_input_output
*/
function test_get_url_in_content( $in_str, $exp_str ) {
$this->assertEquals($exp_str, get_url_in_content( $in_str ) );
}
}