| 731 | |
| 732 | /* |
| 733 | * @ticket 35419 |
| 734 | */ |
| 735 | public function test_comment_parent_should_be_ignored_when_threading_is_disabled() { |
| 736 | $now = time(); |
| 737 | $p = self::factory()->post->create(); |
| 738 | $comment_1 = self::factory()->comment->create( array( |
| 739 | 'comment_post_ID' => $p, |
| 740 | 'comment_content' => '1', |
| 741 | 'comment_approved' => '1', |
| 742 | 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), |
| 743 | ) ); |
| 744 | $comment_2 = self::factory()->comment->create( array( |
| 745 | 'comment_post_ID' => $p, |
| 746 | 'comment_content' => '2', |
| 747 | 'comment_approved' => '1', |
| 748 | 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), |
| 749 | ) ); |
| 750 | $comment_3 = self::factory()->comment->create( array( |
| 751 | 'comment_post_ID' => $p, |
| 752 | 'comment_content' => '3', |
| 753 | 'comment_approved' => '1', |
| 754 | 'comment_parent' => $comment_1, |
| 755 | 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), |
| 756 | ) ); |
| 757 | |
| 758 | update_option( 'comment_order', 'asc' ); |
| 759 | update_option( 'thread_comments', 0 ); |
| 760 | update_option( 'comments_per_page', 2 ); |
| 761 | update_option( 'page_comments', 1 ); |
| 762 | update_option( 'default_comments_page', 'newest' ); |
| 763 | |
| 764 | $this->go_to( get_permalink( $p ) ); |
| 765 | $found = get_echo( 'comments_template' ); |
| 766 | |
| 767 | // Find the found comments in the markup. |
| 768 | preg_match_all( '|id="comment-([0-9]+)|', $found, $matches ); |
| 769 | |
| 770 | $found_cids = array_map( 'intval', $matches[1] ); |
| 771 | $this->assertSame( array( $comment_3 ), $found_cids ); |
| 772 | } |