Changeset 749 in tests for wp-testcase/test_includes_wp-styles.php
- Timestamp:
- 06/28/2012 08:05:14 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_includes_wp-styles.php
r581 r749 34 34 $this->assertEquals("", get_echo('wp_print_styles')); 35 35 } 36 37 /** 38 * Test the different protocol references in wp_enqueue_style 39 * @global WP_Styles $wp_styles 40 */ 41 public function test_protocols() { 42 $this->knownWPBug( 16560 ); 43 44 // Init 45 global $wp_styles; 46 $base_url_backup = $wp_styles->base_url; 47 $wp_styles->base_url = 'http://example.com/wordpress'; 48 $expected = ''; 49 $ver = get_bloginfo( 'version' ); 50 51 // Try with an HTTP reference 52 wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 53 $expected .= "<link rel='stylesheet' id='reset-css-http-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 54 55 // Try with an HTTPS reference 56 wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 57 $expected .= "<link rel='stylesheet' id='reset-css-https-css' href='http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 58 59 // Try with an automatic protocol reference (//) 60 wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 61 $expected .= "<link rel='stylesheet' id='reset-css-doubleslash-css' href='//yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 62 63 // Try with a local resource and an automatic protocol reference (//) 64 $url = '/' . plugins_url( '/my_plugin/style.css'); 65 wp_enqueue_style( 'plugin-style', $url ); 66 $expected .= "<link rel='stylesheet' id='plugin-style-css' href='$url?ver=$ver' type='text/css' media='all' />\n"; 67 68 // Try with a bad protocol 69 wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' ); 70 $expected .= "<link rel='stylesheet' id='reset-css-ftp-css' href='{$wp_styles->base_url}ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css?ver=$ver' type='text/css' media='all' />\n"; 71 72 // Go! 73 $this->assertEquals( $expected, get_echo( 'wp_print_styles' ) ); 74 75 // No styles left to print 76 $this->assertEquals( '', get_echo( 'wp_print_styles' ) ); 77 78 // Cleanup 79 $wp_styles->base_url = $base_url_backup; 80 } 36 81 } 37 82 ?>
Note: See TracChangeset
for help on using the changeset viewer.