WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/25/2016 09:17:34 PM (6 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/post/attachments.php

    r36565 r36711  
    302302
    303303        $url = wp_get_attachment_url( $attachment_id );
    304         $this->assertSame( set_url_scheme( $url, 'http' ), $url );
    305304
    306305        // Cleanup.
    307306        $_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
     307
     308        $this->assertSame( 'http', parse_url( $url, PHP_URL_SCHEME ) );
    308309    }
    309310
     
    331332
    332333        $url = wp_get_attachment_url( $attachment_id );
    333         $this->assertSame( set_url_scheme( $url, 'http' ), $url );
    334334
    335335        // Cleanup.
    336336        $_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
     337
     338        $this->assertSame( 'http', parse_url( $url, PHP_URL_SCHEME ) );
    337339    }
    338340
     
    361363        $_SERVER['HTTPS'] = 'on';
    362364
    363         // Verify that server host matches the host of wp_upload_dir().
     365        // Ensure that server host matches the host of wp_upload_dir().
    364366        $upload_dir = wp_upload_dir();
    365367        $_SERVER['HTTP_HOST'] = parse_url( $upload_dir['baseurl'], PHP_URL_HOST );
     
    367369        // Test that wp_get_attachemt_url returns with https scheme.
    368370        $url = wp_get_attachment_url( $attachment_id );
    369         $this->assertSame( set_url_scheme( $url, 'https' ), $url );
    370371
    371372        // Cleanup.
    372373        $_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
    373374        $_SERVER['HTTP_HOST'] = $http_host;
     375
     376        $this->assertSame( 'https', parse_url( $url, PHP_URL_SCHEME ) );
    374377    }
    375378
     
    396399        $_SERVER['HTTPS'] = 'on';
    397400
    398         // Verify that server host matches the host of wp_upload_dir().
     401        // Ensure that server host matches the host of wp_upload_dir().
    399402        $upload_dir = wp_upload_dir();
    400403        $_SERVER['HTTP_HOST'] = parse_url( $upload_dir['baseurl'], PHP_URL_HOST );
     
    402405        // Test that wp_get_attachemt_url returns with https scheme.
    403406        $url = wp_get_attachment_url( $attachment_id );
    404         $this->assertSame( set_url_scheme( $url, 'https' ), $url );
    405407
    406408        // Cleanup.
    407409        $_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
    408410        $_SERVER['HTTP_HOST'] = $http_host;
     411
     412        $this->assertSame( 'https', parse_url( $url, PHP_URL_SCHEME ) );
    409413    }
    410414
     
    465469        remove_filter( 'upload_dir', '_upload_dir_https' );
    466470
    467         $this->assertSame( set_url_scheme( $url, 'https' ), $url );
     471        $this->assertSame( 'https', parse_url( $url, PHP_URL_SCHEME ) );
    468472    }
    469473
Note: See TracChangeset for help on using the changeset viewer.