Repository navigation
Test that deactivation does not create the plugin option - #101
Merged
Merged
Conversation
Sets up PHPUnit the way fewer-tags and comment-experience do: yoast/wp-test-utils, tests/bin/install-wp-tests.sh and `composer test`. The lock file is resolved for PHP 7.4 (config.platform.php), the lowest version the plugin supports. The first suite (52 tests) covers the tracking table, option access tracking, activation/deactivation, the known-plugins mapping, and the REST routes that change or delete options, including the capability and nonce checks. test.yml runs it on PHP 7.4/WP 6.7, PHP 8.2/WP latest and PHP 8.4/WP latest multisite. PHPStan now also skips node_modules, which holds PHP files after `npm ci`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`npm run lint:css` could not run at all: the root @wordpress/stylelint-config ^22 pulled in stylelint 14, while @wordpress/scripts 30 ships a config that needs stylelint 16. Drop the redundant root config (wp-scripts brings its own) and depend on stylelint 16 directly. Apply the auto-fixes (whitespace, `bold` to `700`, one Prettier line join) and baseline the two no-descending-specificity findings, since reordering those rules would change the cascade. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Copied from comment-experience/brand-assets, with every action pinned to a commit SHA. It checks the same file set that is deployed (wp dist-archive + .distignore). Add the direct file access guard to src/autoload.php, the one error Plugin Check reports. The remaining findings are warnings and do not fail the check. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
calibreapp/image-actions, as in brand-assets, limited to images under .wordpress-org and to pull requests from this repository. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The file has been empty since the playground logic moved into playground.yml, which comments on every pull request. GitHub can't parse an empty workflow, so each push recorded a failed run. Same change as #96. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The deactivation routine called update_option() with the value it had just read. update_option() returns early when the value is unchanged, so the autoload flag was never touched and option_optimizer stayed autoloaded after deactivation. When the option was missing, the same call created it with a value of false. Use wp_set_option_autoload() (WP 6.4+, the plugin requires 6.7), which changes only the flag and does nothing when the option does not exist. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Plugin readme previewOpen preview · Commit 29 passed · 1 warning · 0 notes Warnings
Passed checks (29)
Readme and PHP-header checks only; this does not test plugin runtime compatibility. |
|
Test on Playground |
Deactivation re-saved the unchanged option with update_option(), which returns before touching autoload, so the option stayed autoloaded. Use wp_set_option_autoload() and assert it in the test. The two REST tests created their admin user before batch_insert(), whose COMMIT made the user (and the multisite super admin grant) permanent. Create the user after the commit so it is rolled back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The base branch now carries the same wp_set_option_autoload() fix. Keep its version of the code and test, plus the extra test for a missing option. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
#100 was squash-merged, so the branch needed develop's history. No content change beyond the extra deactivation test. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Stacked on #100. Retarget to
developonce #100 is merged.The deactivation fix itself (
wp_set_option_autoload()instead of re-saving the unchanged option) has since been pushed to #100 directly in dc39856, so this PR no longer changes plugin code.What is left is one extra test: the old
update_option()call createdoption_optimizerwith a value offalsewhen the option did not exist.test_deactivation_does_not_create_the_plugin_optionasserts the fixed routine leaves a missing option missing. The existing deactivation test also flushes the cache before reading the value back.Run locally on PHP 8.4 with WP 7.1.4, single and multisite: 53 tests pass.
composer check-csandcomposer phpstanpass.🤖 Generated with Claude Code