WordPress.org

Make WordPress Core

Changeset 1034 in tests


Ignore:
Timestamp:
09/21/12 12:38:00 (19 months ago)
Author:
ryan
Message:

Test https in home option. see #WP20759

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/url.php

    r1001 r1034  
    153153        $this->assertEquals( $home, home_url() ); 
    154154 
     155 
     156        // Test with https in home 
     157        update_option( 'home', set_url_scheme( $home, 'https' ) ); 
     158 
     159        // Pretend to be in the site admin 
     160        set_current_screen( 'dashboard' ); 
     161        $home = get_option('home'); 
     162 
     163        // home_url() should return whatever scheme is set in the home option when in the admin 
     164        $_SERVER['HTTPS'] = 'on'; 
     165        $this->assertEquals( $home, home_url() ); 
     166 
     167        $_SERVER['HTTPS'] = 'off'; 
     168        $this->assertEquals( $home, home_url() ); 
     169 
     170        // If not in the admin, is_ssl() should determine the scheme unless https hard-coded in home 
     171        set_current_screen( 'front' ); 
     172        $this->assertEquals( $home, home_url() ); 
     173        $_SERVER['HTTPS'] = 'on'; 
     174        $this->assertEquals( $home, home_url() ); 
     175        $_SERVER['HTTPS'] = 'off'; 
     176        $this->assertEquals( $home, home_url() ); 
     177 
     178        update_option( 'home', set_url_scheme( $home, 'http' ) ); 
     179 
    155180        $GLOBALS['current_screen'] = $screen; 
    156181    } 
Note: See TracChangeset for help on using the changeset viewer.