Opened 11 years ago
Closed 11 years ago
#27704 closed defect (bug) (fixed)
Investigate Tests_Query::test_tag_queried_object() failures in Multisite
Reported by: | SergeyBiryukov | Owned by: | |
---|---|---|---|
Milestone: | 4.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | |
Focuses: | multisite | Cc: |
Description
phpunit -c tests/phpunit/multisite.xml --group 26627
fails every other time.
https://gist.github.com/tierra/10071429
https://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2014-04-07&sort=asc#m827715
https://irclogs.wordpress.org/chanlog.php?channel=wordpress-dev&day=2014-04-08&sort=asc#m827777
Change History (7)
This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.
11 years ago
#3
@
11 years ago
Also add the following unit tests to the list of related tests that fail every other run due to permalink_structure
changes with Tests_User_ListAuthors
between runs: test_wp_list_authors_feed
, test_wp_list_authors_feed_image
, and test_wp_list_authors_feed_type
.
$ phpunit -c tests/phpunit/multisite.xml --group author
#4
@
11 years ago
Did you guys figure out why this happens? I ran into the same problem with an automated test for my plugin:
Test is failing on multisite every other time. Happens when using get_echo( 'the_content' );
for a single custom post type.
Error:
Trying to get property of non-object /srv/www/wordpress-develop/src/wp-includes/post-template.php:265
To summarize chat and the gist linked...
See also #26627 and [27511] where those tests were added, and from where they started failing (i.e. they never passed in multisite even when initially written).
Some important observations from this:
--group taxonomy
.--group 26627
, they pass every other run, so in order to reproduce, you must run these tests more than once sometimes.As @SergeyBiryukov has noted: When test_tag_queried_object() passes, the URL is
http://example.org/?tag=tag-slug-26627
, which translates into[tag] => tag-slug-26627
. When it fails, the URL ishttp://example.org/blog/tag/tag-slug-26627/
, which translates into[pagename] => blog/tag/tag-slug-26627
. I've noticed that Tests_Query_TaxQuery::setUp() updatespermalink_structure
and never restores the original value, but for some reason restoring it in tearDown() doesn't help.As these tests fail every other time due to
permalink_structure
settings, these aren't the only unit tests that fail like this in multisite. A couple data sets inTest_Canonical
also exhibit this behavior (notably from #15256), and alsoTests_Link::test_wp_get_shortlink
does this too. To reproduce these, also run the following tests more than once:Most likely, we could provide a (mostly) simple fix by ensuring that
permalink_structure
is configured appropriately for the tests before running them, but the more important issue we need to figure out is why this setting is persistently changing between test runs, and why it isn't being reset for each test.