[wp-trac] [WordPress Trac] #39079: REST API: Improve posts orderby tests

WordPress Trac noreply at wordpress.org
Sun Dec 4 21:32:07 UTC 2016

#39079: REST API: Improve posts orderby tests
 Reporter:  jnylen0      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Future Release
Component:  REST API     |    Version:
 Severity:  normal       |   Keywords:  has-patch
  Focuses:               |
 The attached patch improves tests for the `orderby` parameter in

 1. Add tests for `orderby=relevance` combined with a search term
 2. Instead of creating posts for a few tests, just look at the generated
 SQL query instead.

 (2) is interesting because it is a start at testing all of our collection
 filtering parameters in a much more robust way: look at the SQL generated
 by `WP_Query` and make sure it looks as expected.

 This is much easier and more robust than the existing tests because we
 don't have to carefully arrange test objects so that they are returned in
 the expected order, and it also has the potential to be much faster,
 because if all of our filter parameters are covered by SQL checks, we
 don't even have to create any objects to test.

 This will also provide a much easier way to test future filtering
 enhancements like multiple `orderby` values together (see #39037).

Ticket URL: <https://core.trac.wordpress.org/ticket/39079>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list