Make WordPress Core


Ignore:
Timestamp:
10/07/2015 09:45:17 PM (11 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/site.php

    r34902 r34916  
    10011001                $this->assertEquals( '', $blogaddress );
    10021002        }
     1003
     1004        /**
     1005         * @ticket 33620
     1006         * @dataProvider data_new_blog_url_schemes
     1007         */
     1008        function test_new_blog_url_schemes( $home_scheme, $siteurl_scheme, $force_ssl_admin ) {
     1009                $current_site = get_current_site();
     1010
     1011                $home    = get_option( 'home' );
     1012                $siteurl = get_site_option( 'siteurl' );
     1013                $admin   = force_ssl_admin();
     1014
     1015                // Setup:
     1016                update_option( 'home', set_url_scheme( $home, $home_scheme ) );
     1017                update_site_option( 'siteurl', set_url_scheme( $siteurl, $siteurl_scheme ) );
     1018                force_ssl_admin( $force_ssl_admin );
     1019
     1020                // Install:
     1021                $new = wpmu_create_blog( $current_site->domain, '/new-blog/', 'New Blog', get_current_user_id() );
     1022
     1023                // Reset:
     1024                update_option( 'home', $home );
     1025                update_site_option( 'siteurl', $siteurl );
     1026                force_ssl_admin( $admin );
     1027
     1028                // Assert:
     1029                $this->assertNotWPError( $new );
     1030                $this->assertSame( $home_scheme, parse_url( get_blog_option( $new, 'home' ), PHP_URL_SCHEME ) );
     1031                $this->assertSame( $siteurl_scheme, parse_url( get_blog_option( $new, 'siteurl' ), PHP_URL_SCHEME ) );
     1032        }
     1033
     1034        function data_new_blog_url_schemes() {
     1035                return array(
     1036                        array(
     1037                                'https',
     1038                                'https',
     1039                                false,
     1040                        ),
     1041                        array(
     1042                                'http',
     1043                                'https',
     1044                                false,
     1045                        ),
     1046                        array(
     1047                                'https',
     1048                                'http',
     1049                                false,
     1050                        ),
     1051                        array(
     1052                                'http',
     1053                                'http',
     1054                                false,
     1055                        ),
     1056                        array(
     1057                                'http',
     1058                                'http',
     1059                                true,
     1060                        ),
     1061                );
     1062        }
     1063
    10031064}
    10041065
Note: See TracChangeset for help on using the changeset viewer.