From 701f639e30f96875fb2ac824e8e4f06c3ece41e8 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 26 Feb 2016 00:25:10 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/functions/referer.php | 32 ++++++++++---------- tests/phpunit/tests/rewrite/numericSlugs.php | 4 +-- tests/phpunit/tests/upload.php | 4 +-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/phpunit/tests/functions/referer.php b/tests/phpunit/tests/functions/referer.php index 07e0f66a0a..88829ecc65 100644 --- a/tests/phpunit/tests/functions/referer.php +++ b/tests/phpunit/tests/functions/referer.php @@ -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' ) ); } diff --git a/tests/phpunit/tests/rewrite/numericSlugs.php b/tests/phpunit/tests/rewrite/numericSlugs.php index 3f7aa11ab9..9ed8ff8898 100644 --- a/tests/phpunit/tests/rewrite/numericSlugs.php +++ b/tests/phpunit/tests/rewrite/numericSlugs.php @@ -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 ) ); diff --git a/tests/phpunit/tests/upload.php b/tests/phpunit/tests/upload.php index 8c3189bdcd..361b2f0e9d 100644 --- a/tests/phpunit/tests/upload.php +++ b/tests/phpunit/tests/upload.php @@ -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'] );