15: End-to-end suite - #16
Open
nikolaystrikhar wants to merge 1 commit into
Open
Conversation
Ten scenarios covering the load guard, all three conflict policies, run-once activation, the dependency gate and the re-activation rewrite, against real active_plugins, real deactivate_plugins() and real options. Only wp_safe_redirect and wp_get_referer are stubbed; every guard constant is a real define() made by a real file that was really required. The four preconditions are the load-bearing part. Conflict resolution no-ops unless the request is an interactive admin GET, and deactivation no-ops unless the current user can activate_plugins, so a suite that establishes neither passes while exercising nothing. Both are set up explicitly and restored afterwards. WithBundledPlugins writes each fixture at a unique path with a unique guard constant. require_once caches by resolved path and define() lasts for the process, so a shared fixture would make every test after the first pass whether the load path worked or not.
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: ten scenarios driving the whole library against real WordPress — no source files, all test infrastructure.
Usage: the shared fixture trait each load-path test now uses.
Why this way: the four preconditions are what make this suite mean anything.
run_conflict_resolution()no-ops unless the request is an interactive admin GET, and the DEACTIVATE branch no-ops unless the current user canactivate_plugins— a suite that establishes neither passes green while exercising nothing, so both are set up explicitly and restored afterwards. That was verified by mutation rather than assumed: flipping the request to POST fails three scenarios. Fixtures get a unique path and a unique guard constant per call becauserequire_oncecaches by resolved path anddefine()lasts for the whole process, so a shared fixture makes every test after the first pass whether the load path works or not.exitis never mocked:wp_safe_redirectthrows, and every scenario asserts the halt flag against its expectation rather than just asserting a halt, so the seven non-halting paths prove no redirect happened.One honest limitation: DEFER is a no-op by definition, so its assertions hold whether or not the resolver ran. Its observable half is the load guard, and that is what the scenario tests; the request gate is covered by the other three policies.
Verify:
slic run unitandslic run unit --env multisite— 349 tests green on both legs, pluscomposer test:analysis. The multisite leg is not a formality here:deactivate_plugins()is network-wide and both options are network options.