| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @group formatting |
| 5 | */ |
| 6 | class Tests_Formatting_SanitizeHtmlClass extends WP_UnitTestCase { |
| 7 | |
| 8 | /** |
| 9 | * @covers ::sanitize_html_class |
| 10 | */ |
| 11 | public function test_fallback_empty() { |
| 12 | $result = sanitize_html_class( '' ); |
| 13 | $this->assertEquals( '', $result ); |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * @covers ::sanitize_html_class |
| 18 | */ |
| 19 | public function test_fallback_with_only_hyphens() { |
| 20 | $result = sanitize_html_class( '---' ); |
| 21 | $this->assertEquals( '', $result ); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * @covers ::sanitize_html_class |
| 26 | * @ticket 30883 |
| 27 | */ |
| 28 | public function test_fallback_hyphens_after_percent_encoded_octets() { |
| 29 | $s1 = sanitize_html_class( '%d0%b2%d1%82%d0%be%d1%80%d0%b0%d1%8f-%d1%80%d1%83%d0%b1%d1%80%d0%b8%d0%ba%d0%b0' ); |
| 30 | $s2 = sanitize_html_class( '%d0%bf%d0%b5%d1%80%d0%b2%d0%b0%d1%8f-%d1%80%d1%83%d0%b1%d1%80%d0%b8%d0%ba%d0%b0' ); |
| 31 | |
| 32 | $this->assertEquals( '', $s1 ); |
| 33 | $this->assertEquals( '', $s2 ); |
| 34 | } |
| 35 | |
| 36 | } |