Opened 6 years ago
Closed 6 years ago
#51735 closed defect (bug) (fixed)
Increase the reliability of backing up the mu-plugins directory during tests
| Reported by: | johnbillion | Owned by: | johnbillion |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.7 |
| Component: | Build/Test Tools | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests commit dev-reviewed |
| Cc: | Focuses: |
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.
6 years ago
#1
- Keywords has-patch has-unit-tests added; needs-patch removed
johnbillion commented on PR #714:
6 years ago
#5
#7
@
6 years ago
- Keywords commit dev-reviewed added; fixed-major removed
- Milestone 5.8 → 5.7
Let's include this with the [50441-50442] backports.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
https://core.trac.wordpress.org/ticket/51735