Make WordPress Core

Changeset 49366


Ignore:
Timestamp:
10/29/2020 12:02:45 AM (5 years ago)
Author:
desrosj
Message:

Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.

This introduces the LOCAL_PHPUNIT environment variable, which allows the desired version of PHPUnit to be specified when running the PHP tests within the local Docker environment.

Because support for newer versions of PHPUnit is not backported, some versions of PHP need the ability to run multiple versions of PHPUnit for different branches. This adds the flexibility needed to use the Docker environment within those older branches to run the PHP tests.

Props johnbillion, SergeyBiryukov.
Merges [49362] to the 5.3 branch.
Fixes #50042.

Location:
branches/5.3
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/5.3

  • branches/5.3/.env

    r45783 r49366  
    44# All of these options can be overriden by setting them as environment variables before starting
    55# the environment. You will need to restart your environment when changing any of these.
     6#
     7# Below, the following substitutions can be made:
     8# - '{version}': any major.minor PHP version from 5.2 onwards.
     9# - '{phpunit_version}': any major PHPUnit version starting with 4.
    610##
    711
     
    1216LOCAL_DIR=src
    1317
    14 # The PHP version to use. Valid options are 'latest', and '{version}-fpm', where '{version}' is any
    15 # x.y PHP version from 5.2 onwards.
     18# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
    1619LOCAL_PHP=latest
     20
     21##
     22# The PHPUnit version to use when running tests.
     23#
     24# Support for new PHPUnit versions is not backported to past versions, so some old WordPress branches require an older
     25# version to run tests.
     26#
     27# Valid versions are:
     28# - 'latest' for the highest version of PHPUnit supported on the highest version of PHP supported.
     29# - '{version}-fpm' for the highest version of PHPUnit supported on the specified version of PHP.
     30# - '{phpunit_version}-php-{version}-fpm' for a specific version of PHPUnit on the specified version of PHP. This format
     31# is only available for PHP versions 5.6 and higher.
     32#
     33# For the full list of available options, see https://hub.docker.com/r/wordpressdevelop/phpunit/tags.
     34#
     35# For full documentation on PHPUnit compatibility and WordPress versions, see
     36# https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/.
     37#
     38# This defaults to the value assigned to the value of LOCAL_PHP.
     39##
     40LOCAL_PHPUNIT=${LOCAL_PHP}
    1741
    1842# Whether or not to enable XDebug.
  • branches/5.3/.travis.yml

    r49279 r49366  
    2626matrix:
    2727  include:
    28   - env: WP_TRAVISCI=test:e2e
     28  - env: WP_TRAVISCI=test:e2e LOCAL_PHPUNIT=7.4-fpm
    2929    name: E2E Tests
    3030  - env: WP_TRAVISCI=lint:php COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
     
    3434  - env: WP_TRAVISCI=test:compat COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
    3535    name: "PHP Compatibility Check"
    36   - env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
     36  - env: LOCAL_PHP=7.4-fpm LOCAL_PHPUNIT=7.4-fpm WP_TRAVISCI=test:php
    3737    name: "PHPUnit Tests: PHP 7.4"
    38   - env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
     38  - env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=7.3-fpm WP_TRAVISCI=test:php
    3939    name: "PHPUnit Tests: PHP 7.3"
    40   - env: LOCAL_PHP=7.3-fpm LOCAL_PHP_MEMCACHED=true WP_TRAVISCI=test:php
     40  - env: LOCAL_PHP=7.3-fpm LOCAL_PHPUNIT=7.3-fpm LOCAL_PHP_MEMCACHED=true WP_TRAVISCI=test:php
    4141    name: "PHPUnit Tests: PHP 7.3 with Memcached"
    42   - env: LOCAL_PHP=7.2-fpm WP_TRAVISCI=test:php
     42  - env: LOCAL_PHP=7.2-fpm LOCAL_PHPUNIT=7.2-fpm WP_TRAVISCI=test:php
    4343    name: "PHPUnit Tests: PHP 7.2"
    44   - env: LOCAL_PHP=7.1-fpm WP_TRAVISCI=test:php
     44  - env: LOCAL_PHP=7.1-fpm LOCAL_PHPUNIT=7.1-fpm WP_TRAVISCI=test:php
    4545    name: "PHPUnit Tests: PHP 7.1"
    46   - env: LOCAL_PHP=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
     46  - env: LOCAL_PHP=7.0-fpm LOCAL_PHPUNIT=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
    4747    name: "PHPUnit Tests: PHP 7.0"
    48   - env: LOCAL_PHP=5.6-fpm WP_TRAVISCI=test:php
     48  - env: LOCAL_PHP=5.6-fpm LOCAL_PHPUNIT=5.6-fpm WP_TRAVISCI=test:php
    4949    name: "PHPUnit Tests: PHP 5.6"
    50   - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
     50  - env: LOCAL_PHP=8.0-fpm LOCAL_PHPUNIT=8.0-fpm WP_TRAVISCI=test:php
    5151    name: "PHPUnit Tests: PHP 8.0"
    5252  allow_failures:
    5353  - env: WP_TRAVISCI=test:compat COMPOSER_INSTALL=true NPM_INSTALL=false WP_INSTALL=false
    54   - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
     54  - env: LOCAL_PHP=8.0-fpm LOCAL_PHPUNIT=8.0-fpm WP_TRAVISCI=test:php
    5555  fast_finish: true
    5656
  • branches/5.3/docker-compose.yml

    r47125 r49366  
    9494  ##
    9595  phpunit:
    96     image: wordpressdevelop/phpunit:${LOCAL_PHP-latest}
     96    image: wordpressdevelop/phpunit:${LOCAL_PHPUNIT-latest}
    9797
    9898    networks:
  • branches/5.3/package-lock.json

    r47990 r49366  
    71947194        },
    71957195        "dotenv": {
    7196             "version": "8.1.0",
    7197             "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.1.0.tgz",
    7198             "integrity": "sha512-GUE3gqcDCaMltj2++g6bRQ5rBJWtkWTmqmD0fo1RnnMuUqHNCt2oTPeDnS9n6fKYvlhn7AeBkb38lymBtWBQdA==",
     7196            "version": "8.2.0",
     7197            "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
     7198            "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
    71997199            "dev": true
    72007200        },
  • branches/5.3/package.json

    r49279 r49366  
    3434        "copy-webpack-plugin": "^5.0.4",
    3535        "cssnano": "4.1.10",
    36         "dotenv": "8.1.0",
     36        "dotenv": "8.2.0",
    3737        "dotenv-expand": "5.1.0",
    3838        "grunt": "~1.0.4",
  • branches/5.3/tools/local-env/scripts/docker.js

    r45783 r49366  
    1 const dotenv = require( 'dotenv' );
     1const dotenv       = require( 'dotenv' );
     2const dotenvExpand = require( 'dotenv-expand' );
    23const { execSync } = require( 'child_process' );
    3 dotenv.config();
     4
     5dotenvExpand( dotenv.config() );
    46
    57// Execute any docker-compose command passed to this script.
  • branches/5.3/tools/local-env/scripts/install.js

    r49342 r49366  
    1 const dotenv = require( 'dotenv' );
     1const dotenv       = require( 'dotenv' );
     2const dotenvExpand = require( 'dotenv-expand' );
    23const wait_on = require( 'wait-on' );
    34const { execSync } = require( 'child_process' );
    45const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
    56
    6 dotenv.config();
     7dotenvExpand( dotenv.config() );
    78
    89// Create wp-config.php.
  • branches/5.3/tools/local-env/scripts/start.js

    r45819 r49366  
    1 const dotenv = require( 'dotenv' );
     1const dotenv       = require( 'dotenv' );
     2const dotenvExpand = require( 'dotenv-expand' );
    23const { execSync } = require( 'child_process' );
    34
    4 dotenv.config();
     5dotenvExpand( dotenv.config() );
    56
    67// Start the local-env containers.
Note: See TracChangeset for help on using the changeset viewer.