Enforce "Tested up to" exclusively in the readme file - #1465
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Two minor nits:
|
|
Done! |
marceltannich
left a comment
There was a problem hiding this comment.
Tested this in Playground with both matching and different Tested up to values in the plugin header and readme, and both cases behave as expected.
The changes and test coverage look good to me. I only left one small inline comment, but nothing blocking.
|
Thanks @marceltannich for your review! I'm going to update the comment. |
Description
Fixes #1464
Replaces the mismatch-only validation in
Plugin_Readme_Check::check_tested_up_to_mismatch()with a presence check: an error is now reported whenever the main plugin PHP file declares aTested up toheader, regardless of whether the readme value is missing, equal, or different.Why
Tested up tois readme metadata and must live in readme file only (reference). Previously, Plugin Check only flagged this field when the header and readme values differed, which validated the duplicated declaration whenever both values happened to match — leaving two sources of truth that can silently drift in a future release.Changes
includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.phpcheck_tested_up_to_mismatch()now bails only if the plugin header has noTested up tovalue (or is a single-file plugin).plugin_header_tested_up_to_not_allowedattached to the main plugin file whenever the header declaresTested up to:Tested up toline from the plugin header and keep it only inreadme.txt.mismatched_tested_up_to_headererror code.tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.phptest_run_with_mismatch,test_run_with_match,test_run_with_header_only,test_run_with_readme_only,test_run_with_single_file_plugin, andtest_run_with_no_readmeto assert against the newplugin_header_tested_up_to_not_allowedcode and the new expected behavior (including the previously "no error"matchcase, which now correctly reports an error).Existing fixtures under
tests/phpunit/testdata/plugins/test-plugin-tested-up-to-*are reused as-is; only the assertions changed to reflect the new rule.Acceptance criteria
Tested up toin both readme and header → 1 error.Testing
Ran the updated
Plugin_Readme_Check_Testssuite locally vianpm run test-php -- --filter Plugin_Readme_Check_Tests.