[wp-trac] [WordPress Trac] #49149: Write tests for WP_Query

WordPress Trac noreply at wordpress.org
Fri Jan 10 14:02:03 UTC 2020


#49149: Write tests for WP_Query
------------------------------+------------------------------
 Reporter:  leogermani        |       Owner:  (none)
     Type:  enhancement       |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Query             |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  needs-unit-tests  |     Focuses:
------------------------------+------------------------------

Comment (by leogermani):

 Here is the result of my search.

 I've looked for each parameter to see if there was a specific test to it.

 I've marked as "Not found" what I didn't find, but they might exist and I
 didn't find it :) .

 I'll give it a time maybe someone can point some tests that I have missed
 or complete the list with something else I forgot. THen I will open
 tickets for each missing test.


 (base folder is `tests/phpunit/tests/`)

 * Author params
  * author
  * author_name
  * author__in
  * author__not_in

 tests in `query/results.php`

 * Category params
  * cat
  * category_name
  * category__and
  * category__in
  * category__not_in

 tests in `query/results.php`. Only `cat`and `category_name`. Missing
 `category__and`, `category__in` and `category__not_in`.


 * Tag params
  * tag
  * tag_id
  * tag__and
  * tag__in
  * tag__not_in
  * tag_slug__and
  * tag_slug__in

 tests in `query/results.php` Missing `tag_slug__and` and `tag__and`.


 * Tax_query

 tests in `term/taxQuery.php` and `query/taxQuery.php`

 * Meta_query

 tests in `query/metaQuery.php` and `meta/query.php`

 * date_query

 tests in `date/query.php`, `query/date.php` and `query/dateQuery.php`

 * post_mime_type

 not found

 * fields

 tests in `post/query.php` (line 599) And also used in many other tests.

 * name

 Not found

 * page_id

 Not found

 * pagename

 Not found

 * post_parent

 Nor found

 * post_parent__in

 tests in `query/results.php`

 * post_parent__not_in

 Not found

 * post__in

 Not individually tested (but used in other tests)

 * post__not_in

 Not found

 * post_name__in

 tests in `post/query.php`

 * has_password

 tests in `query/results.php`

 * post_password

 Not found

 * post_type

 Not individually tested (but used in other tests)

 * post_status

 Tests in `query/postStatus.php`

 * comment_count

 tests in `query/commentCount.php`

 * nopaging

 Not found

 * posts_per_page

 tests in `query/results.php`

 * offset

 tests in `query/results.php`

 * paged

 tests in `query/results.php`

 * ignore_sticky_posts

 tests in `query/stickies.php`, tested via query var and not directly
 making the query

 * order and orderby paramaters

  * ‘none‘ - `post/query.php`
  * ‘ID‘ - Not individually tested (but used in other tests).
  * ‘author‘ - Not found
  * ‘title‘ - Not found
  * ‘name‘ - Not found
  * ‘type‘ - Not found
  * ‘date‘ - Not individually tested (but used in other tests). Also tests
 if it is used by default when invalid value is passed to `orderby`
  * ‘modified‘ - there is an indirect test in `rest-api/rest-posts-
 controller.php`
  * ‘parent‘ - Not found
  * ‘rand‘ - `post/query.php`
  * ‘relevance‘ - Not found
  * ‘meta_value‘ - `meta.php`
  * ‘meta_value_num‘ - Not found
  * ‘post__in‘ - `post/query.php`
  * ‘post_name__in‘ - `post/query.php`


 * s

 tests in `query/search.php`

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49149#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list