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:
parent
ab551d8dac
commit
cabab6c140
@ -5,9 +5,17 @@
|
|||||||
* @group external-http
|
* @group external-http
|
||||||
*/
|
*/
|
||||||
class Tests_HTTP_Functions extends WP_UnitTestCase {
|
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() {
|
function test_head_request() {
|
||||||
// this url give a direct 200 response
|
// 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 );
|
$response = wp_remote_head( $url );
|
||||||
$headers = wp_remote_retrieve_headers( $response );
|
$headers = wp_remote_retrieve_headers( $response );
|
||||||
|
|
||||||
@ -19,13 +27,13 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
|||||||
|
|
||||||
function test_head_redirect() {
|
function test_head_redirect() {
|
||||||
// this url will 301 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 );
|
$response = wp_remote_head( $url );
|
||||||
$this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
|
$this->assertEquals( '301', wp_remote_retrieve_response_code( $response ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_head_404() {
|
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 );
|
$headers = wp_remote_head( $url );
|
||||||
|
|
||||||
$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
|
$this->assertInternalType( 'array', $headers, "Reply wasn't array." );
|
||||||
@ -33,7 +41,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_get_request() {
|
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');
|
$file = tempnam('/tmp', 'testfile');
|
||||||
|
|
||||||
$headers = wp_get_http($url, $file);
|
$headers = wp_get_http($url, $file);
|
||||||
@ -51,7 +59,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
|||||||
|
|
||||||
function test_get_redirect() {
|
function test_get_redirect() {
|
||||||
// this will redirect to asdftestblog1.files.wordpress.com
|
// 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');
|
$file = tempnam('/tmp', 'testfile');
|
||||||
|
|
||||||
$headers = wp_get_http($url, $file);
|
$headers = wp_get_http($url, $file);
|
||||||
@ -69,7 +77,7 @@ class Tests_HTTP_Functions extends WP_UnitTestCase {
|
|||||||
|
|
||||||
function test_get_redirect_limit_exceeded() {
|
function test_get_redirect_limit_exceeded() {
|
||||||
// this will redirect to asdftestblog1.files.wordpress.com
|
// 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');
|
$file = tempnam('/tmp', 'testfile');
|
||||||
// pretend we've already redirected 5 times
|
// pretend we've already redirected 5 times
|
||||||
$headers = wp_get_http( $url, $file, 6 );
|
$headers = wp_get_http( $url, $file, 6 );
|
||||||
|
Loading…
Reference in New Issue
Block a user