Changeset 36266 for trunk/tests/phpunit/tests/functions/referer.php
- Timestamp:
- 01/12/2016 08:31:10 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/functions/referer.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions/referer.php
r36242 r36266 7 7 */ 8 8 class Tests_Functions_Referer extends WP_UnitTestCase { 9 private $request = array();10 private $server = array();11 12 9 public function setUp() { 13 10 parent::setUp(); 14 11 15 $this->server = $_SERVER; 16 $this->request = $_REQUEST; 12 $_SERVER['HTTP_REFERER'] = ''; 13 $_SERVER['REQUEST_URI'] = ''; 14 $_REQUEST['_wp_http_referer'] = ''; 17 15 } 18 16 … … 20 18 parent::tearDown(); 21 19 22 $_SERVER = $this->server; 23 $_REQUEST = $this->request; 20 $_SERVER['HTTP_REFERER'] = ''; 21 $_SERVER['REQUEST_URI'] = ''; 22 $_REQUEST['_wp_http_referer'] = ''; 24 23 } 25 24 … … 123 122 remove_filter( 'allowed_redirect_hosts', array( $this, 'filter_allowed_redirect_hosts' ) ); 124 123 } 124 125 /** 126 * @ticket 27152 127 */ 128 public function test_raw_referer_empty( ) { 129 $this->assertFalse( wp_get_raw_referer() ); 130 } 131 132 /** 133 * @ticket 27152 134 */ 135 public function test_raw_referer( ) { 136 $_SERVER['HTTP_REFERER'] = addslashes( 'http://example.com/foo?bar' ); 137 $this->assertSame( 'http://example.com/foo?bar', wp_get_raw_referer() ); 138 } 139 140 /** 141 * @ticket 27152 142 */ 143 public function test_raw_referer_from_request( ) { 144 $_REQUEST['_wp_http_referer'] = addslashes( 'http://foo.bar/baz' ); 145 $this->assertSame( 'http://foo.bar/baz', wp_get_raw_referer() ); 146 } 147 148 /** 149 * @ticket 27152 150 */ 151 public function test_raw_referer_both( ) { 152 $_SERVER['HTTP_REFERER'] = addslashes( 'http://example.com/foo?bar' ); 153 $_REQUEST['_wp_http_referer'] = addslashes( 'http://foo.bar/baz' ); 154 $this->assertSame( 'http://foo.bar/baz', wp_get_raw_referer() ); 155 } 125 156 }
Note: See TracChangeset
for help on using the changeset viewer.