| @@ 1721-1736 (lines=16) @@ | ||
| 1718 | /** |
|
| 1719 | * @ticket 30478 |
|
| 1720 | */ |
|
| 1721 | public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_ASC() |
|
| 1722 | { |
|
| 1723 | $now = current_time('mysql', 1); |
|
| 1724 | $comments = self::factory()->comment->create_many( |
|
| 1725 | 5, array( |
|
| 1726 | 'comment_post_ID' => self::$post_id, |
|
| 1727 | 'comment_date_gmt' => $now, |
|
| 1728 | ) |
|
| 1729 | ); |
|
| 1730 | ||
| 1731 | $q = new WP_Comment_Query(); |
|
| 1732 | $found = $q->query( |
|
| 1733 | array( |
|
| 1734 | 'orderby' => 'comment_date_gmt', |
|
| 1735 | 'order' => 'ASC', |
|
| 1736 | ) |
|
| 1737 | ); |
|
| 1738 | ||
| 1739 | // $comments is ASC by default. |
|
| @@ 1746-1763 (lines=18) @@ | ||
| 1743 | /** |
|
| 1744 | * @ticket 30478 |
|
| 1745 | */ |
|
| 1746 | public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_DESC() |
|
| 1747 | { |
|
| 1748 | $now = current_time('mysql', 1); |
|
| 1749 | $comments = self::factory()->comment->create_many( |
|
| 1750 | 5, array( |
|
| 1751 | 'comment_post_ID' => self::$post_id, |
|
| 1752 | 'comment_date_gmt' => $now, |
|
| 1753 | ) |
|
| 1754 | ); |
|
| 1755 | ||
| 1756 | $q = new WP_Comment_Query(); |
|
| 1757 | $found = $q->query( |
|
| 1758 | array( |
|
| 1759 | 'orderby' => 'comment_date_gmt', |
|
| 1760 | 'order' => 'DESC', |
|
| 1761 | ) |
|
| 1762 | ); |
|
| 1763 | ||
| 1764 | // $comments is ASC by default. |
|
| 1765 | rsort($comments); |
|
| 1766 | ||