test: lint and fix wpunit tests#2455
Merged
jasonbahl merged 11 commits intowp-graphql:developfrom Jul 25, 2022
Merged
Conversation
d6d11dd to
b2215d5
Compare
9e3640c to
a53561c
Compare
Collaborator
Author
|
I'm almost at the point in this PR where additional fixes to the tests (leaked info, broken logic, etc) will expose existing bugs in the plugin and cause CI tests to fail until they're addressed in the code. |
|
Code Climate has analyzed commit 41fc44e and detected 0 issues on this pull request. View more on Code Climate. |
jasonbahl
approved these changes
Jul 25, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this implement/fix? Explain your changes.
This PR lints and applies some basic fixes/refactors to existing WPUnit tests.
Work on #2408 exposed many cases of data being leaked between tests, however fixing the issues there makes PR review nearly unusable due to both the scope, and unrelated diffs from linting. It also makes merging/rebasing a PITA.
There are also numerous cases where tests are passing even though they are written incorrectly or there is a bug in the plugin, due to leaky data.
#2408 is not the first PR where I've encountered this, and I believe this will make future work significantly more efficient. While this may cause some additional merge conflicts on already-open PRs, many of those already have merge conflicts that must be dealt with anyway.
To test:
Add the following method to the bottom of
WPHelperTest.php(so it runs last), and runvendor/bin/codecept run wpunit -vvv.Only default WP post types and taxonomies should appear, the admin user, and no posts or terms.
Does this close any currently open issues?
…
Any relevant logs, error output, GraphiQL screenshots, etc?
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
Any other comments?
wpunittests, it does not touch all of them, only those affected by bugs/leaky types discovered in fix: Connection pagination refactor #2408. This is intentional, in an attempt to limit as many merge conflicts as possible.Where has this been tested?
Operating System: Ubuntu 20.04 (wsl2 + devilbox + PHP 8.0.19)
WordPress Version: 6.0.1