WordPress.org

Make WordPress Core

Ticket #46149: 46149.diff

File 46149.diff, 1.3 KB (added by thomasplevy, 2 months ago)
  • tests/phpunit/includes/bootstrap.php

    diff --git a/tests/phpunit/includes/bootstrap.php b/tests/phpunit/includes/bootstrap.php
    index b557efd3d9..58cde8e962 100644
    a b if ( defined( 'WP_TESTS_CONFIG_FILE_PATH' ) ) { 
    1616        $config_file_path .= '/wp-tests-config.php';
    1717}
    1818
     19if ( defined( 'WP_TESTS_VENDOR_DIR_PATH' ) ) {
     20        $vendor_dir_path = WP_TESTS_VENDOR_DIR_PATH;
     21} else {
     22        $vendor_dir_path = __DIR__ . '/../../..';
     23}
     24
    1925/*
    2026 * Globalize some WordPress variables, because PHPUnit loads this file inside a function.
    2127 * See: https://github.com/sebastianbergmann/phpunit/issues/325
    require_once __DIR__ . '/class-mockobject-autoload.php'; 
    5157spl_autoload_register( 'MockObject_Autoload::load', true, true );
    5258
    5359// Check that the PHPUnit Polyfills autoloader exists.
    54 $phpunit_polyfills_autoloader = __DIR__ . '/../../../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
     60$phpunit_polyfills_autoloader = $vendor_dir_path . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
    5561if ( ! file_exists( $phpunit_polyfills_autoloader ) ) {
    5662        echo "Error: You need to run `composer update` before running the tests.\n";
    5763        echo "You can still use a PHPUnit phar to run them, but the dependencies do need to be installed.\n";