[wp-unit-tests] [WordPress Unit Tests] #106: Custom taxonomies and post types does not work in UT

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 16 11:27:02 UTC 2012


#106: Custom taxonomies and post types does not work in UT
----------------------------+-----------------
 Reporter:  sirzooro        |      Owner:
     Type:  defect          |     Status:  new
 Priority:  normal          |  Milestone:
Component:  Test Framework  |   Keywords:
----------------------------+-----------------
 Custom taxonomies and post types does not work in UT - it is not possible
 to go to their URLs. This is caused by fact that
 `WP_UnitTestCase::go_to()` recreates the `WP` object, effectively dropping
 registered query vars. `WP_Query` object is also recreated, so permalinks
 may not work too (I haven't tested this). `go_to()` should recreate that
 lost rules before calling `$GLOBALS['wp']->main($parts['query']);`.

 It will be good to use some WP-core function(s) for this, because
 implementation details may change in the future. Another approach is to
 modify the `WP`/`WP_Query` objects so they will recreate these rules from
 global vars when they are created.

 Please also keep in mind that unit test may change permalink format (e.g.
 to test something for htaccess-based, index-based and no pretty permalink
 URLs).

-- 
Ticket URL: <http://unit-tests.trac.wordpress.org/ticket/106>
WordPress Unit Tests <http://unit-tests.trac.wordpress.org>
My example project


More information about the wp-unit-tests mailing list