Changeset 38740
- Timestamp:
- 10/06/2016 05:41:51 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r38738 r38740 919 919 return get_page_of_comment( $comment->comment_parent, $args ); 920 920 921 if ( 'desc' === get_option( 'comment_order' ) ) { 922 $compare = 'after'; 923 } else { 924 $compare = 'before'; 925 } 926 921 927 $comment_args = array( 922 928 'type' => $args['type'], … … 929 935 array( 930 936 'column' => "$wpdb->comments.comment_date_gmt", 931 'before'=> $comment->comment_date_gmt,937 $compare => $comment->comment_date_gmt, 932 938 ) 933 939 ), -
trunk/tests/phpunit/tests/comment/getPageOfComment.php
r35331 r38740 239 239 $this->assertEquals( 2, get_page_of_comment( $c1 ) ); 240 240 } 241 242 /** 243 * @ticket 31101 244 */ 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 } 241 259 }
Note: See TracChangeset
for help on using the changeset viewer.