WordPress.org

Make WordPress Core

Changeset 317 in tests


Ignore:
Timestamp:
11/10/10 18:04:37 (4 years ago)
Author:
westi
Message:

Extra tests for wptexturize from #WP4539 props norbertm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r315 r317  
    387387    } 
    388388     
     389    //WP Ticket #4539 
     390    function test_basic_quotes() { 
     391        $this->assertEquals('test’s', wptexturize('test\'s')); 
     392        $this->assertEquals('test’s', wptexturize('test\'s')); 
     393 
     394        $this->assertEquals('‘quoted’', wptexturize('\'quoted\'')); 
     395        $this->assertEquals('“quoted”', wptexturize('"quoted"')); 
     396 
     397        $this->assertEquals('(‘quoted’)', wptexturize('(\'quoted\')')); 
     398        $this->assertEquals('{“quoted”}', wptexturize('{"quoted"}')); 
     399 
     400        $this->assertEquals('‘qu(ot)ed’', wptexturize('\'qu(ot)ed\'')); 
     401        $this->assertEquals('“qu{ot}ed”', wptexturize('"qu{ot}ed"')); 
     402 
     403        $this->assertEquals('‘test’s quoted’', wptexturize('\'test\'s quoted\'')); 
     404        $this->assertEquals('“test’s quoted”', wptexturize('"test\'s quoted"')); 
     405    } 
     406     
     407    //WP Ticket #4539 
    389408    function test_quotes() { 
    390409        $this->knownWPBug(4539); 
    391410        $this->assertEquals('“Quoted String”', wptexturize('"Quoted String"')); 
    392411        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"')); 
    393         $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link and a period </a>&#8221;.', wptexturize('Here is "<a href="http://example.com">a test with a link and a period</a>".')); 
     412        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link and a period</a>&#8221;.', wptexturize('Here is "<a href="http://example.com">a test with a link and a period</a>".')); 
    394413        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221; and a space.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>" and a space.')); 
    395414        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a> and some text quoted&#8221;', wptexturize('Here is "<a href="http://example.com">a test with a link</a> and some text quoted"')); 
     
    397416        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;; and a semi-colon.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"; and a semi-colon.')); 
    398417        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;- and a dash.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"- and a dash.')); 
    399         $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;... and ellipses.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"... and ellipses.')); 
     418        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;&#8230; and ellipses.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"... and ellipses.')); 
    400419        $this->assertEquals('Here is &#8220;a test <a href="http://example.com">with a link</a>&#8221;.', wptexturize('Here is "a test <a href="http://example.com">with a link</a>".')); 
    401420        $this->assertEquals('Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;and a work stuck to the end.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"and a work stuck to the end.')); 
     
    404423    } 
    405424     
    406     //WP Ticket #1258 
     425    //WP Ticket #4539 
    407426    function test_quotes_before_s() { 
    408427        $this->knownWPBug(4539); 
     
    418437        $this->knownWPBug(4539); 
    419438        $this->assertEquals('Class of &#8217;99', wptexturize("Class of '99")); 
     439        $this->assertEquals('Class of &#8217;99&#8217;s', wptexturize("Class of '99's")); 
    420440        $this->assertEquals('&#8216;Class of &#8217;99&#8217;', wptexturize("'Class of '99'")); 
    421     } 
    422      
     441        $this->assertEquals('&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize("'Class of '99's'")); 
     442        $this->assertEquals('&#8216;Class of &#8217;99&#8217;s&#8217;', wptexturize("'Class of '99&#8217;s'")); 
     443        $this->assertEquals('&#8220;Class of 99&#8221;', wptexturize("\"Class of 99\"")); 
     444        $this->assertEquals('&#8220;Class of &#8217;99&#8221;', wptexturize("\"Class of '99\"")); 
     445    } 
     446     
     447    function test_quotes_after_numbers() { 
     448        $this->assertEquals('Class of &#8217;99', wptexturize("Class of '99")); 
     449    } 
     450     
     451    //WP Ticket #15241 
    423452    function test_other_html() { 
    424453        $this->knownWPBug(15241); 
     454        $this->assertEquals('&#8216;<strong>', wptexturize("'<strong>")); 
    425455        $this->assertEquals('&#8216;<strong>Quoted Text</strong>&#8217;,', wptexturize("'<strong>Quoted Text</strong>',")); 
    426456        $this->assertEquals('&#8220;<strong>Quoted Text</strong>&#8221;,', wptexturize('"<strong>Quoted Text</strong>",')); 
     457    } 
     458     
     459    function test_x() { 
     460        $this->assertEquals('14&#215;24', wptexturize("14x24")); 
     461    } 
     462     
     463    function test_minutes_seconds() { 
     464        $this->assertEquals('9&#8242;', wptexturize('9\'')); 
     465        $this->assertEquals('9&#8243;', wptexturize("9\"")); 
     466 
     467        $this->assertEquals('a 9&#8242; b', wptexturize('a 9\' b')); 
     468        $this->assertEquals('a 9&#8243; b', wptexturize("a 9\" b")); 
     469         
     470        $this->assertEquals('&#8220;a 9&#8242; b&#8221;', wptexturize('"a 9\' b"')); 
     471        $this->assertEquals('&#8216;a 9&#8243; b&#8217;', wptexturize("'a 9\" b'")); 
    427472    } 
    428473} 
Note: See TracChangeset for help on using the changeset viewer.