Repository navigation
If cleanup.php doesn't fully wipe the DB, it can cause failures. #110
Description
Activity
Okay it LOOKS like cleanup.php isn't nuking the DB tables, which I thought it was supposed to?
Confirmed. Once I wiped out the database and let it rebuild clean, it was fine. So yeah, that;'s a thing,
- changed the title
[-]Failure: test_all_caps_of_users_are_being_tested failed on 'extra' caps found[/-][+]If cleanup.php doesn't fully wipe the DB, it can cause failures.[/+]on Feb 25, 2020 Thanks @Ipstenu ! In core, manual cleanup isn't necessary (as far as I'm aware), so I'm wondering what might be different in this particular case.
The best guess I have is that somehow something was corrupted, and since the cleanup doesn't wipe the DB, there it stayed. Usually the DB changes are additive to WP, but it might be smart to tweak that in advance of DB changes down the road.
Reacted by Kira SchroderI can confirm this was the error with the Conetix tests failing as well. Manually deleting the database tables and re-running corrected the issue.
- added a commit that references this issue
on Jan 12, 2021 I've been using the code in #138 on my setups since i also wanted a clean start always. Most likely it's fine as it is to be merged & used in general (no issues on my end at least 😁 ) but feel free to point out any extra ideas.
I didn't want to go via a $wpdb route as including wp-load or anything like that would most likely start to return warnings for headers etc and wanted an as clean as possible output for logging so I decided to just go for a pretty straightforward mysqli way.
Note I've been using this on "local" setups, not sure if the remote setup would need something different (and I have no way to test it atm).
I was able to reproduce this on current trunk, so this is still valid.
The stale data survives because WordPress boots before the test tables are dropped in
tests/phpunit/includes/install.php. Data such as user roles can already be loaded into memory, and then gets written back into the fresh tables.For the repro, I added one extra capability to the administrator role directly in the database and ran the suite normally. It produced the same failure from the original report, and dropping the test tables before the run fixed it.
#138 goes in the right direction, but two gaps showed up while testing: with
WPT_SSH_CONNECT, cleanup needs to run where the tests ran, and a database cleanup failure should not stop file cleanup. I am opening a PR that handles those cases, drops all base tables matching the configured test prefix, includes multisite sub-site tables likewptests_2_posts, leaves unrelated tables untouched, and keeps the database password off the command line.- added a commit that references this issue
on Sep 16, 2026 - moved this from In progress to Done in Hosting Team WCUS 2026
on Sep 16, 2026
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
There's really no other place to post these errors. I get them running the normal tests. Nothing on my end changed that I know of. I've tried upgrading all the things.
User with administrator role has capabilities that aren't being tested
Failed asserting that two arrays are equal.
/phpunit-test-runner/wp-test-runner/tests/phpunit/tests/user/capabilities.php:381These primitive capabilities are not tested
/phpunit-test-runner/wp-test-runner/tests/phpunit/tests/user/capabilities.php:423I'm not sure how/where this broke (I was out for a while)