Changeset 32307 for branches/4.1/tests/phpunit/tests/comment.php
- Timestamp:
- 04/27/2015 02:47:22 PM (11 years ago)
- File:
-
- 1 edited
-
branches/4.1/tests/phpunit/tests/comment.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.1/tests/phpunit/tests/comment.php
r30402 r32307 43 43 $this->assertSame( array(), $found ); 44 44 } 45 46 public function test_comment_content_length() { 47 // `wp_new_comment()` checks REMOTE_ADDR, so we fake it to avoid PHP notices. 48 if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { 49 $remote_addr = $_SERVER['REMOTE_ADDR']; 50 } else { 51 $_SERVER['REMOTE_ADDR'] = ''; 52 } 53 54 $post_id = $this->factory->post->create(); 55 56 $data = array( 57 'comment_post_ID' => $post_id, 58 'comment_author' => rand_str(), 59 'comment_author_url' => '', 60 'comment_author_email' => '', 61 'comment_type' => '', 62 'comment_content' => str_repeat( 'A', 65536 ), 63 'comment_date' => '2011-01-01 10:00:00', 64 'comment_date_gmt' => '2011-01-01 10:00:00', 65 ); 66 67 $id = wp_new_comment( $data ); 68 69 $this->assertFalse( $id ); 70 71 // Cleanup. 72 if ( isset( $remote_addr ) ) { 73 $_SERVER['REMOTE_ADDR'] = $remote_addr; 74 } else { 75 unset( $_SERVER['REMOTE_ADDR'] ); 76 } 77 } 45 78 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)