Repository navigation
Tests: Cover the wp_delete_file filter in wp_delete_file() - #14890
Open
bluefairydevelopment wants to merge 1 commit into
Open
bluefairydevelopment wants to merge 1 commit into
bluefairydevelopment wants to merge 1 commit into
Conversation
Add tests that an empty filtered path skips deletion and that a changed filtered path is the one deleted. Props pbearne. See #59788.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @bluefairydevelopment. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
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.
Trunk's
tests/phpunit/tests/functions/wpDeleteFile.php(added under #61590) already covers deleting a file, an empty path and a missing file. Thewp_delete_filefilter itself has no coverage. This adds the two filter cases:test_wp_delete_file_does_not_delete_when_filter_returns_empty: the filter returns an empty path,wp_delete_file()returnsfalseand the file stays.test_wp_delete_file_deletes_the_filtered_path: the filter returns a different path, that path is deleted and the original is left alone.This builds on pbearne's earlier PR #5611, which proposed the filter test before the #61590 tests landed. These are written against the current test file, using
wp_tempnam()and cleaning up after themselves.Verification: both tests pass, phpcs is clean, and when
wp_delete_file()was changed to ignore the filter, exactly these two tests failed while the existing three still passed.Props pbearne.
Trac ticket: https://core.trac.wordpress.org/ticket/59788
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: comparing the ticket, the open PR and trunk, writing the tests, and checking that they fail when the filter is ignored. Submitted by Blue Fairy Development, who are responsible for the change.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.