WordPress.org

Make WordPress Core

Changeset 50285


Ignore:
Timestamp:
02/10/2021 04:52:13 PM (3 months ago)
Author:
desrosj
Message:

Build/Test Tools: Install WordPress Importer plugin when installing the Docker-based local environment.

The WordPress Importer plugin is now downloaded to the tests/phpunit/data/plugins directory when running npm run env:install.

This ensures that the PHPUnit test suite will not fail when the plugin is missing.

This also introduces a new WP_IMPORTER_REVISION variable to the .env file, to control the SVN revision that is checked out.

Props johnbillion.
Fixes #49720.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/.env

    r49836 r50285  
    4646LOCAL_PHP_MEMCACHED=false
    4747
     48##
    4849# The database software to use.
    4950#
    5051# Supported values are `mysql` and `mariadb`.
     52##
    5153LOCAL_DB_TYPE=mysql
    5254
     55##
    5356# The database version to use.
    5457#
     
    5760# When using `mysql`, see https://hub.docker.com/_/mysql/ for valid versions.
    5861# When using `mariadb`, see https://hub.docker.com/_/mariadb for valid versions.
     62##
    5963LOCAL_DB_VERSION=5.7
    6064
     
    6872# The URL to use when running e2e tests.
    6973WP_BASE_URL=http://localhost:${LOCAL_PORT}
     74
     75##
     76# The revision number of the WordPress Importer plugin to use when running unit tests.
     77#
     78# This should be an SVN revision number from the official plugin repository on wordpress.org.
     79##
     80WP_IMPORTER_REVISION=2387243
  • trunk/.github/workflows/phpunit-tests.yml

    r49938 r50285  
    2525  # - Cancels all previous workflow runs for pull requests that have not completed.
    2626  # - Checks out the repository.
    27   # - Checks out the WordPress Importer plugin (needed for the Core PHPUnit tests).
    2827  # - Logs debug information about the runner container.
    2928  # - Installs NodeJS 14.
     
    4746      - name: Checkout repository
    4847        uses: actions/checkout@v2
    49 
    50       - name: Checkout the WordPress Importer plugin
    51         run: svn checkout -r 2387243 https://plugins.svn.wordpress.org/wordpress-importer/trunk/ tests/phpunit/data/plugins/wordpress-importer
    5248
    5349      - name: Log debug information
  • trunk/tools/local-env/scripts/install.js

    r49362 r50285  
    2020// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
    2121renameSync( 'src/wp-config.php', 'wp-config.php' );
     22
     23install_wp_importer();
    2224
    2325// Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php.
     
    4648    execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
    4749}
     50
     51/**
     52 * Downloads the WordPress Importer plugin for use in tests.
     53 */
     54function install_wp_importer() {
     55    const test_plugin_directory = 'tests/phpunit/data/plugins/wordpress-importer';
     56
     57    execSync( `docker-compose exec -T php rm -rf ${test_plugin_directory} && svn checkout -r ${process.env.WP_IMPORTER_REVISION} https://plugins.svn.wordpress.org/wordpress-importer/trunk/ ${test_plugin_directory}`, { stdio: 'inherit' } );
     58}
Note: See TracChangeset for help on using the changeset viewer.