Make WordPress Core

Changeset 65409


Ignore:
Timestamp:
11/12/2026 03:30:19 AM (less than one hour ago)
Author:
lancewillett
Message:

Tests: Limit upload directory isolation to the Core test suite.

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: ​https://github.com/WordPress/wordpress-develop/pull/15914

Props peterwilsoncc.
See #63532.

Location:
trunk/tests/phpunit/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/bootstrap.php

    r65385 r65409  
    251251
    252252/*
     253 * Isolate uploads in a dedicated directory when running the core test suite only,
     254 * so that plugins and themes using the test suite keep the default uploads location.
     255 *
    253256 * Tests that cover the upload_path and upload_url_path options run in a separate process
    254257 * with WP_TESTS_SKIP_UPLOADS_CONSTANT set, as UPLOADS overrides those options.
    255258 */
    256 if ( ! defined( 'UPLOADS' ) && '1' !== getenv( 'WP_TESTS_SKIP_UPLOADS_CONSTANT' ) ) {
     259if (
     260        defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS
     261        && ! defined( 'UPLOADS' )
     262        && '1' !== getenv( 'WP_TESTS_SKIP_UPLOADS_CONSTANT' )
     263) {
    257264        define( 'UPLOADS', 'wp-content/test-suite-uploads' );
    258265
  • trunk/tests/phpunit/includes/functions.php

    r65335 r65409  
    361361 */
    362362function _upload_get_url( $path = '', $scheme = 'http' ) {
    363         return $scheme . '://' . WP_TESTS_DOMAIN . '/' . trailingslashit( UPLOADS ) . ltrim( $path, '/' );
     363        $uploads = defined( 'UPLOADS' ) ? UPLOADS : 'wp-content/uploads';
     364
     365        return $scheme . '://' . WP_TESTS_DOMAIN . '/' . trailingslashit( $uploads ) . ltrim( $path, '/' );
    364366}
    365367
Note: See TracChangeset for help on using the changeset viewer.