Make WordPress Core


Ignore:
Timestamp:
09/24/2024 06:09:41 PM (20 months ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Check if the WordPress Importer plugin is installed in test bootstrap.

If a hard requirement for the test suite is not fulfilled, running the tests should be blocked from the test bootstrap. A test should only fail when it doesn't produce the expected result.

Since the WordPress Importer plugin is considered a hard requirement for the test suite at this time, this commit moves the check whether the plugin is installed from individual tests to the test bootstrap.

Includes defining a global constant for the path to the file for reuse in the tests.

Reference: Core Contributor Handbook: The Code Repository (Git): Unit Tests.

Follow-up to [40531], [40532], [41090], [41169], [48592], [49535], [49571].

Props jrf, hellofromTonya.
See #61530.

File:
1 edited

Legend:

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

    r56552 r59085  
    215215define( 'DIR_TESTDATA', __DIR__ . '/../data' );
    216216define( 'DIR_TESTROOT', realpath( dirname( __DIR__ ) ) );
     217define( 'IMPORTER_PLUGIN_FOR_TESTS', DIR_TESTDATA . '/plugins/wordpress-importer/wordpress-importer.php' );
     218
     219if ( ! file_exists( IMPORTER_PLUGIN_FOR_TESTS ) ) {
     220    echo 'The test suite requires the WordPress Importer plugin to be available in the `/data/plugins/` directory.'
     221        . ' See: https://make.wordpress.org/core/handbook/contribute/git/#unit-tests' . PHP_EOL,
     222    exit( 1 );
     223}
    217224
    218225define( 'WP_LANG_DIR', realpath( DIR_TESTDATA . '/languages' ) );
Note: See TracChangeset for help on using the changeset viewer.