Opened 3 years ago
Closed 2 years ago
#51735 closed defect (bug) (fixed)
Increase the reliability of backing up the mu-plugins directory during tests
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests commit dev-reviewed |
Focuses: | Cc: |
Description
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:
- The backup and restore should only happen once, during
wpSetUpBeforeClass()
andwpTearDownAfterClass()
- The backup and restore should just rename the directory to save a bunch of file iteration and writing.
- The assertions should be moved to the end of each test so any test-specific cleanup always runs.
Change History (9)
This ticket was mentioned in PR #714 on WordPress/wordpress-develop by johnbillion.
3 years ago
#1
- Keywords has-patch has-unit-tests added; needs-patch removed
#4
@
2 years ago
- Owner set to johnbillion
- Resolution set to fixed
- Status changed from new to closed
In 50443:
johnbillion commented on PR #714:
2 years ago
#5
#6
@
2 years ago
- Keywords fixed-major added
- Resolution fixed deleted
- Status changed from closed to reopened
#7
@
2 years ago
- Keywords commit dev-reviewed added; fixed-major removed
- Milestone changed from 5.8 to 5.7
Let's include this with the [50441-50442] backports.
https://core.trac.wordpress.org/ticket/51735