mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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
61 lines
1.1 KiB
PHP
61 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* @group formatting
|
|
*
|
|
* @covers ::normalize_whitespace
|
|
*/
|
|
class Tests_Formatting_NormalizeWhitespace extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* Tests the the normalize_whitespace() function.
|
|
*
|
|
* @dataProvider data_normalize_whitespace
|
|
*/
|
|
public function test_normalize_whitespace( $input, $expected ) {
|
|
$this->assertSame( $expected, normalize_whitespace( $input ) );
|
|
}
|
|
|
|
/**
|
|
* Data provider.
|
|
*
|
|
* @return array {
|
|
* @type array {
|
|
* @type string $input Input content.
|
|
* @type string $expected Expected output.
|
|
* }
|
|
* }
|
|
*/
|
|
public function data_normalize_whitespace() {
|
|
return array(
|
|
array(
|
|
' ',
|
|
'',
|
|
),
|
|
array(
|
|
"\rTEST\r",
|
|
'TEST',
|
|
),
|
|
array(
|
|
"\r\nMY TEST CONTENT\r\n",
|
|
'MY TEST CONTENT',
|
|
),
|
|
array(
|
|
"MY\r\nTEST\r\nCONTENT ",
|
|
"MY\nTEST\nCONTENT",
|
|
),
|
|
array(
|
|
"\tMY\rTEST\rCONTENT ",
|
|
"MY\nTEST\nCONTENT",
|
|
),
|
|
array(
|
|
"\tMY\t\t\tTEST\r\t\t\rCONTENT ",
|
|
"MY TEST\n \nCONTENT",
|
|
),
|
|
array(
|
|
"\tMY TEST \t\t\t CONTENT ",
|
|
'MY TEST CONTENT',
|
|
),
|
|
);
|
|
}
|
|
}
|