Code is Poetry.

WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-11-30 23:09:33 +00:00
parent ec6a089f98
commit 8f95800d52
1103 changed files with 105978 additions and 78184 deletions
@@ -1,52 +1,52 @@
<?php
/**
* @group formatting
*/
class Tests_Formatting_NormalizeWhitespace extends WP_UnitTestCase {
/**
* WhitespaceTest Content DataProvider
*
* array( input_txt, converted_output_txt)
*/
public function get_input_output() {
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"
),
);
}
/**
* Validate the normalize_whitespace function
*
* @dataProvider get_input_output
*/
function test_normalize_whitespace( $in_str, $exp_str ) {
$this->assertEquals($exp_str, normalize_whitespace( $in_str ) );
}
}
<?php
/**
* @group formatting
*/
class Tests_Formatting_NormalizeWhitespace extends WP_UnitTestCase {
/**
* WhitespaceTest Content DataProvider
*
* array( input_txt, converted_output_txt)
*/
public function get_input_output() {
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',
),
);
}
/**
* Validate the normalize_whitespace function
*
* @dataProvider get_input_output
*/
function test_normalize_whitespace( $in_str, $exp_str ) {
$this->assertEquals( $exp_str, normalize_whitespace( $in_str ) );
}
}