Tests for some existing 'orderby' functionality in WP_*_Query classes.

* In `WP_Query` and `WP_Comment_Query`, ensure that 'orderby' can parse multiple values for 'orderby' when passed as a space-separated string.
* In `WP_User_Query`, ensure that "shorthand" orderbys (like 'login' and 'name') are converted to their full versions (like 'user_login' and 'display_name').

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31662 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-03-07 15:44:28 +00:00
parent 305a44617c
commit 3262ff0cc8
3 changed files with 43 additions and 0 deletions

View File

@@ -1108,6 +1108,17 @@ class Tests_Comment_Query extends WP_UnitTestCase {
$this->assertContains( "ORDER BY $wpdb->comments.comment_date_gmt", $q->request );
}
public function test_orderby_space_separated() {
global $wpdb;
$q = new WP_Comment_Query();
$q->query( array(
'orderby' => 'comment_agent comment_approved',
) );
$this->assertContains( "ORDER BY $wpdb->comments.comment_agent DESC, $wpdb->comments.comment_approved DESC", $q->request );
}
public function test_orderby_comma_separated() {
global $wpdb;