Skip to:
Content

BuddyPress.org

Changeset 11255


Ignore:
Timestamp:
11/28/2016 01:45:21 PM (10 years ago)
Author:
djpaul
Message:

Tests: fix test_bp_core_ajax_url() not passing after r11254.

Fixes #7367

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/routing/url.php

    r9819 r11255  
    66        function test_bp_core_ajax_url() {
    77                $forced = force_ssl_admin();
     8                $old_https = isset( $_SERVER['HTTPS'] ) ? $_SERVER['HTTPS'] : null;
    89
    910                // (1) HTTPS off
     
    2728
    2829                // (2b) Dashboard
     30                $_SERVER['HTTPS'] = 'on';
    2931                $this->go_to( '/wp-admin' );
    3032                $this->assertEquals( bp_core_ajax_url(), get_site_url( bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'https' ) );
    3133
     34                // Restore to defaults.
    3235                force_ssl_admin( $forced );
     36                if ( is_null( $old_https ) ) {
     37                        unset( $_SERVER['HTTPS'] );
     38                } else {
     39                        $_SERVER['HTTPS'] = $old_https;
     40                }
    3341
    3442                // (3) Multisite, root blog other than 1
     
    3846                                'path' => '/path' . rand() . time() . '/',
    3947                        ) );
     48
    4049                        buddypress()->root_blog_id = $blog_id;
    41 
    4250                        $blog_url = get_blog_option( $blog_id, 'siteurl' );
    4351
    4452                        $this->go_to( trailingslashit( $blog_url ) );
     53                        switch_to_blog( $blog_id );
     54
    4555                        buddypress()->root_blog_id = $original_root_blog;
    4656                        $ajax_url = bp_core_ajax_url();
     57
     58                        restore_current_blog();
    4759                        $this->go_to( '/' );
    4860
Note: See TracChangeset for help on using the changeset viewer.