Changeset 34172
- Timestamp:
- 09/15/2015 08:04:33 AM (9 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/bootstrap.php
r32785 r34172 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 -
trunk/tests/phpunit/tests/ajax/ReplytoComment.php
r31622 r34172 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 -
trunk/tests/phpunit/tests/comment.php
r33021 r34172 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 ) ); … … 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 … … 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 ) ); … … 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 -
trunk/tests/phpunit/tests/multisite.php
r32638 r34172 15 15 parent::setUp(); 16 16 $this->suppress = $wpdb->suppress_errors(); 17 18 $_SERVER['REMOTE_ADDR'] = '';19 17 } 20 18 -
trunk/tests/phpunit/tests/multisite/bootstrap.php
r31623 r34172 16 16 parent::setUp(); 17 17 $this->suppress = $wpdb->suppress_errors(); 18 19 $_SERVER[ 'REMOTE_ADDR' ] = '';20 18 } 21 19 -
trunk/tests/phpunit/tests/multisite/ms-files-rewriting.php
r31623 r34172 19 19 parent::setUp(); 20 20 $this->suppress = $wpdb->suppress_errors(); 21 22 $_SERVER[ 'REMOTE_ADDR' ] = '';23 21 24 22 update_site_option( 'ms_files_rewriting', 1 ); -
trunk/tests/phpunit/tests/multisite/network.php
r32775 r34172 17 17 parent::setUp(); 18 18 $this->suppress = $wpdb->suppress_errors(); 19 20 $_SERVER[ 'REMOTE_ADDR' ] = '';21 19 } 22 20 -
trunk/tests/phpunit/tests/option/multisite.php
r32634 r34172 17 17 parent::setUp(); 18 18 $this->suppress = $wpdb->suppress_errors(); 19 20 $_SERVER['REMOTE_ADDR'] = null;21 19 } 22 20 -
trunk/tests/phpunit/tests/user/multisite.php
r34034 r34172 17 17 parent::setUp(); 18 18 $this->suppress = $wpdb->suppress_errors(); 19 20 $_SERVER[ 'REMOTE_ADDR' ] = '';21 19 } 22 20
Note: See TracChangeset
for help on using the changeset viewer.