wordpress-develop/tests/phpunit/tests/canonical/https.php
Boone Gorges d63ceb08a3 Share fixtures across 'canonical' automated tests.
Sharing these fixtures results in a speed improvement of almost one minute per
run of the test suite.

My hope is that future WordPress developers will spend this extra minute with
their loved ones, for life on this earth is short, my friends, and the moments
you spend watching WP generate test data can never again be reclaimed from the
grizzled clutches of Time, and none of us are really getting younger, I mean,
geez, have you looked in the mirror lately, Gandalf?

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30277 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 19:28:12 +00:00

65 lines
1.3 KiB
PHP

<?php
/**
* @group canonical
* @group rewrite
* @group query
*/
class Tests_Canonical_HTTPS extends WP_Canonical_UnitTestCase {
function setUp() {
global $wp_rewrite;
parent::setUp();
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
create_initial_taxonomies();
$wp_rewrite->flush_rules();
$wp_rewrite->init();
$this->http = set_url_scheme( home_url( 'sample-page/' ), 'http' );
$this->https = set_url_scheme( home_url( 'sample-page/' ), 'https' );
}
public function set_https( $url ) {
return set_url_scheme( $url, 'https' );
}
/**
* @ticket 27954
*/
public function test_http_request_with_http_home() {
$redirect = redirect_canonical( $this->http, false );
$this->assertEquals( $redirect, false );
}
/**
* @ticket 27954
*/
public function test_https_request_with_http_home() {
$redirect = redirect_canonical( $this->https, false );
$this->assertEquals( $redirect, false );
}
/**
* @ticket 27954
*/
public function test_https_request_with_https_home() {
add_filter( 'home_url', array( $this, 'set_https' ) );
$redirect = redirect_canonical( $this->https, false );
$this->assertEquals( $redirect, false );
remove_filter( 'home_url', array( $this, 'set_https' ) );
}
}