Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If cleanup.php doesn't fully wipe the DB, it can cause failures. #110

Open
Ipstenu opened this issue Feb 25, 2020 · 6 comments · May be fixed by #138
Open

If cleanup.php doesn't fully wipe the DB, it can cause failures. #110

Ipstenu opened this issue Feb 25, 2020 · 6 comments · May be fixed by #138

Comments

@Ipstenu
Copy link

Ipstenu commented Feb 25, 2020

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.

  1. Tests_User_Capabilities::test_all_caps_of_users_are_being_tested
    User with administrator role has capabilities that aren't being tested
    Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
+    59 => 'export_others_personal_data'
+    60 => 'erase_others_personal_data'
+    61 => 'manage_privacy_options'
 )

/phpunit-test-runner/wp-test-runner/tests/phpunit/tests/user/capabilities.php:381

  1. Tests_User_Capabilities::testPrimitiveCapsTestsAreCorrect
    These primitive capabilities are not tested
Failed asserting that Array &0 (
    59 => 'export_others_personal_data'
    60 => 'erase_others_personal_data'
    61 => 'manage_privacy_options'
) is identical to Array &0 ().

/phpunit-test-runner/wp-test-runner/tests/phpunit/tests/user/capabilities.php:423

I'm not sure how/where this broke (I was out for a while)

@Ipstenu
Copy link
Author

Ipstenu commented Feb 25, 2020

Okay it LOOKS like cleanup.php isn't nuking the DB tables, which I thought it was supposed to?

@Ipstenu
Copy link
Author

Ipstenu commented Feb 25, 2020

Confirmed. Once I wiped out the database and let it rebuild clean, it was fine. So yeah, that;'s a thing,

@Ipstenu Ipstenu 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. Feb 25, 2020
@getsource
Copy link
Member

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.

@Ipstenu
Copy link
Author

Ipstenu commented Feb 26, 2020

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.

@timbutler
Copy link
Contributor

I can confirm this was the error with the Conetix tests failing as well. Manually deleting the database tables and re-running corrected the issue.

mrxkon added a commit to mrxkon/phpunit-test-runner that referenced this issue Jan 12, 2021
Fixes WordPress#110

Adds functionality via `mysqli` on functions & cleanup to remove test tables from the database.
@mrxkon mrxkon linked a pull request Jan 12, 2021 that will close this issue
@mrxkon
Copy link
Contributor

mrxkon commented 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants