| | 1084 | /** |
| | 1085 | * @ticket 30478 |
| | 1086 | */ |
| | 1087 | public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_ASC() { |
| | 1088 | $now = current_time( 'mysql', 1 ); |
| | 1089 | $comments = $this->factory->comment->create_many( 5, array( |
| | 1090 | 'comment_post_ID' => $this->post_id, |
| | 1091 | 'comment_date_gmt' => $now, |
| | 1092 | ) ); |
| | 1093 | |
| | 1094 | $q = new WP_Comment_Query(); |
| | 1095 | $found = $q->query( array( |
| | 1096 | 'orderby' => 'comment_date_gmt', |
| | 1097 | 'order' => 'ASC', |
| | 1098 | ) ); |
| | 1099 | |
| | 1100 | // $comments is ASC by default. |
| | 1101 | $this->assertEquals( $comments, wp_list_pluck( $found, 'comment_ID' ) ); |
| | 1102 | } |
| | 1103 | |
| | 1104 | /** |
| | 1105 | * @ticket 30478 |
| | 1106 | */ |
| | 1107 | public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_DESC() { |
| | 1108 | $now = current_time( 'mysql', 1 ); |
| | 1109 | $comments = $this->factory->comment->create_many( 5, array( |
| | 1110 | 'comment_post_ID' => $this->post_id, |
| | 1111 | 'comment_date_gmt' => $now, |
| | 1112 | ) ); |
| | 1113 | |
| | 1114 | $q = new WP_Comment_Query(); |
| | 1115 | $found = $q->query( array( |
| | 1116 | 'orderby' => 'comment_date_gmt', |
| | 1117 | 'order' => 'DESC', |
| | 1118 | ) ); |
| | 1119 | |
| | 1120 | // $comments is ASC by default. |
| | 1121 | rsort( $comments ); |
| | 1122 | |
| | 1123 | $this->assertEquals( $comments, wp_list_pluck( $found, 'comment_ID' ) ); |
| | 1124 | } |
| | 1125 | |