Correct some more tests which were using example.org
instead of WP_TESTS_DOMAIN
.
See #34000 git-svn-id: https://develop.svn.wordpress.org/trunk@36717 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1cfdb05750
commit
701f639e30
@ -23,11 +23,11 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function _fake_subfolder_install() {
|
||||
return 'http://example.org/subfolder';
|
||||
return 'http://' . WP_TESTS_DOMAIN . '/subfolder';
|
||||
}
|
||||
|
||||
public function filter_allowed_redirect_hosts( $hosts ) {
|
||||
$hosts[] = 'another.example.org';
|
||||
$hosts[] = 'another.' . WP_TESTS_DOMAIN;
|
||||
|
||||
return $hosts;
|
||||
}
|
||||
@ -39,21 +39,21 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_from_request_same_url() {
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/test.php?id=123' );
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' );
|
||||
$this->assertFalse( wp_get_referer() );
|
||||
}
|
||||
|
||||
public function test_from_request_different_resource() {
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/another.php?id=123' );
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' );
|
||||
$this->assertSame( 'http://example.org/another.php?id=123', wp_get_referer() );
|
||||
$this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123', wp_get_referer() );
|
||||
}
|
||||
|
||||
public function test_from_request_different_query_args() {
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/test.php?another=555' );
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?another=555' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' );
|
||||
$this->assertSame( 'http://example.org/test.php?another=555', wp_get_referer() );
|
||||
$this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/test.php?another=555', wp_get_referer() );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,7 +62,7 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
public function test_from_request_subfolder_install() {
|
||||
add_filter( 'site_url', array( $this, '_fake_subfolder_install' ) );
|
||||
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/subfolder/test.php?id=123' );
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/subfolder/test.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/subfolder/test.php?id=123' );
|
||||
$this->assertFalse( wp_get_referer() );
|
||||
|
||||
@ -75,9 +75,9 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
public function test_from_request_subfolder_install_different_resource() {
|
||||
add_filter( 'site_url', array( $this, '_fake_subfolder_install' ) );
|
||||
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://example.org/subfolder/another.php?id=123' );
|
||||
$_REQUEST['_wp_http_referer'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/subfolder/another.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/subfolder/test.php?id=123' );
|
||||
$this->assertSame( 'http://example.org/subfolder/another.php?id=123', wp_get_referer() );
|
||||
$this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/subfolder/another.php?id=123', wp_get_referer() );
|
||||
|
||||
remove_filter( 'site_url', array( $this, '_fake_subfolder_install' ) );
|
||||
}
|
||||
@ -89,15 +89,15 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_same_url() {
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://example.org/test.php?id=123' );
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/test.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' );
|
||||
$this->assertFalse( wp_get_referer() );
|
||||
}
|
||||
|
||||
public function test_different_resource() {
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://example.org/another.php?id=123' );
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' );
|
||||
$this->assertSame( 'http://example.org/another.php?id=123', wp_get_referer() );
|
||||
$this->assertSame( 'http://' . WP_TESTS_DOMAIN . '/another.php?id=123', wp_get_referer() );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,7 +105,7 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
* @ticket 27152
|
||||
*/
|
||||
public function test_different_server() {
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://another.example.org/test.php?id=123' );
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://another.' . WP_TESTS_DOMAIN . '/test.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' );
|
||||
$this->assertFalse( wp_get_referer() );
|
||||
}
|
||||
@ -116,9 +116,9 @@ class Tests_Functions_Referer extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_different_server_allowed_redirect_host() {
|
||||
add_filter( 'allowed_redirect_hosts', array( $this, 'filter_allowed_redirect_hosts' ) );
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://another.example.org/test.php?id=123' );
|
||||
$_SERVER['HTTP_REFERER'] = addslashes( 'http://another.' . WP_TESTS_DOMAIN . '/test.php?id=123' );
|
||||
$_SERVER['REQUEST_URI'] = addslashes( '/test.php?id=123' );
|
||||
$this->assertSame( 'http://another.example.org/test.php?id=123', wp_get_referer() );
|
||||
$this->assertSame( 'http://another.' . WP_TESTS_DOMAIN . '/test.php?id=123', wp_get_referer() );
|
||||
remove_filter( 'allowed_redirect_hosts', array( $this, 'filter_allowed_redirect_hosts' ) );
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
$wpdb->posts,
|
||||
array(
|
||||
'ID' => '2015',
|
||||
'guid' => 'http://example.org/?p=2015'
|
||||
'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015'
|
||||
),
|
||||
array( 'ID' => $id )
|
||||
);
|
||||
@ -65,7 +65,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
$wpdb->posts,
|
||||
array(
|
||||
'ID' => '2015',
|
||||
'guid' => 'http://example.org/?p=2015'
|
||||
'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015'
|
||||
),
|
||||
array( 'ID' => $id )
|
||||
);
|
||||
|
@ -82,14 +82,14 @@ class Tests_Upload extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
function test_upload_path_absolute() {
|
||||
update_option( 'upload_url_path', 'http://example.org/asdf' );
|
||||
update_option( 'upload_url_path', 'http://' . WP_TESTS_DOMAIN . '/asdf' );
|
||||
|
||||
// Use `_wp_upload_dir()` directly to bypass caching and work with the changed options.
|
||||
// It doesn't create the /year/month directories.
|
||||
$info = _wp_upload_dir();
|
||||
$subdir = gmstrftime('/%Y/%m');
|
||||
|
||||
$this->assertEquals( 'http://example.org/asdf' . $subdir, $info['url'] );
|
||||
$this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/asdf' . $subdir, $info['url'] );
|
||||
$this->assertEquals( ABSPATH . 'wp-content/uploads' . $subdir, $info['path'] );
|
||||
$this->assertEquals( $subdir, $info['subdir'] );
|
||||
$this->assertEquals( false, $info['error'] );
|
||||
|
Loading…
Reference in New Issue
Block a user