Changeset 42343 for trunk/tests/phpunit/tests/general/resourceHints.php
- Timestamp:
- 11/30/2017 11:09:33 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/resourceHints.php
r38826 r42343 12 12 parent::setUp(); 13 13 $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; 15 15 16 16 remove_action( 'wp_default_scripts', 'wp_default_scripts' ); 17 17 remove_action( 'wp_default_styles', 'wp_default_styles' ); 18 18 19 $GLOBALS['wp_scripts'] = new WP_Scripts();19 $GLOBALS['wp_scripts'] = new WP_Scripts(); 20 20 $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' ); 23 23 } 24 24 … … 72 72 function test_preconnect() { 73 73 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 74 75 76 77 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"; 78 78 79 79 add_filter( 'wp_resource_hints', array( $this, '_add_preconnect_domains' ), 10, 2 ); … … 183 183 184 184 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"; 186 186 $unexpected = "<link rel='dns-prefetch' href='//wordpress.org' />\n"; 187 187 … … 249 249 function test_custom_attributes() { 250 250 $expected = "<link rel='dns-prefetch' href='//s.w.org' />\n" . 251 252 253 254 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"; 255 255 256 256 add_filter( 'wp_resource_hints', array( $this, '_add_url_with_attributes' ), 10, 2 ); … … 266 266 // Ignore hints with missing href attributes. 267 267 $hints[] = array( 268 'rel' 268 'rel' => 'foo', 269 269 ); 270 270
Note: See TracChangeset
for help on using the changeset viewer.