[wp-trac] [WordPress Trac] #25818: `WP_UnitTestCase::go_to()` drops query vars

WordPress Trac noreply at wordpress.org
Mon Nov 4 19:41:00 UTC 2013


#25818: `WP_UnitTestCase::go_to()` drops query vars
----------------------------+-------------------
 Reporter:  wonderboymusic  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  3.8
Component:  Unit Tests      |    Version:  trunk
 Severity:  normal          |   Keywords:
----------------------------+-------------------
 If you register a custom taxonomy in a unit test case, create a term in
 it, add it to a post, delete rewrite rules, and then call
 `WP_UnitTestCase::go_to()` with a URL for the connected term, the query
 var is not registered, so the query just goes to home.

 It is not very clear what is the proper way to do this. I discovered the
 issue writing unit tests here:
 http://core.trac.wordpress.org/attachment/ticket/20767/20767.3.diff

 There should be assertions for `assertNotEmpty( get_query_var( 'sometax' )
 )`, they currently fail because the query var isn't registered.

 When a custom taxonomy is registered, and then the query is filtered to
 include a 2nd term in the taxonomy using `pre_get_posts`,
 `$wp_query->query_vars` should include the query var and `tax_query`, it
 currently only includes `tax_query`.

 Looking into this.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25818>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list