| 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 | /** |