WordPress.org

Make WordPress Core

Changeset 726 in tests


Ignore:
Timestamp:
05/29/12 14:23:41 (2 years ago)
Author:
westi
Message:

Add simple esc_url test cases for square brackets in urls. Some we expect it to encode and some we expect it to leave alone. See #WP16859

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r725 r726  
    331331            $this->assertEquals( $urls_expected[$key], make_clickable( $url ) ); 
    332332        } 
    333  
    334333    } 
    335334} 
     
    620619        $this->assertEquals( 'feed:feed:alert(1)', esc_url( 'feed:feed:alert(1)' ) ); 
    621620        $this->assertEquals( 'feed:http://wordpress.org/feed/', esc_url( 'feed:http://wordpress.org/feed/' ) ); 
     621    } 
     622 
     623    function test_square_brackets() { 
     624        $this->knownWPBug( 16859 ); 
     625        $this->assertEquals( 'http://example.com/?foo%5Bbar%5D=baz', esc_url( 'http://example.com/?foo[bar]=baz' ) ); 
     626        $this->assertEquals( 'http://example.com/?baz=bar&foo%5Bbar%5D=baz', esc_url( 'http://example.com/?baz=bar&foo[bar]=baz' ) ); 
     627        //IPv6 addresses in urls - RFC2732 
     628        $this->assertEquals( 'http://[::FFFF::127.0.0.1]', esc_url( 'http://[::FFFF::127.0.0.1]' ) ); 
     629        $this->assertEquals( 'http://[::127.0.0.1]', esc_url( 'http://[::127.0.0.1]' ) ); 
     630        $this->assertEquals( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]', esc_url( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]' ) ); 
    622631    } 
    623632} 
Note: See TracChangeset for help on using the changeset viewer.