Wordpress/tests/phpunit/tests/post
Scott Taylor 0baa73f2e4 Apply order to each passed value for orderby in WP_Query:
* Since `orderby` in `WP_Query` can accept space-delimited sets, yet only one `order` value: when multiple values are passed (and `DESC` is the order), the default sort order `ASC` is being applied to all values before the last in the set.
* There is a unit test that sporadically fails since 3.6 in `tests/post/revision` due to multiple posts having the same `post_date` from being added so rapidly
* When ordering revisions in `wp_get_post_revisions()`, order by `post_date ID`
* Change the `order` value in `wp_get_post_revisions()` to `ASC`. This will produce SQL like: `ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID ASC`. Previously, this would have produced SQL like: `ORDER BY $wpdb->posts.post_date DESC`, and with the addition of ` ID`: `ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID DESC`. Clearly, wrong. The original SQL produced: `ORDER BY $wpdb->posts.post_date DESC`. As such, return the reversions in reverse order using `array_reverse()`. Not doing so would break "Preview Changes."
* Add unit tests to assert that all of this works.
* All existing unit tests pass with the change to ordering multiple `orderby`s in `WP_Query`.
* In the future, we should support independent `order` for each `orderby`, see #17065.

Props SergeyBiryukov, wonderboymusic.
Fixes #26042.


git-svn-id: https://develop.svn.wordpress.org/trunk@28541 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-22 18:18:11 +00:00
..
attachments.php Set the default parent id to 0, instead of -1, in Tests_Post_Attachments::_make_attachment(). Prevents Out of range value for column 'post_parent' database error without papering over it in core. 2013-11-04 21:39:35 +00:00
filtering.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00
formats.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00
gallery.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00
getPages.php Eliminate use of extract() in wp_dropdown_pages(). 2014-05-15 01:11:21 +00:00
listPages.php Add unit tests for wp_list_pages(). 2014-05-15 01:17:37 +00:00
meta.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00
nav-menu.php Explicitly assign menu term relationship rather than piggybacking on wp_insert_post() with the tax_input argument. 2014-03-15 06:06:41 +00:00
objects.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00
output.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00
query.php Use assertEqualSets() instead of direct array comparison. 2013-12-01 00:42:39 +00:00
revisions.php Apply order to each passed value for orderby in WP_Query: 2014-05-22 18:18:11 +00:00
slashes.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00
template.php Eliminate use of extract() in wp_dropdown_pages(). 2014-05-15 01:11:21 +00:00
types.php Move PHPUnit tests into a tests/phpunit directory. 2013-08-29 18:39:34 +00:00