Changeset 39274
- Timestamp:
- 11/17/2016 03:02:40 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-comment-query.php
r38849 r39274 997 997 $parent_query_args['no_found_rows'] = true; 998 998 $parent_query_args['hierarchical'] = false; 999 $parent_query_args['offset'] = 0; 1000 $parent_query_args['number'] = 0; 999 1001 1000 1002 $level_comments = get_comments( $parent_query_args ); -
trunk/tests/phpunit/tests/comment/query.php
r38446 r39274 2545 2545 2546 2546 /** 2547 * @ticket 37966 2548 * @ticket 37696 2549 */ 2550 public function test_fill_hierarchy_should_disregard_offset_and_number() { 2551 $c0 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 2552 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 2553 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_parent' => $c1 ) ); 2554 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' ) ); 2555 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_parent' => $c3 ) ); 2556 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_parent' => $c3 ) ); 2557 2558 $q = new WP_Comment_Query(); 2559 $found = $q->query( array( 2560 'orderby' => 'comment_date_gmt', 2561 'order' => 'ASC', 2562 'status' => 'approve', 2563 'post_id' => self::$post_id, 2564 'no_found_rows' => false, 2565 'hierarchical' => 'threaded', 2566 'number' => 2, 2567 'offset' => 1, 2568 ) ); 2569 2570 2571 $found_1 = $found[ $c1 ]; 2572 $children_1 = $found_1->get_children(); 2573 $this->assertEqualSets( array( $c2 ), array_keys( $children_1 ) ); 2574 2575 $found_3 = $found[ $c3 ]; 2576 $children_3 = $found_3->get_children(); 2577 $this->assertEqualSets( array( $c4, $c5 ), array_keys( $children_3 ) ); 2578 } 2579 2580 /** 2547 2581 * @ticket 27571 2548 2582 */
Note: See TracChangeset
for help on using the changeset viewer.