Changeset 34172 for trunk/tests/phpunit/tests/comment.php
- Timestamp:
- 09/15/2015 08:04:33 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.