[wp-trac] [WordPress Trac] #56629: Delete Link Manager plugin after running REST API plugins controller tests

WordPress Trac noreply at wordpress.org
Thu Sep 22 20:33:42 UTC 2022


#56629: Delete Link Manager plugin after running REST API plugins controller tests
------------------------------+-----------------------------
 Reporter:  ironprogrammer    |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:  5.5
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 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 [https://wordpress.org/plugins/link-
 manager/ 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.

 1.
 `test_create_item_and_activate_errors_if_no_permission_to_activate_plugin()`
 2. `test_create_item_and_network_activate_rejected_if_not_multisite()`
 ''(skipped in multisite testing)''
 3. `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
 1. Run the multisite PHPUnit tests (also see optional filter in
 **Additional Information** below):
 {{{
 phpunit --verbose -c tests/phpunit/multisite.xml
 }}}
 2. 🐞 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56629>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list