[wp-trac] [WordPress Trac] #51735: Increase the reliability of backing up the mu-plugins directory during tests
WordPress Trac
noreply at wordpress.org
Mon Nov 9 18:49:27 UTC 2020
#51735: Increase the reliability of backing up the mu-plugins directory during
tests
------------------------------+-----------------------------
Reporter: johnbillion | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Keywords: needs-patch
Focuses: |
------------------------------+-----------------------------
In order to facilitate switching back to using `src` as the default
directory for testing (#51734) we need to be sure that there's no chance
of local files being deleted during a test run.
The tests in `tests/phpunit/tests/admin/includesPlugin.php` perform a
potentially dangerous operation. They back up the `mu-plugins` directory
but then perform assertions before restoring the backup. If an assertion
fails, you can lose your `mu-plugins` directory.
To increase the reliability of these tests:
1. The backup and restore should only happen once, during
`wpSetUpBeforeClass()` and `wpTearDownAfterClass()`
2. The backup and restore should just rename the directory to save a bunch
of file iteration and writing.
3. The assertions should be moved to the end of each test so any test-
specific cleanup always runs.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51735>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list