Changeset 32313 for branches/4.0/tests/phpunit/tests/comment.php
- Timestamp:
- 04/27/2015 05:16:29 PM (11 years ago)
- File:
-
- 1 edited
-
branches/4.0/tests/phpunit/tests/comment.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0/tests/phpunit/tests/comment.php
r25002 r32313 15 15 $this->assertEquals( 0, $result ); 16 16 } 17 18 public function test_comment_content_length() { 19 // `wp_new_comment()` checks REMOTE_ADDR, so we fake it to avoid PHP notices. 20 if ( isset( $_SERVER['REMOTE_ADDR'] ) ) { 21 $remote_addr = $_SERVER['REMOTE_ADDR']; 22 } else { 23 $_SERVER['REMOTE_ADDR'] = ''; 24 } 25 26 $post_id = $this->factory->post->create(); 27 28 $data = array( 29 'comment_post_ID' => $post_id, 30 'comment_author' => rand_str(), 31 'comment_author_url' => '', 32 'comment_author_email' => '', 33 'comment_type' => '', 34 'comment_content' => str_repeat( 'A', 65536 ), 35 'comment_date' => '2011-01-01 10:00:00', 36 'comment_date_gmt' => '2011-01-01 10:00:00', 37 ); 38 39 $id = wp_new_comment( $data ); 40 41 $this->assertFalse( $id ); 42 43 // Cleanup. 44 if ( isset( $remote_addr ) ) { 45 $_SERVER['REMOTE_ADDR'] = $remote_addr; 46 } else { 47 unset( $_SERVER['REMOTE_ADDR'] ); 48 } 49 } 17 50 }
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)