Make WordPress Core

Ticket #34202: 34202.tests.diff

File 34202.tests.diff, 1.1 KB (added by johnbillion, 10 years ago)
  • tests/phpunit/tests/formatting/EscUrl.php

     
    210210                $this->assertEmpty( esc_url_raw('"^<>{}`') );
    211211        }
    212212
     213        /**
     214         * @ticket 34202
     215         */
     216        function test_ipv6_hosts() {
     217                $this->assertEquals( '//[::127.0.0.1]', esc_url( '//[::127.0.0.1]' ) );
     218                $this->assertEquals( 'http://[::FFFF::127.0.0.1]', esc_url( 'http://[::FFFF::127.0.0.1]' ) );
     219                $this->assertEquals( 'http://[::127.0.0.1]', esc_url( 'http://[::127.0.0.1]' ) );
     220                $this->assertEquals( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]', esc_url( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]' ) );
     221
     222                // IPv6 with square brackets in the query? Why not.
     223                $this->assertEquals( '//[::FFFF::127.0.0.1]/?foo%5Bbar%5D=baz', esc_url( '//[::FFFF::127.0.0.1]/?foo[bar]=baz' ) );
     224                $this->assertEquals( 'http://[::FFFF::127.0.0.1]/?foo%5Bbar%5D=baz', esc_url( 'http://[::FFFF::127.0.0.1]/?foo[bar]=baz' ) );
     225        }
     226
    213227}