WordPress.org

Make WordPress Core

Changeset 283 in tests


Ignore:
Timestamp:
12/23/09 09:37:17 (5 years ago)
Author:
westi
Message:

Add a set of test cases for sanitize_text_field() including the UTF8 ones hilighted by WP#11528.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r276 r283  
    493493} 
    494494 
     495class TestSanitizeTextField extends WPTestCase { 
     496    function test_sanitize_text_field() { 
     497        $this->knownWPBug(11528); 
     498        $inputs = array( 
     499            'оРангутанг', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space. 
     500            'САПР', //Ensure UTF8 text is safe the Р is D0 A0 and A0 is the non-breaking space. 
     501            'one is < two', 
     502            'tags <span>are</span> <em>not allowed</em> here', 
     503            ' we should trim leading and trailing whitespace ', 
     504            'we  also  trim  extra  internal  whitespace', 
     505            'tabs   get removed too', 
     506            'newlines are not welcome  
     507            here', 
     508            'We also %AB remove %ab octets', 
     509        ); 
     510        $expected = array( 
     511            'оРангутанг', 
     512            'САПР', 
     513            'one is &lt; two', 
     514            'tags are not allowed here', 
     515            'we should trim leading and trailing whitespace', 
     516            'we also trim extra internal whitespace', 
     517            'tabs get removed too', 
     518            'newlines are not welcome here', 
     519            'We also remove octets', 
     520        ); 
     521         
     522        foreach ($inputs as $key => $input) { 
     523            $this->assertEquals($expected[$key], sanitize_text_field($input)); 
     524        } 
     525    } 
     526} 
     527 
    495528?> 
Note: See TracChangeset for help on using the changeset viewer.