Repository navigation
Only modify uploads directory when running core test suite. - #15914
peterwilsoncc wants to merge 1 commit into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the change limiting upload-directory isolation to WordPress core test runs.
No open issues 🎉
What changed in this PR
This PR limits upload-directory isolation to WordPress core test runs, preserving default upload paths for plugins and themes that use the test suite.
Changes:
- Requires
WP_RUN_CORE_TESTSto be enabled before defining and cleaning the dedicated test uploads directory. - Adds a
wp-content/uploadsfallback to_upload_get_url()whenUPLOADSis undefined.
| File | Description |
|---|---|
tests/phpunit/includes/functions.php |
Adds the default uploads path fallback to the URL helper. |
tests/phpunit/includes/bootstrap.php |
Restricts dedicated uploads setup and cleanup to core test runs. |
Review effort: Balanced
lancewillett
left a comment
There was a problem hiding this comment.
Verified 332a7e1. Two existing WooCommerce cases reproduced the upload-path regression against the base and passed with this patch: MaxMind database paths and download-handler files. The comparison used the original test assertions from before WooCommerce’s workaround with a newer local plugin copy, held constant between runs.
Focused Core upload and media checks passed before and after on single-site and multisite. The bootstrap diagnostic also confirmed that non-Core suites retain their default path and avoid the Core-only cleanup. Full local suites were not run; CI is green, and Copilot reported no issues.
AI review · gpt-6
|
PR #15914 landed in https://core.trac.wordpress.org/changeset/65409 |
Preserve default upload paths for plugin and theme test suites. Only define and clean the dedicated uploads directory when `WP_RUN_CORE_TESTS` is enabled. Developed in: #15914 Props peterwilsoncc. See #63532. git-svn-id: https://develop.svn.wordpress.org/trunk@65409 602fd350-edb4-49c9-b593-d223f7449a82
Preserve default upload paths for plugin and theme test suites. Only define and clean the dedicated uploads directory when `WP_RUN_CORE_TESTS` is enabled. Developed in: WordPress/wordpress-develop#15914 Props peterwilsoncc. See #63532. Built from https://develop.svn.wordpress.org/trunk@65409 git-svn-id: http://core.svn.wordpress.org/trunk@64548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Limits the dedicated test uploads directory introduced in r65177 / 2700c1f and r65190 / 9dfdf85 to runs of the WordPress core test suite.
Defining
UPLOADSaswp-content/test-suite-uploadsfor every run broke plugins and themes that use the test suite and assert against upload paths or URLs.UPLOADSis now only defined, and the test uploads directory only cleaned, whenWP_RUN_CORE_TESTSis set. The corephpunit.xml.distandtests/phpunit/multisite.xmlconfigurations already set it._upload_get_url()test helper falls back towp-content/uploadswhenUPLOADSis not defined, rather than causing a fatal error.Testing:
vendor/bin/phpunit --group upload,mediaand confirm the tests pass.phpunit.xml.distto a new file and remove theWP_RUN_CORE_TESTSconstant. Using this configuration, run a test assertingUPLOADSis not defined andwp_upload_dir()['basedir']ends inwp-content/uploads.Trac ticket: https://core.trac.wordpress.org/ticket/63532#comment:39
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Drafting the code change and this description, and running the tests. I reviewed the change and the test results.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.