mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-10 07:34:34 +00:00
Tests: Improve documentation and variable names in some formatting tests.
Includes documenting data provider values using hash notation in the tests for: * `convert_smilies()` * `get_url_in_content()` * `links_add_target()` * `normalize_whitespace()` Follow-up to [26191], [26327], [26328], [26972], [55562]. See #57841. git-svn-id: https://develop.svn.wordpress.org/trunk@55563 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -7,24 +7,31 @@
|
||||
class Tests_Formatting_LinksAddTarget extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* Validate the normalize_whitespace function
|
||||
* Tests the links_add_target() function.
|
||||
*
|
||||
* @dataProvider data_links_add_target
|
||||
*/
|
||||
public function test_links_add_target( $content, $target, $tags, $exp_str ) {
|
||||
if ( true === is_null( $target ) ) {
|
||||
$this->assertSame( $exp_str, links_add_target( $content ) );
|
||||
} elseif ( true === is_null( $tags ) ) {
|
||||
$this->assertSame( $exp_str, links_add_target( $content, $target ) );
|
||||
public function test_links_add_target( $content, $target, $tags, $expected ) {
|
||||
if ( is_null( $target ) ) {
|
||||
$this->assertSame( $expected, links_add_target( $content ) );
|
||||
} elseif ( is_null( $tags ) ) {
|
||||
$this->assertSame( $expected, links_add_target( $content, $target ) );
|
||||
} else {
|
||||
$this->assertSame( $exp_str, links_add_target( $content, $target, $tags ) );
|
||||
$this->assertSame( $expected, links_add_target( $content, $target, $tags ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Content DataProvider
|
||||
* Data provider.
|
||||
*
|
||||
* array ( input_txt, converted_output_txt)
|
||||
* @return array {
|
||||
* @type array {
|
||||
* @type string $content String to search for links in.
|
||||
* @type string $target The target to add to the links.
|
||||
* @type string $tags An array of tags to apply to.
|
||||
* @type string $expected Expected output.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
public function data_links_add_target() {
|
||||
return array(
|
||||
|
||||
Reference in New Issue
Block a user