mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Ensure that the scheme used in the URL returned by get_blogaddress_by_id() always reflects the blog's URL, instead of using http.
Props thomaswm Fixes #14867 git-svn-id: https://develop.svn.wordpress.org/trunk@35446 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1001,6 +1001,39 @@ class Tests_Multisite_Site extends WP_UnitTestCase {
|
||||
$this->assertEquals( '', $blogaddress );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 14867
|
||||
*/
|
||||
function test_get_blogaddress_by_id_scheme_reflects_blog_scheme() {
|
||||
$blog = self::factory()->blog->create();
|
||||
|
||||
$this->assertSame( 'http', parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME ) );
|
||||
|
||||
update_blog_option( $blog, 'home', set_url_scheme( get_blog_option( $blog, 'home' ), 'https' ) );
|
||||
|
||||
$this->assertSame( 'https', parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 14867
|
||||
*/
|
||||
function test_get_blogaddress_by_id_scheme_is_unaffected_by_request() {
|
||||
$blog = self::factory()->blog->create();
|
||||
|
||||
$this->assertFalse( is_ssl() );
|
||||
$this->assertSame( 'http', parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME ) );
|
||||
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
|
||||
$is_ssl = is_ssl();
|
||||
$address = parse_url( get_blogaddress_by_id( $blog ), PHP_URL_SCHEME );
|
||||
|
||||
unset( $_SERVER['HTTPS'] );
|
||||
|
||||
$this->assertTrue( $is_ssl );
|
||||
$this->assertSame( 'http', $address );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33620
|
||||
* @dataProvider data_new_blog_url_schemes
|
||||
|
||||
Reference in New Issue
Block a user