Index: wp-testcase/test_includes_wp-scripts.php
===================================================================
--- wp-testcase/test_includes_wp-scripts.php (revision 744)
+++ wp-testcase/test_includes_wp-scripts.php (working copy)
@@ -35,5 +35,50 @@
// No scripts left to print
$this->assertEquals("", get_echo('wp_print_scripts'));
}
+
+ /**
+ * Test the different protocol references in wp_enqueue_script
+ * @global WP_Scripts $wp_scripts
+ */
+ public function test_protocols() {
+ $this->knownWPBug( 16560 );
+
+ // Init
+ global $wp_scripts;
+ $base_url_backup = $wp_scripts->base_url;
+ $wp_scripts->base_url = 'http://localhost/wordpress';
+ $expected = '';
+ $ver = get_bloginfo( 'version' );
+
+ // Try with an HTTP reference
+ wp_enqueue_script( 'jquery-http', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+ $expected .= "\n";
+
+ // Try with an HTTPS reference
+ wp_enqueue_script( 'jquery-https', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+ $expected .= "\n";
+
+ // Try with an automatic protocol reference (//)
+ wp_enqueue_script( 'jquery-doubleslash', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+ $expected .= "\n";
+
+ // Try with a local resource and an automatic protocol reference (//)
+ $url = '/' . plugins_url( '/my_plugin/script.js');
+ wp_enqueue_script( 'plugin-script', $url );
+ $expected .= "\n";
+
+ // Try with a bad protocol
+ wp_enqueue_script( 'jquery-ftp', 'ftp://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );
+ $expected .= "\n";
+
+ // Go!
+ $this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
+
+ // No scripts left to print
+ $this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
+
+ // Cleanup
+ $wp_scripts->base_url = $base_url_backup;
+ }
}
?>
\ No newline at end of file
Index: wp-testcase/test_includes_wp-styles.php
===================================================================
--- wp-testcase/test_includes_wp-styles.php (revision 744)
+++ wp-testcase/test_includes_wp-styles.php (working copy)
@@ -33,5 +33,50 @@
// No styles left to print
$this->assertEquals("", get_echo('wp_print_styles'));
}
+
+ /**
+ * Test the different protocol references in wp_enqueue_style
+ * @global WP_Styles $wp_styles
+ */
+ public function test_protocols() {
+ $this->knownWPBug( 16560 );
+
+ // Init
+ global $wp_styles;
+ $base_url_backup = $wp_styles->base_url;
+ $wp_styles->base_url = 'http://localhost/wordpress';
+ $expected = '';
+ $ver = get_bloginfo( 'version' );
+
+ // Try with an HTTP reference
+ wp_enqueue_style( 'reset-css-http', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+ $expected .= "\n";
+
+ // Try with an HTTPS reference
+ wp_enqueue_style( 'reset-css-https', 'http://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+ $expected .= "\n";
+
+ // Try with an automatic protocol reference (//)
+ wp_enqueue_style( 'reset-css-doubleslash', '//yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+ $expected .= "\n";
+
+ // Try with a local resource and an automatic protocol reference (//)
+ $url = '/' . plugins_url( '/my_plugin/style.css');
+ wp_enqueue_style( 'plugin-style', $url );
+ $expected .= "\n";
+
+ // Try with a bad protocol
+ wp_enqueue_style( 'reset-css-ftp', 'ftp://yui.yahooapis.com/2.8.1/build/reset/reset-min.css' );
+ $expected .= "\n";
+
+ // Go!
+ $this->assertEquals( $expected, get_echo( 'wp_print_styles' ) );
+
+ // No styles left to print
+ $this->assertEquals( '', get_echo( 'wp_print_styles' ) );
+
+ // Cleanup
+ $wp_styles->base_url = $base_url_backup;
+ }
}
?>