Make WordPress Core


Ignore:
Timestamp:
02/25/2016 09:17:34 PM (9 years ago)
Author:
johnbillion
Message:

Move some assertions in HTTPS related tests, so failures that occur before the environment reset don't result in a contaminated test environment.

See #35954

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rewrite.php

    r36307 r36711  
    106106        // Save server data for cleanup
    107107        $is_ssl = is_ssl();
    108         $http_host = $_SERVER['HTTP_HOST'];
    109108
    110109        $_SERVER['HTTPS'] = 'on';
    111110
    112         $post_id = self::factory()->post->create();
    113         $permalink = get_permalink( $post_id );
    114         $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) );
    115 
    116         $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    117         $permalink = get_permalink( $post_id );
    118         $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) );
     111        $post_id        = self::factory()->post->create();
     112        $post_permalink = get_permalink( $post_id );
     113        $post_url_to_id = url_to_postid( set_url_scheme( $post_permalink, 'http' ) );
     114
     115        $page_id        = self::factory()->post->create( array( 'post_type' => 'page' ) );
     116        $page_permalink = get_permalink( $page_id );
     117        $page_url_to_id = url_to_postid( set_url_scheme( $page_permalink, 'http' ) );
    119118
    120119        // Cleanup.
    121120        $_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
    122         $_SERVER['HTTP_HOST'] = $http_host;
     121
     122        $this->assertEquals( $post_id, $post_url_to_id );
     123        $this->assertEquals( $page_id, $page_url_to_id );
    123124    }
    124125
Note: See TracChangeset for help on using the changeset viewer.