<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[49358] trunk: Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/49358">49358</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/49358","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>desrosj</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-10-28 19:01:19 +0000 (Wed, 28 Oct 2020)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.
This change introduces the `LOCAL_PHPUNIT` environment variable that 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.
Fixes <a href="https://core.trac.wordpress.org/ticket/50042">#50042</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkenv">trunk/.env</a></li>
<li><a href="#trunkdockercomposeyml">trunk/docker-compose.yml</a></li>
<li><a href="#trunkpackagelockjson">trunk/package-lock.json</a></li>
<li><a href="#trunkpackagejson">trunk/package.json</a></li>
<li><a href="#trunktoolslocalenvscriptsdockerjs">trunk/tools/local-env/scripts/docker.js</a></li>
<li><a href="#trunktoolslocalenvscriptsinstalljs">trunk/tools/local-env/scripts/install.js</a></li>
<li><a href="#trunktoolslocalenvscriptsstartjs">trunk/tools/local-env/scripts/start.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkenv"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/.env</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/.env 2020-10-28 18:35:14 UTC (rev 49357)
+++ trunk/.env 2020-10-28 19:01:19 UTC (rev 49358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,6 +3,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # All of these options can be overridden by setting them as environment variables before starting
</span><span class="cx" style="display: block; padding: 0 10px"> # the environment. You will need to restart your environment when changing any of these.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+#
+# Below, the following substitutions can be made:
+# - '{version}': any major.minor PHP version from 5.2 onwards.
+# - '{phpunit_version}': any major PHPUnit version starting with 4.
</ins><span class="cx" style="display: block; padding: 0 10px"> ##
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> # The site will be available at http://localhost:LOCAL_PORT
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,10 +15,30 @@
</span><span class="cx" style="display: block; padding: 0 10px"> # Where to run WordPress from. Valid options are 'src' and 'build'.
</span><span class="cx" style="display: block; padding: 0 10px"> LOCAL_DIR=src
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-# The PHP version to use. Valid options are 'latest', and '{version}-fpm', where '{version}' is any
-# x.y PHP version from 5.2 onwards.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
</ins><span class="cx" style="display: block; padding: 0 10px"> LOCAL_PHP=latest
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+##
+# The PHPUnit version to use when running tests.
+#
+# Support for new PHPUnit versions is not backported to past versions, so some old WordPress branches require an older
+# version to run tests.
+#
+# Valid versions are:
+# - 'latest' for the highest version of PHPUnit supported on the highest version of PHP supported.
+# - '{version}-fpm' for the highest version of PHPUnit supported on the specified version of PHP.
+# - '{phpunit_version}-php-{version}-fpm' for a specific version of PHPUnit on the specified version of PHP. This format
+# is only available for PHP versions 5.6 and higher.
+#
+# For the full list of available options, see https://hub.docker.com/r/wordpressdevelop/phpunit/tags.
+#
+# For full documentation on PHPUnit compatibility and WordPress versions, see
+# https://make.wordpress.org/core/handbook/references/phpunit-compatibility-and-wordpress-versions/.
+#
+# This defaults to the value assigned to the value of LOCAL_PHP.
+##
+LOCAL_PHPUNIT=${LOCAL_PHP}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> # Whether or not to enable XDebug.
</span><span class="cx" style="display: block; padding: 0 10px"> LOCAL_PHP_XDEBUG=false
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunkdockercomposeyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/docker-compose.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/docker-compose.yml 2020-10-28 18:35:14 UTC (rev 49357)
+++ trunk/docker-compose.yml 2020-10-28 19:01:19 UTC (rev 49358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,7 +96,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> # The PHPUnit container.
</span><span class="cx" style="display: block; padding: 0 10px"> ##
</span><span class="cx" style="display: block; padding: 0 10px"> phpunit:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- image: wordpressdevelop/phpunit:${LOCAL_PHP-latest}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ image: wordpressdevelop/phpunit:${LOCAL_PHPUNIT-latest}
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> networks:
</span><span class="cx" style="display: block; padding: 0 10px"> - wpdevnet
</span></span></pre></div>
<a id="trunkpackagelockjson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/package-lock.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/package-lock.json 2020-10-28 18:35:14 UTC (rev 49357)
+++ trunk/package-lock.json 2020-10-28 19:01:19 UTC (rev 49358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -9135,9 +9135,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "dotenv": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "version": "8.1.0",
- "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.1.0.tgz",
- "integrity": "sha512-GUE3gqcDCaMltj2++g6bRQ5rBJWtkWTmqmD0fo1RnnMuUqHNCt2oTPeDnS9n6fKYvlhn7AeBkb38lymBtWBQdA==",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
+ "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
</ins><span class="cx" style="display: block; padding: 0 10px"> "dev": true
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "dotenv-expand": {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25201,6 +25201,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "tar-stream": "^2.0.0"
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "dependencies": {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "base64-js": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
+ "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
+ "dev": true
+ },
</ins><span class="cx" style="display: block; padding: 0 10px"> "bl": {
</span><span class="cx" style="display: block; padding: 0 10px"> "version": "4.0.3",
</span><span class="cx" style="display: block; padding: 0 10px"> "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.3.tgz",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25213,13 +25219,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "buffer": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "version": "5.6.0",
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz",
- "integrity": "sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw==",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "version": "5.7.0",
+ "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.0.tgz",
+ "integrity": "sha512-cd+5r1VLBwUqTrmnzW+D7ABkJUM6mr7uv1dv+6jRw4Rcl7tFIFHDqHPL98LhpGFn3dbAt3gtLxtrWp4m1kFrqg==",
</ins><span class="cx" style="display: block; padding: 0 10px"> "dev": true,
</span><span class="cx" style="display: block; padding: 0 10px"> "requires": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "base64-js": "^1.0.2",
- "ieee754": "^1.1.4"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "base64-js": "^1.3.1",
+ "ieee754": "^1.1.13"
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "readable-stream": {
</span></span></pre></div>
<a id="trunkpackagejson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/package.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/package.json 2020-10-28 18:35:14 UTC (rev 49357)
+++ trunk/package.json 2020-10-28 19:01:19 UTC (rev 49358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -35,7 +35,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "check-node-version": "4.0.1",
</span><span class="cx" style="display: block; padding: 0 10px"> "copy-webpack-plugin": "^5.1.1",
</span><span class="cx" style="display: block; padding: 0 10px"> "cssnano": "4.1.10",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "dotenv": "8.1.0",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "dotenv": "8.2.0",
</ins><span class="cx" style="display: block; padding: 0 10px"> "dotenv-expand": "5.1.0",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt": "~1.1.0",
</span><span class="cx" style="display: block; padding: 0 10px"> "grunt-banner": "^0.6.0",
</span></span></pre></div>
<a id="trunktoolslocalenvscriptsdockerjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tools/local-env/scripts/docker.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tools/local-env/scripts/docker.js 2020-10-28 18:35:14 UTC (rev 49357)
+++ trunk/tools/local-env/scripts/docker.js 2020-10-28 19:01:19 UTC (rev 49358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,6 +1,8 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const dotenv = require( 'dotenv' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const dotenv = require( 'dotenv' );
+const dotenvExpand = require( 'dotenv-expand' );
</ins><span class="cx" style="display: block; padding: 0 10px"> const { execSync } = require( 'child_process' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-dotenv.config();
</del><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+dotenvExpand( dotenv.config() );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Execute any docker-compose command passed to this script.
</span><span class="cx" style="display: block; padding: 0 10px"> execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
</span></span></pre></div>
<a id="trunktoolslocalenvscriptsinstalljs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tools/local-env/scripts/install.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tools/local-env/scripts/install.js 2020-10-28 18:35:14 UTC (rev 49357)
+++ trunk/tools/local-env/scripts/install.js 2020-10-28 19:01:19 UTC (rev 49358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,9 +1,10 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const dotenv = require( 'dotenv' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const dotenv = require( 'dotenv' );
+const dotenvExpand = require( 'dotenv-expand' );
</ins><span class="cx" style="display: block; padding: 0 10px"> const wait_on = require( 'wait-on' );
</span><span class="cx" style="display: block; padding: 0 10px"> const { execSync } = require( 'child_process' );
</span><span class="cx" style="display: block; padding: 0 10px"> const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-dotenv.config();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+dotenvExpand( dotenv.config() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Create wp-config.php.
</span><span class="cx" style="display: block; padding: 0 10px"> wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' );
</span></span></pre></div>
<a id="trunktoolslocalenvscriptsstartjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tools/local-env/scripts/start.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tools/local-env/scripts/start.js 2020-10-28 18:35:14 UTC (rev 49357)
+++ trunk/tools/local-env/scripts/start.js 2020-10-28 19:01:19 UTC (rev 49358)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,8 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const dotenv = require( 'dotenv' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const dotenv = require( 'dotenv' );
+const dotenvExpand = require( 'dotenv-expand' );
</ins><span class="cx" style="display: block; padding: 0 10px"> const { execSync } = require( 'child_process' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-dotenv.config();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+dotenvExpand( dotenv.config() );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Start the local-env containers.
</span><span class="cx" style="display: block; padding: 0 10px"> execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
</span></span></pre>
</div>
</div>
</body>
</html>