#56629 closed defect (bug) (fixed)
Delete Link Manager plugin after running REST API plugins controller tests
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | 5.5 |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests |
Focuses: | Cc: |
Description
After running the multisite PHPUnit test suite, the following files remain, contributing toward a dirty working copy:
tests/phpunit/data/plugins/link-manager/link-manager.php tests/phpunit/data/plugins/link-manager/readme.txt
These files should be deleted after running the tests.
Background
The following three tests in /tests/rest-api/rest-plugins-controller.php
are the last ones related to the Link Manager plugin. In each test, it first deletes the plugin if it exists (via delete_plugins( array( 'link-manager/link-manager.php' ) )
), and then attempts to install the plugin.
test_create_item_and_activate_errors_if_no_permission_to_activate_plugin()
test_create_item_and_network_activate_rejected_if_not_multisite()
(skipped in multisite testing)test_create_item_and_network_activate()
(skipped in non-multisite testing)
During non-multisite testing, phpunit
executes both #1 and #2. Test #2 deletes the plugin, and then fails to install the plugin because it is not multisite. The plugin cleanup from #1 is coincidental.
But in multisite testing, tests #1 and #3 are run. Because the plugin deletion occurs at the start of each test, and test #3 succeeds, the plugin is installed and its files remain at the end of the test.
Testing Instructions
Steps to Reproduce
- Run the multisite PHPUnit tests (also see optional filter in Additional Information below):
phpunit --verbose -c tests/phpunit/multisite.xml
- 🐞 Observe that files in
tests/phpunit/data/plugins/link-manager/
remain after tests complete.
Expected Results
- ❌ link-manager plugin files should be deleted after running the tests.
Additional Information
To shorten the time needed to reproduce the issue, optionally apply a phpunit
filter to run the final Link Manager test in /tests/rest-api/rest-plugins-controller.php
:
phpunit --verbose -c tests/phpunit/multisite.xml --filter test_create_item_and_network_activate
Test Report Icons:
🐞 <= Indicates where issue ("bug") occurs.
✅ <= Behavior is expected.
❌ <= Behavior is NOT expected.
Related: #52579.
Change History (7)
This ticket was mentioned in PR #3314 on WordPress/wordpress-develop by ironprogrammer.
15 months ago
#1
- Keywords has-patch has-unit-tests added
#4
@
15 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 54301:
SergeyBiryukov commented on PR #3314:
15 months ago
#5
Thanks for the PR! Merged in r54301.
In tests/phpunit/tests/rest-api/rest-plugins-controller.php:
link-manager
plugin during test tear down.Trac ticket: https://core.trac.wordpress.org/ticket/56629