Ticket #33877: 33877.patch
| File 33877.patch, 6.4 KB (added by , 10 years ago) |
|---|
-
tests/phpunit/includes/bootstrap.php
38 38 $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1'; 39 39 $_SERVER['HTTP_HOST'] = WP_TESTS_DOMAIN; 40 40 $_SERVER['REQUEST_METHOD'] = 'GET'; 41 $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; 41 42 $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; 42 43 43 44 if ( "1" == getenv( 'WP_MULTISITE' ) || -
tests/phpunit/tests/ajax/ReplytoComment.php
38 38 39 39 $post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) ); 40 40 $this->_draft_post = get_post( $post_id ); 41 42 $_SERVER['REMOTE_ADDR'] = '';43 41 } 44 42 45 43 public function tearDown() { -
tests/phpunit/tests/ajax/ReplytoComment.php
38 38 39 39 $post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) ); 40 40 $this->_draft_post = get_post( $post_id ); 41 42 $_SERVER['REMOTE_ADDR'] = '';43 41 } 44 42 45 43 public function tearDown() { -
tests/phpunit/tests/comment.php
77 77 * @ticket 14279 78 78 */ 79 79 public function test_wp_new_comment_respects_dates() { 80 // `wp_new_comment()` checks REMOTE_ADDR, so we fake it to avoid PHP notices.81 if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {82 $remote_addr = $_SERVER['REMOTE_ADDR'];83 } else {84 $_SERVER['REMOTE_ADDR'] = '';85 }86 87 80 $u = $this->factory->user->create(); 88 81 $post_id = $this->factory->post->create( array( 'post_author' => $u ) ); 89 82 … … 104 97 105 98 $this->assertEquals( $data['comment_date'], $comment->comment_date ); 106 99 $this->assertEquals( $data['comment_date_gmt'], $comment->comment_date_gmt ); 107 108 // Cleanup.109 if ( isset( $remote_addr ) ) {110 $_SERVER['REMOTE_ADDR'] = $remote_addr;111 } else {112 unset( $_SERVER['REMOTE_ADDR'] );113 }114 100 } 115 101 116 102 /** … … 238 224 239 225 240 226 public function test_comment_field_lengths() { 241 // `wp_new_comment()` checks REMOTE_ADDR, so we fake it to avoid PHP notices.242 if ( isset( $_SERVER['REMOTE_ADDR'] ) ) {243 $remote_addr = $_SERVER['REMOTE_ADDR'];244 } else {245 $_SERVER['REMOTE_ADDR'] = '';246 }247 248 227 $u = $this->factory->user->create(); 249 228 $post_id = $this->factory->post->create( array( 'post_author' => $u ) ); 250 229 … … 264 243 $comment = get_comment( $id ); 265 244 266 245 $this->assertEquals( strlen( $comment->comment_content ), 65535 ); 267 268 // Cleanup.269 if ( isset( $remote_addr ) ) {270 $_SERVER['REMOTE_ADDR'] = $remote_addr;271 } else {272 unset( $_SERVER['REMOTE_ADDR'] );273 }274 246 } 275 247 276 248 /** -
tests/phpunit/tests/multisite/bootstrap.php
15 15 global $wpdb; 16 16 parent::setUp(); 17 17 $this->suppress = $wpdb->suppress_errors(); 18 19 $_SERVER[ 'REMOTE_ADDR' ] = '';20 18 } 21 19 22 20 function tearDown() { -
tests/phpunit/tests/multisite/bootstrap.php
15 15 global $wpdb; 16 16 parent::setUp(); 17 17 $this->suppress = $wpdb->suppress_errors(); 18 19 $_SERVER[ 'REMOTE_ADDR' ] = '';20 18 } 21 19 22 20 function tearDown() { -
tests/phpunit/tests/multisite/ms-files-rewriting.php
19 19 parent::setUp(); 20 20 $this->suppress = $wpdb->suppress_errors(); 21 21 22 $_SERVER[ 'REMOTE_ADDR' ] = '';23 24 22 update_site_option( 'ms_files_rewriting', 1 ); 25 23 ms_upload_constants(); 26 24 } -
tests/phpunit/tests/multisite/ms-files-rewriting.php
19 19 parent::setUp(); 20 20 $this->suppress = $wpdb->suppress_errors(); 21 21 22 $_SERVER[ 'REMOTE_ADDR' ] = '';23 24 22 update_site_option( 'ms_files_rewriting', 1 ); 25 23 ms_upload_constants(); 26 24 } -
tests/phpunit/tests/multisite/network.php
16 16 global $wpdb; 17 17 parent::setUp(); 18 18 $this->suppress = $wpdb->suppress_errors(); 19 20 $_SERVER[ 'REMOTE_ADDR' ] = '';21 19 } 22 20 23 21 function tearDown() { -
tests/phpunit/tests/multisite.php
14 14 global $wpdb; 15 15 parent::setUp(); 16 16 $this->suppress = $wpdb->suppress_errors(); 17 18 $_SERVER['REMOTE_ADDR'] = '';19 17 } 20 18 21 19 function tearDown() { -
tests/phpunit/tests/option/multisite.php
16 16 global $wpdb; 17 17 parent::setUp(); 18 18 $this->suppress = $wpdb->suppress_errors(); 19 20 $_SERVER['REMOTE_ADDR'] = null;21 19 } 22 20 23 21 function tearDown() { -
tests/phpunit/tests/user/multisite.php
16 16 global $wpdb; 17 17 parent::setUp(); 18 18 $this->suppress = $wpdb->suppress_errors(); 19 20 $_SERVER[ 'REMOTE_ADDR' ] = '';21 19 } 22 20 23 21 function tearDown() {