mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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 git-svn-id: https://develop.svn.wordpress.org/trunk@36711 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -105,21 +105,22 @@ class Tests_Rewrite extends WP_UnitTestCase {
|
||||
function test_url_to_postid_set_url_scheme_http_to_https() {
|
||||
// Save server data for cleanup
|
||||
$is_ssl = is_ssl();
|
||||
$http_host = $_SERVER['HTTP_HOST'];
|
||||
|
||||
$_SERVER['HTTPS'] = 'on';
|
||||
|
||||
$post_id = self::factory()->post->create();
|
||||
$permalink = get_permalink( $post_id );
|
||||
$this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) );
|
||||
$post_id = self::factory()->post->create();
|
||||
$post_permalink = get_permalink( $post_id );
|
||||
$post_url_to_id = url_to_postid( set_url_scheme( $post_permalink, 'http' ) );
|
||||
|
||||
$post_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
|
||||
$permalink = get_permalink( $post_id );
|
||||
$this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) );
|
||||
$page_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
|
||||
$page_permalink = get_permalink( $page_id );
|
||||
$page_url_to_id = url_to_postid( set_url_scheme( $page_permalink, 'http' ) );
|
||||
|
||||
// Cleanup.
|
||||
$_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off';
|
||||
$_SERVER['HTTP_HOST'] = $http_host;
|
||||
|
||||
$this->assertEquals( $post_id, $post_url_to_id );
|
||||
$this->assertEquals( $page_id, $page_url_to_id );
|
||||
}
|
||||
|
||||
function test_url_to_postid_custom_post_type() {
|
||||
|
||||
Reference in New Issue
Block a user