mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
Correctly set the scheme of the home and siteurl options when creating a new site on multisite that uses some combination of HTTPS in the admin area or on the front end.
Fixes #33620 Props tryon, johnbillion git-svn-id: https://develop.svn.wordpress.org/trunk@34916 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1000,6 +1000,67 @@ class Tests_Multisite_Site extends WP_UnitTestCase {
|
||||
$blogaddress = get_blogaddress_by_id( 42 );
|
||||
$this->assertEquals( '', $blogaddress );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33620
|
||||
* @dataProvider data_new_blog_url_schemes
|
||||
*/
|
||||
function test_new_blog_url_schemes( $home_scheme, $siteurl_scheme, $force_ssl_admin ) {
|
||||
$current_site = get_current_site();
|
||||
|
||||
$home = get_option( 'home' );
|
||||
$siteurl = get_site_option( 'siteurl' );
|
||||
$admin = force_ssl_admin();
|
||||
|
||||
// Setup:
|
||||
update_option( 'home', set_url_scheme( $home, $home_scheme ) );
|
||||
update_site_option( 'siteurl', set_url_scheme( $siteurl, $siteurl_scheme ) );
|
||||
force_ssl_admin( $force_ssl_admin );
|
||||
|
||||
// Install:
|
||||
$new = wpmu_create_blog( $current_site->domain, '/new-blog/', 'New Blog', get_current_user_id() );
|
||||
|
||||
// Reset:
|
||||
update_option( 'home', $home );
|
||||
update_site_option( 'siteurl', $siteurl );
|
||||
force_ssl_admin( $admin );
|
||||
|
||||
// Assert:
|
||||
$this->assertNotWPError( $new );
|
||||
$this->assertSame( $home_scheme, parse_url( get_blog_option( $new, 'home' ), PHP_URL_SCHEME ) );
|
||||
$this->assertSame( $siteurl_scheme, parse_url( get_blog_option( $new, 'siteurl' ), PHP_URL_SCHEME ) );
|
||||
}
|
||||
|
||||
function data_new_blog_url_schemes() {
|
||||
return array(
|
||||
array(
|
||||
'https',
|
||||
'https',
|
||||
false,
|
||||
),
|
||||
array(
|
||||
'http',
|
||||
'https',
|
||||
false,
|
||||
),
|
||||
array(
|
||||
'https',
|
||||
'http',
|
||||
false,
|
||||
),
|
||||
array(
|
||||
'http',
|
||||
'http',
|
||||
false,
|
||||
),
|
||||
array(
|
||||
'http',
|
||||
'http',
|
||||
true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user