Opened 4 years ago
Closed 4 years ago
#52579 closed defect (bug) (fixed)
Delete link-manager.zip after running the REST API plugins controller tests
Reported by: | johnbillion | Owned by: | davidbaumwald |
---|---|---|---|
Milestone: | 5.8 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Build/Test Tools | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
After running the PHPUnit tests the untracked DIR_TESTDATA/link-manager.zip
file is left in place, creating a dirty working copy. See WP_REST_Plugins_Controller_Test::setup_plugin_download()
.
This file should be deleted after the tests that use it have run.
Introduced in [48242].
cc @TimothyBlynJacobs
Attachments (2)
Change History (11)
#3
@
4 years ago
I had tested this and forgot to report back. Looks like the file was not being removed after being added in the older branches in my testing locally.
#4
@
4 years ago
Ack, my mistake for not catching that before committing. Thanks for checking @desrosj!
Looking at it further, I think the culprit may be test_create_item_and_activate_errors_if_no_permission_to_activate_plugin
. It sets up the plugin download even though the plugin won't get installed because the user doesn't have permission.
#5
@
4 years ago
- Keywords has-patch added; needs-patch removed
@TimothyBlynJacobs Yep, that is the culprit. I added removing the link-manager.zip
file if it exists to the tearDown()
method in 52579.patch
#6
@
4 years ago
- Keywords commit added
@rachelbaker 52579.patch looks good. I tested locally, and link-manager.zip
is cleaned up after the unit tests now. I think this just needs a slight fix for indentation. Would you like to handle the commit
?
I feel like something regressed here, because I don't think it did this when it was initially committed. IIRC,
setup_plugin_download
copies the zip to the alternate location because after the plugin was installed, the source file was being deleted. I'm not sure why it isn't being deleted anymore. Looking at the call tounpack_package
inWP_Upgrader::run
it seems like it should be being deleted.That being said, we could probably add an
unlink
intearDown
like we're currently doing for the test plugin regardless.