[wp-trac] [WordPress Trac] #29718: Improved coverage for WP_Tax_Query unit tests

WordPress Trac noreply at wordpress.org
Sat Sep 20 19:13:37 UTC 2014


#29718: Improved coverage for WP_Tax_Query unit tests
--------------------------+-----------------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 See #29560 for a related ticket.

 The quality and coverage of `WP_Tax_Query` and `WP_Query::tax_query` tests
 is pretty lackluster. This is problematic because it hinders future
 refactoring, and in particular it hamstrings the taxonomy roadmap.

 The attached patch is an initial attempt to introduce some sanity to these
 tests. I've done the following:

 - Written systematic tests for all public methods of `WP_Tax_Query`.
 Coverage here is pretty much complete.
 - Moved the tests in tests/phpunit/term/query.php that have to do with
 WP_Query into tests/phpunit/post/query.php. The latter file is kind of a
 junk drawer of tests, and should probably be broken up, but at least my
 changes here make it consistent.
 - Add some more `WP_Query::tax_query` tests, to cover a number of possible
 permutations: single vs multiple queries using AND and OR as the relation;
 various values for 'field'; various values for 'operator'
 - Clean up existing tests for speed, relevance, better method names.

 As in the case of `WP_Meta_Query`, the infinite permutations of query args
 make it impossible to write 100% test coverage, but this is a reasonable
 start.

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


More information about the wp-trac mailing list