Changeset 39664
- Timestamp:
- 01/02/2017 08:06:59 PM (8 years ago)
- Location:
- branches/4.7
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.7
-
branches/4.7/src/wp-includes/comment.php
r39641 r39664 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'], … … 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 ), -
branches/4.7/tests/phpunit/tests/comment/getPageOfComment.php
r38740 r39664 242 242 /** 243 243 * @ticket 31101 244 */ 245 public function test_should_respect_comment_order_newest() { 244 * @ticket 39280 245 */ 246 public function test_should_ignore_comment_order() { 246 247 $now = time(); 247 248 … … 250 251 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) ); 251 252 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) ); 253 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ) ) ); 252 254 253 255 update_option( 'comment_order', 'desc' ); 254 256 update_option( 'page_comments', 1 ); 255 update_option( 'comments_per_page', 2);257 update_option( 'comments_per_page', 1 ); 256 258 257 259 $this->assertEquals( 2, get_page_of_comment( $c3 ) ); 258 260 } 261 262 /** 263 * @ticket 31101 264 * @ticket 39280 265 */ 266 public function test_should_ignore_default_comment_page() { 267 $now = time(); 268 269 $p = self::factory()->post->create(); 270 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) ); 271 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) ); 272 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) ); 273 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ) ) ); 274 275 update_option( 'default_comment_page', 'newest' ); 276 update_option( 'page_comments', 1 ); 277 update_option( 'comments_per_page', 1 ); 278 279 $this->assertEquals( 2, get_page_of_comment( $c3 ) ); 280 } 259 281 }
Note: See TracChangeset
for help on using the changeset viewer.