Changeset 42343 for trunk/tests/phpunit/tests/formatting/EscHtml.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/EscHtml.php
r33271 r42343 7 7 function test_esc_html_basics() { 8 8 // Simple string 9 $html = "The quick brown fox.";9 $html = 'The quick brown fox.'; 10 10 $this->assertEquals( $html, esc_html( $html ) ); 11 11 12 12 // URL with & 13 $html = "http://localhost/trunk/wp-login.php?action=logout&_wpnonce=cd57d75985";14 $escaped = "http://localhost/trunk/wp-login.php?action=logout&_wpnonce=cd57d75985";13 $html = 'http://localhost/trunk/wp-login.php?action=logout&_wpnonce=cd57d75985'; 14 $escaped = 'http://localhost/trunk/wp-login.php?action=logout&_wpnonce=cd57d75985'; 15 15 $this->assertEquals( $escaped, esc_html( $html ) ); 16 16 17 17 // SQL query 18 $html = "SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN ('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled') AND site_id = 1";19 $escaped = "SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN ('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled') AND site_id = 1";18 $html = "SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN ('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled') AND site_id = 1"; 19 $escaped = 'SELECT meta_key, meta_value FROM wp_trunk_sitemeta WHERE meta_key IN ('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled') AND site_id = 1'; 20 20 $this->assertEquals( $escaped, esc_html( $html ) ); 21 21 } 22 22 23 23 function test_escapes_ampersands() { 24 $source = "penn & teller & at&t";25 $res = "penn & teller & at&t";26 $this->assertEquals( $res, esc_html( $source) );24 $source = 'penn & teller & at&t'; 25 $res = 'penn & teller & at&t'; 26 $this->assertEquals( $res, esc_html( $source ) ); 27 27 } 28 28 29 29 function test_escapes_greater_and_less_than() { 30 $source = "this > that < that <randomhtml />";31 $res = "this > that < that <randomhtml />";32 $this->assertEquals( $res, esc_html( $source) );30 $source = 'this > that < that <randomhtml />'; 31 $res = 'this > that < that <randomhtml />'; 32 $this->assertEquals( $res, esc_html( $source ) ); 33 33 } 34 34 35 35 function test_ignores_existing_entities() { 36 36 $source = '& £ " &'; 37 $res = '& £ " &';38 $this->assertEquals( $res, esc_html( $source) );37 $res = '& £ " &'; 38 $this->assertEquals( $res, esc_html( $source ) ); 39 39 } 40 40 }
Note: See TracChangeset
for help on using the changeset viewer.