WordPress.org

Make WordPress Core

Changeset 229 in tests


Ignore:
Timestamp:
06/20/2009 05:18:42 PM (12 years ago)
Author:
westi
Message:

Expand the test cases for clean_url()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r226 r229  
    227227    function test_spaces() {
    228228        $this->assertEquals('http://example.com/Mr WordPress', clean_url('http://example.com/Mr WordPress'));
    229         $this->assertEquals('http://example.com/Mr%20WordPress', clean_url('http://example.com/Mr&20WordPress'));
     229        $this->assertEquals('http://example.com/Mr%20WordPress', clean_url('http://example.com/Mr%20WordPress'));
     230    }
     231   
     232    function test_bad_characters() {
     233        $this->assertEquals('http://example.com/watchthelinefeedgo', clean_url('http://example.com/watchthelinefeed%0Ago'));
     234        $this->assertEquals('http://example.com/watchthelinefeedgo', clean_url('http://example.com/watchthelinefeed%0ago'));
     235        $this->assertEquals('http://example.com/watchthecarriagereturngo', clean_url('http://example.com/watchthecarriagereturn%0Dgo'));
     236        $this->assertEquals('http://example.com/watchthecarriagereturngo', clean_url('http://example.com/watchthecarriagereturn%0dgo'));
     237        //Nesting Checks
     238        $this->assertEquals('http://example.com/watchthecarriagereturngo', clean_url('http://example.com/watchthecarriagereturn%0%0ddgo'));
     239        $this->assertEquals('http://example.com/watchthecarriagereturngo', clean_url('http://example.com/watchthecarriagereturn%0%0DDgo'));
     240    }
     241
     242    function test_relative() {
     243        $this->assertEquals('/example.php', clean_url('/example.php'));
     244        $this->assertEquals('example.php', clean_url('example.php'));
     245    }
     246   
     247    function test_protocol() {
     248        $this->assertEquals('http://example.com', clean_url('http://example.com'));
     249        $this->assertEquals('', clean_url('nasty://example.com/'));
     250    }
     251   
     252    function test_display_extras() {
     253        $this->assertEquals('http://example.com/'quoted'', clean_url('http://example.com/\'quoted\''));
     254        $this->assertEquals('http://example.com/\'quoted\'', clean_url('http://example.com/\'quoted\'',null,'notdisplay'));
    230255    }
    231256}
Note: See TracChangeset for help on using the changeset viewer.