Use https URLs for wordpress.com assets in `Tests_HTTP_Functions`.

The http->https redirects were breaking some of the tests.

Fixes #31091.

git-svn-id: https://develop.svn.wordpress.org/trunk@31258 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-01-21 18:43:03 +00:00
parent ab551d8dac
commit cabab6c140
1 changed files with 14 additions and 6 deletions

View File

@ -5,9 +5,17 @@
* @group external-http
*/
class Tests_HTTP_Functions extends WP_UnitTestCase {
public function setUp() {
if ( ! extension_loaded( 'openssl' ) ) {
$this->markTestSkipped( 'Tests_HTTP_Functions requires openssl.' );
}
parent::setUp();
}
function test_head_request() {
// this url give a direct 200 response
$url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
$response = wp_remote_head( $url );
$headers = wp_remote_retrieve_headers( $response );
@ -19,13 +27,13 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
function test_head_redirect() {
// this url will 301 redirect
$url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
$url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
$response = wp_remote_head( $url );
$this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
}
function test_head_404() {
$url = 'http://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/awefasdfawef.jpg';
$headers = wp_remote_head( $url );
$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
@ -33,7 +41,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
}
function test_get_request() {
$url = 'http://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
$url = 'https://asdftestblog1.files.wordpress.com/2007/09/2007-06-30-dsc_4700-1.jpg';
$file = tempnam('/tmp', 'testfile');
$headers = wp_get_http($url, $file);
@ -51,7 +59,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
function test_get_redirect() {
// this will redirect to asdftestblog1.files.wordpress.com
$url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
$url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
$file = tempnam('/tmp', 'testfile');
$headers = wp_get_http($url, $file);
@ -69,7 +77,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
function test_get_redirect_limit_exceeded() {
// this will redirect to asdftestblog1.files.wordpress.com
$url = 'http://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
$url = 'https://asdftestblog1.wordpress.com/files/2007/09/2007-06-30-dsc_4700-1.jpg';
$file = tempnam('/tmp', 'testfile');
// pretend we've already redirected 5 times
$headers = wp_get_http( $url, $file, 6 );