Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/EscHtml.php

    r33271 r42343  
    77    function test_esc_html_basics() {
    88        // Simple string
    9         $html = "The quick brown fox.";
     9        $html = 'The quick brown fox.';
    1010        $this->assertEquals( $html, esc_html( $html ) );
    1111
    1212        // 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';
    1515        $this->assertEquals( $escaped, esc_html( $html ) );
    1616
    1717        // 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';
    2020        $this->assertEquals( $escaped, esc_html( $html ) );
    2121    }
    2222
    2323    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 ) );
    2727    }
    2828
    2929    function test_escapes_greater_and_less_than() {
    30         $source = "this > that < that <randomhtml />";
    31         $res = "this &gt; that &lt; that &lt;randomhtml /&gt;";
    32         $this->assertEquals( $res, esc_html($source) );
     30        $source = 'this > that < that <randomhtml />';
     31        $res    = 'this &gt; that &lt; that &lt;randomhtml /&gt;';
     32        $this->assertEquals( $res, esc_html( $source ) );
    3333    }
    3434
    3535    function test_ignores_existing_entities() {
    3636        $source = '&#038; &#x00A3; &#x22; &amp;';
    37         $res = '&#038; &#xA3; &#x22; &amp;';
    38         $this->assertEquals( $res, esc_html($source) );
     37        $res    = '&#038; &#xA3; &#x22; &amp;';
     38        $this->assertEquals( $res, esc_html( $source ) );
    3939    }
    4040}
Note: See TracChangeset for help on using the changeset viewer.