Changeset 54449 for trunk/tests/phpunit/tests/functions/wpRefererField.php
- Timestamp:
- 10/10/2022 06:57:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions/wpRefererField.php
r54420 r54449 30 30 $this->assertSame( '<input type="hidden" name="_wp_http_referer" value="/test/" />', wp_referer_field( false ) ); 31 31 } 32 33 /** 34 * Tests that the echo argument is respected. 35 * 36 * @ticket 54106 37 * 38 * @dataProvider data_wp_referer_field_should_respect_echo_arg 39 * 40 * @param mixed $echo Whether to echo or return the referer field. 41 */ 42 public function test_wp_referer_field_should_respect_echo_arg( $echo ) { 43 $actual = $echo ? get_echo( 'wp_referer_field' ) : wp_referer_field( false ); 44 45 $this->assertSame( '<input type="hidden" name="_wp_http_referer" value="" />', $actual ); 46 } 47 48 /** 49 * Data provider for test_wp_referer_field_should_respect_echo_arg(). 50 * 51 * @return array 52 */ 53 public function data_wp_referer_field_should_respect_echo_arg() { 54 return array( 55 'true' => array( true ), 56 '(int) 1' => array( 1 ), 57 '(string) "1"' => array( '1' ), 58 'false' => array( false ), 59 'null' => array( null ), 60 '(int) 0' => array( 0 ), 61 '(string) "0"' => array( '0' ), 62 ); 63 } 64 65 /** 66 * @ticket 54106 67 */ 68 public function test_wp_referer_field_with_referer() { 69 $old_request_uri = $_SERVER['REQUEST_URI']; 70 $_SERVER['REQUEST_URI'] = 'edit.php?_wp_http_referer=edit.php'; 71 72 $actual = wp_referer_field( false ); 73 74 $_SERVER['REQUEST_URI'] = $old_request_uri; 75 76 $this->assertSame( '<input type="hidden" name="_wp_http_referer" value="edit.php" />', $actual ); 77 } 32 78 }
Note: See TracChangeset
for help on using the changeset viewer.