-
Notifications
You must be signed in to change notification settings - Fork 178
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
PHP Tests: More robustness, PluginFactory
, improved Multisite handling
#8792
Merged
Conversation
This file contains 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
swissspidy
added
Type: Infrastructure
Changes impacting testing infrastructure or build tooling
Type: Code Quality
Things that need a refactor, rewrite or just some good old developer ❤️
Pod: WP & Infra
labels
Aug 25, 2021
swissspidy
commented
Aug 25, 2021
swissspidy
commented
Aug 25, 2021
spacedmonkey
reviewed
Sep 2, 2021
spacedmonkey
reviewed
Sep 2, 2021
spacedmonkey
reviewed
Sep 2, 2021
spacedmonkey
reviewed
Sep 2, 2021
spacedmonkey
reviewed
Sep 2, 2021
spacedmonkey
reviewed
Sep 2, 2021
swissspidy
commented
Sep 2, 2021
8 tasks
spacedmonkey
reviewed
Sep 3, 2021
This is the last thing - #8792 (comment) then I will approve. |
spacedmonkey
approved these changes
Sep 6, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Type: Code Quality
Things that need a refactor, rewrite or just some good old developer ❤️
Type: Infrastructure
Changes impacting testing infrastructure or build tooling
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.
Context
PluginFactory
, improved Multisite handling #8792 (comment)Summary
This PR adds a single PHPUnit run that is randomly ordered.
This can detect scenarios where the test makes assumptions that are only fulfilled by global state manipulated by a previous test, but are not true in the actual logic to be tested.
In case such a randomly ordered test run fails, the random seed can be found in the GHA log so that this particular ordering can be replicated locally.
Relevant Technical Choices
Add a randomly ordered test run to the GHA workflow
Adds a single PHPUnit run that is randomly ordered.
This can detect scenarios where the test makes assumptions that are only fulfilled by global state manipulated by a previous test, but are not true in the actual logic to be tested.
In case such a randomly ordered test run fails, the random seed can be found in the GHA log so that this particular ordering can be replicated locally.
Note: This PR also fixes some tests that failed during these randomly ordered test runs, but not all. There are simply too many issues with the tests, which requires another big overhaul.
Adds new
HasSiteSetup
andHasSiteRemoval
interfacesEliminates the procedural
setup_new_site()
code by moving logic attached to site setup/teardown in Multisite to the individual services. Basically implementing #7494Added bonus: rewrite rules are no longer flushed twice upon plugin activation (once by the service container and once by
setup_new_site()
.Renames existing similar interfaces accordingly:
PluginActivationAware
PluginDeactivationAware
PluginFactory
Replaces
get_plugin_instance()
with a dedicatedPluginFactory
and a simplebootstrap_plugin()
function which is hooked toplugins_loaded
.Before that, the plugin was executed right away and not attached to any particular action.
Link_Controller
/Hotlink_Controller
Fixes a bug in
Link_Controller
which unexpectedly caused an external HTTP request.Slightly refactored both classes to be more aligned and use
wp_http_validate_url()
for URL validation.Updates tests accordingly.
To-do
DependencyInjectedTestCase
User-facing changes
N/A
Testing Instructions
Reviews
Does this PR have a security-related impact?
Does this PR change what data or activity we track or use?
Does this PR have a legal-related impact?
Checklist
Type: XYZ
label to the PRFixes #