Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 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/general/resourceHints.php

    r38826 r42343  
    1212        parent::setUp();
    1313        $this->old_wp_scripts = isset( $GLOBALS['wp_scripts'] ) ? $GLOBALS['wp_scripts'] : null;
    14         $this->old_wp_styles = isset( $GLOBALS['wp_styles'] ) ? $GLOBALS['wp_styles'] : null;
     14        $this->old_wp_styles  = isset( $GLOBALS['wp_styles'] ) ? $GLOBALS['wp_styles'] : null;
    1515
    1616        remove_action( 'wp_default_scripts', 'wp_default_scripts' );
    1717        remove_action( 'wp_default_styles', 'wp_default_styles' );
    1818
    19         $GLOBALS['wp_scripts'] = new WP_Scripts();
     19        $GLOBALS['wp_scripts']                  = new WP_Scripts();
    2020        $GLOBALS['wp_scripts']->default_version = get_bloginfo( 'version' );
    21         $GLOBALS['wp_styles'] = new WP_Styles();
    22         $GLOBALS['wp_styles']->default_version = get_bloginfo( 'version' );
     21        $GLOBALS['wp_styles']                   = new WP_Styles();
     22        $GLOBALS['wp_styles']->default_version  = get_bloginfo( 'version' );
    2323    }
    2424
     
    7272    function test_preconnect() {
    7373        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
    74                     "<link rel='preconnect' href='//wordpress.org' />\n" .
    75                     "<link rel='preconnect' href='https://make.wordpress.org' />\n" .
    76                     "<link rel='preconnect' href='http://google.com' />\n" .
    77                     "<link rel='preconnect' href='http://w.org' />\n";
     74                    "<link rel='preconnect' href='//wordpress.org' />\n" .
     75                    "<link rel='preconnect' href='https://make.wordpress.org' />\n" .
     76                    "<link rel='preconnect' href='http://google.com' />\n" .
     77                    "<link rel='preconnect' href='http://w.org' />\n";
    7878
    7979        add_filter( 'wp_resource_hints', array( $this, '_add_preconnect_domains' ), 10, 2 );
     
    183183
    184184    function test_dns_prefetch_scripts_does_not_included_registered_only() {
    185         $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n";
     185        $expected   = "<link rel='dns-prefetch' href='//s.w.org' />\n";
    186186        $unexpected = "<link rel='dns-prefetch' href='//wordpress.org' />\n";
    187187
     
    249249    function test_custom_attributes() {
    250250        $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" .
    251                     "<link rel='preconnect' href='https://make.wordpress.org' />\n" .
    252                     "<link crossorigin as='image' pr='0.5' href='https://example.com/foo.jpeg' rel='prefetch' />\n" .
    253                     "<link crossorigin='use-credentials' as='style' href='https://example.com/foo.css' rel='prefetch' />\n" .
    254                     "<link href='http://wordpress.org' rel='prerender' />\n";
     251                    "<link rel='preconnect' href='https://make.wordpress.org' />\n" .
     252                    "<link crossorigin as='image' pr='0.5' href='https://example.com/foo.jpeg' rel='prefetch' />\n" .
     253                    "<link crossorigin='use-credentials' as='style' href='https://example.com/foo.css' rel='prefetch' />\n" .
     254                    "<link href='http://wordpress.org' rel='prerender' />\n";
    255255
    256256        add_filter( 'wp_resource_hints', array( $this, '_add_url_with_attributes' ), 10, 2 );
     
    266266        // Ignore hints with missing href attributes.
    267267        $hints[] = array(
    268             'rel'  => 'foo',
     268            'rel' => 'foo',
    269269        );
    270270
Note: See TracChangeset for help on using the changeset viewer.