mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-08 22:54:36 +00:00
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:
@@ -122,4 +122,15 @@ class Tests_Query extends WP_UnitTestCase {
|
||||
public function filter_parse_query_to_remove_tax( $q ) {
|
||||
unset( $q->query_vars['wptests_tax'] );
|
||||
}
|
||||
|
||||
public function test_orderby_space_separated() {
|
||||
global $wpdb;
|
||||
|
||||
$q = new WP_Query( array(
|
||||
'orderby' => 'title date',
|
||||
'order' => 'DESC',
|
||||
) );
|
||||
|
||||
$this->assertContains( "ORDER BY $wpdb->posts.post_title DESC, $wpdb->posts.post_date DESC", $q->request );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user