mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Move PHPUnit tests into a tests/phpunit directory.
wp-tests-config.php can/should reside in the root of a develop checkout. `phpunit` should be run from the root. see #25088. git-svn-id: https://develop.svn.wordpress.org/trunk@25165 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @group formatting
|
||||
*/
|
||||
class Tests_Formatting_SanitizeTextField extends WP_UnitTestCase {
|
||||
// #11528
|
||||
function test_sanitize_text_field() {
|
||||
$inputs = array(
|
||||
'оРангутанг', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
|
||||
'САПР', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space.
|
||||
'one is < two',
|
||||
'tags <span>are</span> <em>not allowed</em> here',
|
||||
' we should trim leading and trailing whitespace ',
|
||||
'we also trim extra internal whitespace',
|
||||
'tabs get removed too',
|
||||
'newlines are not welcome
|
||||
here',
|
||||
'We also %AB remove %ab octets',
|
||||
'We don\'t need to wory about %A
|
||||
B removing %a
|
||||
b octets even when %a B they are obscured by whitespace',
|
||||
'%AB%BC%DE', //Just octets
|
||||
'Invalid octects remain %II',
|
||||
'Nested octects %%%ABABAB %A%A%ABBB',
|
||||
);
|
||||
$expected = array(
|
||||
'оРангутанг',
|
||||
'САПР',
|
||||
'one is < two',
|
||||
'tags are not allowed here',
|
||||
'we should trim leading and trailing whitespace',
|
||||
'we also trim extra internal whitespace',
|
||||
'tabs get removed too',
|
||||
'newlines are not welcome here',
|
||||
'We also remove octets',
|
||||
'We don\'t need to wory about %A B removing %a b octets even when %a B they are obscured by whitespace',
|
||||
'', //Emtpy as we strip all the octets out
|
||||
'Invalid octects remain %II',
|
||||
'Nested octects',
|
||||
);
|
||||
|
||||
foreach ($inputs as $key => $input) {
|
||||
$this->assertEquals($expected[$key], sanitize_text_field($input));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user