WordPress.org

Make WordPress Core

Changeset 705 in tests


Ignore:
Timestamp:
05/01/2012 05:27:20 PM (6 years ago)
Author:
ryan
Message:

feed: tests

Location:
wp-testcase
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r698 r705  
    596596        $this->assertEquals( 'http://баба.org/баба', esc_url( 'http://баба.org/баба' ) );
    597597        $this->assertEquals( 'http://müller.com/', esc_url( 'http://müller.com/' ) );
     598    }
     599
     600    function test_feed() {
     601        $this->assertEquals( '', esc_url( 'feed:javascript:alert(1)' ) );
     602        $this->assertEquals( '', esc_url( 'feed:javascript:feed:alert(1)' ) );
     603        $this->assertEquals( '', esc_url( 'feed:feed:javascript:alert(1)' ) );
     604        $this->assertEquals( 'feed:feed:alert(1)', esc_url( 'feed:feed:alert(1)' ) );
     605        $this->assertEquals( 'feed:http://wordpress.org/feed/', esc_url( 'feed:http://wordpress.org/feed/' ) );
    598606    }
    599607}
  • wp-testcase/test_includes_kses.php

    r569 r705  
    6363        }
    6464    }
     65
     66    function test_feed_links() {
     67        global $allowedposttags;
     68
     69        $content = <<<EOF
     70<a href="feed:javascript:alert(1)">CLICK ME</a>
     71<a href="feed:javascript:feed:alert(1)">CLICK ME</a>
     72<a href="feed:feed:javascript:alert(1)">CLICK ME</a>
     73<a href="javascript:feed:alert(1)">CLICK ME</a>
     74<a href="javascript:feed:javascript:alert(1)">CLICK ME</a>
     75<a href="feed:feed:feed:javascript:alert(1)">CLICK ME</a>
     76<a href="feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
     77<a href="feed:feed:feed:feed:feed:javascript:alert(1)">CLICK ME</a>
     78<a href="feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
     79<a href="feed:javascript:feed:javascript:feed:javascript:feed:javascript:feed:javascript:alert(1)">CLICK ME</a>
     80<a href="feed:feed:feed:http:alert(1)">CLICK ME</a>
     81EOF;
     82
     83        $expected = <<<EOF
     84<a href="feed:alert(1)">CLICK ME</a>
     85<a href="feed:feed:alert(1)">CLICK ME</a>
     86<a href="feed:feed:alert(1)">CLICK ME</a>
     87<a href="feed:alert(1)">CLICK ME</a>
     88<a href="feed:alert(1)">CLICK ME</a>
     89<a href="">CLICK ME</a>
     90<a href="">CLICK ME</a>
     91<a href="">CLICK ME</a>
     92<a href="">CLICK ME</a>
     93<a href="">CLICK ME</a>
     94<a href="">CLICK ME</a>
     95EOF;
     96
     97    $this->assertEquals( $expected, wp_kses( $content, $allowedposttags ) );
     98    }
    6599}
Note: See TracChangeset for help on using the changeset viewer.