Ticket #39280: 39280.diff
| File 39280.diff, 1.9 KB (added by , 10 years ago) |
|---|
-
src/wp-includes/comment.php
1003 1003 if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent ) 1004 1004 return get_page_of_comment( $comment->comment_parent, $args ); 1005 1005 1006 if ( 'desc' === get_option( 'comment_order' ) ) {1007 $compare = 'after';1008 } else {1009 $compare = 'before';1010 }1011 1012 1006 $comment_args = array( 1013 1007 'type' => $args['type'], 1014 1008 'post_id' => $comment->comment_post_ID, … … 1019 1013 'date_query' => array( 1020 1014 array( 1021 1015 'column' => "$wpdb->comments.comment_date_gmt", 1022 $compare=> $comment->comment_date_gmt,1016 'before' => $comment->comment_date_gmt, 1023 1017 ) 1024 1018 ), 1025 1019 ); -
tests/phpunit/tests/comment/getPageOfComment.php
238 238 239 239 $this->assertEquals( 2, get_page_of_comment( $c1 ) ); 240 240 } 241 242 /**243 * @ticket 31101244 */245 public function test_should_respect_comment_order_newest() {246 $now = time();247 248 $p = self::factory()->post->create();249 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );250 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) );251 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) );252 253 update_option( 'comment_order', 'desc' );254 update_option( 'page_comments', 1 );255 update_option( 'comments_per_page', 2 );256 257 $this->assertEquals( 2, get_page_of_comment( $c3 ) );258 }259 241 }
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)