WordPress.org

Make WordPress Core

Changeset 524 in tests


Ignore:
Timestamp:
02/10/12 13:45:07 (2 years ago)
Author:
duck_
Message:

make_clickable() tests for URLs preceded by punctuation without a space. See #WP16892.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r490 r524  
    187187            'Example: WordPress, test (some text), I love example.com (http://example.org), it is brilliant', 
    188188            'Example: WordPress, test (some text), I love example.com (http://example.com), it is brilliant', 
    189             'Some text followed by a bracketed link with a trailing elipsis (http://example.com)...' 
     189            'Some text followed by a bracketed link with a trailing elipsis (http://example.com)...', 
     190            'In his famous speech “You and Your research” (here: http://www.cs.virginia.edu/~robins/YouAndYourResearch.html) Richard Hamming wrote about people getting more done with their doors closed...', 
    190191        ); 
    191192        $urls_expected = array( 
    192193            'Example: WordPress, test (some text), I love example.com (<a href="http://example.org" rel="nofollow">http://example.org</a>), it is brilliant', 
    193194            'Example: WordPress, test (some text), I love example.com (<a href="http://example.com" rel="nofollow">http://example.com</a>), it is brilliant', 
    194             'Some text followed by a bracketed link with a trailing elipsis (<a href="http://example.com" rel="nofollow">http://example.com</a>)...' 
     195            'Some text followed by a bracketed link with a trailing elipsis (<a href="http://example.com" rel="nofollow">http://example.com</a>)...', 
     196            'In his famous speech “You and Your research” (here: <a href="http://www.cs.virginia.edu/~robins/YouAndYourResearch.html" rel="nofollow">http://www.cs.virginia.edu/~robins/YouAndYourResearch.html</a>) Richard Hamming wrote about people getting more done with their doors closed...', 
    195197        ); 
    196198        foreach ($urls_before as $key => $url) { 
     
    213215        foreach ($urls_before as $key => $url) { 
    214216            $this->assertEquals($urls_expected[$key], make_clickable($url)); 
     217        } 
     218    } 
     219 
     220    function test_preceded_by_punctuation() { 
     221        $before = array( 
     222            'Comma then URL,http://example.com/', 
     223            'Period then URL.http://example.com/', 
     224            'Semi-colon then URL;http://example.com/', 
     225            'Colon then URL:http://example.com/', 
     226            'Exclamation mark then URL!http://example.com/', 
     227            'Question mark then URL?http://example.com/', 
     228            'URL wrapped in angle brackets <http://example.com/>', 
     229        ); 
     230        $expected = array( 
     231            'Comma then URL,<a href="http://example.com/" rel="nofollow">http://example.com/</a>', 
     232            'Period then URL.<a href="http://example.com/" rel="nofollow">http://example.com/</a>', 
     233            'Semi-colon then URL;<a href="http://example.com/" rel="nofollow">http://example.com/</a>', 
     234            'Colon then URL:<a href="http://example.com/" rel="nofollow">http://example.com/</a>', 
     235            'Exclamation mark then URL!<a href="http://example.com/" rel="nofollow">http://example.com/</a>', 
     236            'Question mark then URL?<a href="http://example.com/" rel="nofollow">http://example.com/</a>', 
     237            'URL wrapped in angle brackets <<a href="http://example.com/" rel="nofollow">http://example.com/</a>>', 
     238        ); 
     239        foreach ($before as $key => $url) { 
     240            $this->assertEquals($expected[$key], make_clickable($url)); 
    215241        } 
    216242    } 
     
    223249            "http://trunk.domain/testing#something 
    224250            (<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)", 
    225             "<span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' /> <param name='allowfullscreen' value='true' /> <param name='wmode' value='opaque' /> <embed src='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'></embed> </object></span>" 
     251            "<span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' /> <param name='allowfullscreen' value='true' /> <param name='wmode' value='opaque' /> <embed src='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'></embed> </object></span>", 
    226252        ); 
    227253        $urls_expected = array( 
     
    231257            "<a href=\"http://trunk.domain/testing#something\" rel=\"nofollow\">http://trunk.domain/testing#something</a> 
    232258            (<img src='http://trunk.domain/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'>)", 
    233             "<span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' /> <param name='allowfullscreen' value='true' /> <param name='wmode' value='opaque' /> <embed src='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'></embed> </object></span>" 
     259            "<span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' /> <param name='allowfullscreen' value='true' /> <param name='wmode' value='opaque' /> <embed src='http://www.youtube.com/v/nd_BdvG43rE&rel=1&fs=1&showsearch=0&showinfo=1&iv_load_policy=1' type='application/x-shockwave-flash' allowfullscreen='true' width='425' height='350' wmode='opaque'></embed> </object></span>", 
    234260        ); 
    235261        foreach ($urls_before as $key => $url) { 
Note: See TracChangeset for help on using the changeset viewer.