How do I setup a mock global $wp_query
for a unit test?
I basically want to setup the query so that is_single
returns true.
Stubbing over the function with namespaces is not an option since it clobbers the function for all remaining tests.
How do I setup a mock global $wp_query
for a unit test?
I basically want to setup the query so that is_single
returns true.
Stubbing over the function with namespaces is not an option since it clobbers the function for all remaining tests.
You must be logged in to post a comment.
WP_UnitTestCase::go_to($url)
sets a mocked request (WP_Query) for a url.