#25818 closed defect (bug) (fixed)
`WP_UnitTestCase::go_to()` drops query vars
Reported by: | wonderboymusic | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Unit Tests | Keywords: | |
Focuses: | Cc: |
Description
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.
In 26006: