@@ 21-35 (lines=15) @@ | ||
18 | return 'http://example.com/'; |
|
19 | } |
|
20 | ||
21 | function test_wp_sanitize_redirect() { |
|
22 | $this->assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0Ago')); |
|
23 | $this->assertEquals('http://example.com/watchthelinefeedgo', wp_sanitize_redirect('http://example.com/watchthelinefeed%0ago')); |
|
24 | $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0Dgo')); |
|
25 | $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0dgo')); |
|
26 | $this->assertEquals('http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay', wp_sanitize_redirect('http://example.com/watchtheallowedcharacters-~+_.?#=&;,/:%!*stay')); |
|
27 | $this->assertEquals('http://example.com/watchtheutf8convert%F0%9D%8C%86', wp_sanitize_redirect("http://example.com/watchtheutf8convert\xf0\x9d\x8c\x86")); |
|
28 | //Nesting checks |
|
29 | $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0ddgo')); |
|
30 | $this->assertEquals('http://example.com/watchthecarriagereturngo', wp_sanitize_redirect('http://example.com/watchthecarriagereturn%0%0DDgo')); |
|
31 | $this->assertEquals('http://example.com/whyisthisintheurl/?param[1]=foo', wp_sanitize_redirect('http://example.com/whyisthisintheurl/?param[1]=foo')); |
|
32 | $this->assertEquals('http://[2606:2800:220:6d:26bf:1447:aa7]/', wp_sanitize_redirect('http://[2606:2800:220:6d:26bf:1447:aa7]/')); |
|
33 | $this->assertEquals('http://example.com/search.php?search=(amistillhere)', wp_sanitize_redirect('http://example.com/search.php?search=(amistillhere)')); |
|
34 | $this->assertEquals('http://example.com/@username', wp_sanitize_redirect('http://example.com/@username')); |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @dataProvider valid_url_provider |
@@ 48-65 (lines=18) @@ | ||
45 | } |
|
46 | ||
47 | //WP Ticket #4539 |
|
48 | function test_basic_quotes() { |
|
49 | $this->assertEquals('test’s', wptexturize('test\'s')); |
|
50 | ||
51 | $this->assertEquals('‘quoted’', wptexturize('\'quoted\'')); |
|
52 | $this->assertEquals('“quoted”', wptexturize('"quoted"')); |
|
53 | ||
54 | $this->assertEquals('space before ‘quoted’ space after', wptexturize('space before \'quoted\' space after')); |
|
55 | $this->assertEquals('space before “quoted” space after', wptexturize('space before "quoted" space after')); |
|
56 | ||
57 | $this->assertEquals('(‘quoted’)', wptexturize('(\'quoted\')')); |
|
58 | $this->assertEquals('{“quoted”}', wptexturize('{"quoted"}')); |
|
59 | ||
60 | $this->assertEquals('‘qu(ot)ed’', wptexturize('\'qu(ot)ed\'')); |
|
61 | $this->assertEquals('“qu{ot}ed”', wptexturize('"qu{ot}ed"')); |
|
62 | ||
63 | $this->assertEquals(' ‘test’s quoted’ ', wptexturize(' \'test\'s quoted\' ')); |
|
64 | $this->assertEquals(' “test’s quoted” ', wptexturize(' "test\'s quoted" ')); |
|
65 | } |
|
66 | ||
67 | /** |
|
68 | * @ticket 4539 |