<!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>[49529] branches/5.0: Build/Test Tools: Backport the local Docker environment to the 5.0 branch.</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/49529">49529</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/49529","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-11-06 17:29:16 +0000 (Fri, 06 Nov 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: Backport the local Docker environment to the 5.0 branch.

This commit introduces the Docker-based local WordPress development environment to the 5.0 branch and converts the Travis test jobs to utilize this environment for easier and more consistent testing.

Until existing blockers with the PHP 5.2 Docker container can be solved, the PHP 5.2 test job will remain using the Travis `precise` image.

Merges [45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49335,49358,49360,49362] to the 5.0 branch.
See <a href="https://core.trac.wordpress.org/ticket/48301">#48301</a>, <a href="https://core.trac.wordpress.org/ticket/47767">#47767</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches50travisyml">branches/5.0/.travis.yml</a></li>
<li><a href="#branches50packagelockjson">branches/5.0/package-lock.json</a></li>
<li><a href="#branches50packagejson">branches/5.0/package.json</a></li>
<li><a href="#branches50testsphpunittestsajaxCustomizeMenusphp">branches/5.0/tests/phpunit/tests/ajax/CustomizeMenus.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branches50env">branches/5.0/.env</a></li>
<li><a href="#branches50dockercomposeyml">branches/5.0/docker-compose.yml</a></li>
<li>branches/5.0/tools/local-env/</li>
<li><a href="#branches50toolslocalenvdefaulttemplate">branches/5.0/tools/local-env/default.template</a></li>
<li><a href="#branches50toolslocalenvmysqlinitsql">branches/5.0/tools/local-env/mysql-init.sql</a></li>
<li><a href="#branches50toolslocalenvphpconfigini">branches/5.0/tools/local-env/php-config.ini</a></li>
<li><a href="#branches50toolslocalenvphpunitconfigini">branches/5.0/tools/local-env/phpunit-config.ini</a></li>
<li>branches/5.0/tools/local-env/scripts/</li>
<li><a href="#branches50toolslocalenvscriptsdockerjs">branches/5.0/tools/local-env/scripts/docker.js</a></li>
<li><a href="#branches50toolslocalenvscriptsinstalljs">branches/5.0/tools/local-env/scripts/install.js</a></li>
<li><a href="#branches50toolslocalenvscriptsstartjs">branches/5.0/tools/local-env/scripts/start.js</a></li>
</ul>

<h3>Property Changed</h3>
<ul>
<li><a href="#branches50">branches/5.0/</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/5.0
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/5.0 2020-11-06 17:24:43 UTC (rev 49528)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/5.0  2020-11-06 17:29:16 UTC (rev 49529)
</ins><a id="branches50"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/5.0</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/4.8:42204
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/4.9:43557,43622,44991
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.5:49373-49379,49381
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:42132,42134,42136,42138,42140,42144,42146,42148,42150,42152-42153,42155,42157,42159,42161,42163,42169,42171,42173,42175,42177,42181,42183,42185,42187,42189,42191,42193,42199,42203,42210,42214,42220,42222,42226,42242,42244,42247,42250-42251,42256-42261,42350,42354,42358,42362,42364-42368,42374,42388,42390,42401,42405,42417,42421,42423-42425,42430,42432-42433,42437,42441,42443-42444,42446-42447,42449,42451,42453,42457,42459,42462,42491,42521,42529,42531,42533,42536,42538,42541,42543,42545,42549,42566,42568,42570,42572,42574,42576,42579,42581-42582,42584-42585,42587-42588,42590,42592,42594-42595,42598-42599,42602,42604,42606,42611-42613,42615,42617,42624-42625,42639,42642,42648,42652-42653,42665,42676,42687,42695,42697,42701-42702,42711,42713,42719,42722,42726,42728,42733,42739-42740,42744,42758,42772,42791-42792,42801,42807,42812,42814-42815,42817-42819,42823,42830,42837,42839,42841
 ,42844,42851-42852,42860,42862,42864,42878-42879,42881,42888-42889,42892-42894,42930,42964-42965,42967,42971-42972,42977-42978,42980-42982,42985-42987,42989,42992,42994-42995,42998-42999,43001-43004,43007-43008,43011-43012,43014-43015,43025,43027,43030,43032,43034,43036,43039,43042,43044-43049,43051-43063,43065,43081,43085,43087-43089,43091,43104,43116,43118,43120-43121,43123,43125-43126,43131-43132,43135,43137,43139,43145-43148,43150,43154-43155,43158,43160,43162,43166,43168,43170,43172,43175,43180-43181,43183-43185,43189,43191,43193,43195,43197,43199,43201,43203,43206,43208,43210-43212,43216,43218,43220,43222-43223,43226,43228,43230,43232,43234,43236,43238,43242-43243,43245-43246,43248-43251,43256,43259-43260,43263,43265,43267,43269,43274-43275,43278-43279,43282,43284,43286,43290,43293,43299,43303-43304,43313,43315,43317,43331,43337,43343,43350,43353,43356,43361-43363,43365,43367,43370-43371,43373-43376,43379,43388,43390,43435,43437,43439-43440,43446-43447,43451,43454,43457,43460,
 43462-43467,43469,43471,43475,43477-43478,43480,43486,43491,43493,43495,43499,43504,43506,43508,43511-43513,43518,43525,43527,43529,43531,43541,43550,43559,43561,43565,43567,43574,43578,43580,43584-43586,43589,43593,43597,43599,43601,43604-43605,43609,43636,43638,43645,43647,43653,43658-43659,43664,43673,44021,44048,44322,44338,44368-44371,44376-44382,44389,44391,44398-44399,44402-44403,44406,44408,44418,44432,44435,44437-44439,44441-44442,44833,44842,44993,45067,45936,45971,45990,45997,46474-46478,46483,46485,46893-46896,47341,47633-47638,47948-47951,47984,48241,48338,48341,49380,49382-49388
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:42132,42134,42136,42138,42140,42144,42146,42148,42150,42152-42153,42155,42157,42159,42161,42163,42169,42171,42173,42175,42177,42181,42183,42185,42187,42189,42191,42193,42199,42203,42210,42214,42220,42222,42226,42242,42244,42247,42250-42251,42256-42261,42350,42354,42358,42362,42364-42368,42374,42388,42390,42401,42405,42417,42421,42423-42425,42430,42432-42433,42437,42441,42443-42444,42446-42447,42449,42451,42453,42457,42459,42462,42491,42521,42529,42531,42533,42536,42538,42541,42543,42545,42549,42566,42568,42570,42572,42574,42576,42579,42581-42582,42584-42585,42587-42588,42590,42592,42594-42595,42598-42599,42602,42604,42606,42611-42613,42615,42617,42624-42625,42639,42642,42648,42652-42653,42665,42676,42687,42695,42697,42701-42702,42711,42713,42719,42722,42726,42728,42733,42739-42740,42744,42758,42772,42791-42792,42801,42807,42812,42814-42815,42817-42819,42823,42830,42837,42839,42841
 ,42844,42851-42852,42860,42862,42864,42878-42879,42881,42888-42889,42892-42894,42930,42964-42965,42967,42971-42972,42977-42978,42980-42982,42985-42987,42989,42992,42994-42995,42998-42999,43001-43004,43007-43008,43011-43012,43014-43015,43025,43027,43030,43032,43034,43036,43039,43042,43044-43049,43051-43063,43065,43081,43085,43087-43089,43091,43104,43116,43118,43120-43121,43123,43125-43126,43131-43132,43135,43137,43139,43145-43148,43150,43154-43155,43158,43160,43162,43166,43168,43170,43172,43175,43180-43181,43183-43185,43189,43191,43193,43195,43197,43199,43201,43203,43206,43208,43210-43212,43216,43218,43220,43222-43223,43226,43228,43230,43232,43234,43236,43238,43242-43243,43245-43246,43248-43251,43256,43259-43260,43263,43265,43267,43269,43274-43275,43278-43279,43282,43284,43286,43290,43293,43299,43303-43304,43313,43315,43317,43331,43337,43343,43350,43353,43356,43361-43363,43365,43367,43370-43371,43373-43376,43379,43388,43390,43435,43437,43439-43440,43446-43447,43451,43454,43457,43460,
 43462-43467,43469,43471,43475,43477-43478,43480,43486,43491,43493,43495,43499,43504,43506,43508,43511-43513,43518,43525,43527,43529,43531,43541,43550,43559,43561,43565,43567,43574,43578,43580,43584-43586,43589,43593,43597,43599,43601,43604-43605,43609,43636,43638,43645,43647,43653,43658-43659,43664,43673,44021,44048,44322,44338,44368-44371,44376-44382,44389,44391,44398-44399,44402-44403,44406,44408,44418,44432,44435,44437-44439,44441-44442,44833,44842,44993,45067,45745,45762,45783-45784,45800,45819,45885,45936,45971,45990,45997,46320,46474-46478,46483,46485,46893-46896,46999,47225,47341,47633-47638,47912,47948-47951,47984,48121,48241,48338,48341,49335,49358,49360,49362,49380,49382-49388
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches50env"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/.env</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/.env                         (rev 0)
+++ branches/5.0/.env   2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,59 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+##
+# Default configuration options for the local dev environment.
+#
+# All of these options can be overridden by setting them as environment variables before starting
+# the environment. You will need to restart your environment when changing any of these.
+#
+# 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.
+##
+
+# The site will be available at http://localhost:LOCAL_PORT
+LOCAL_PORT=8889
+
+# Where to run WordPress from. Valid options are 'src' and 'build'.
+LOCAL_DIR=src
+
+# The PHP version to use. Valid options are 'latest', and '{version}-fpm'.
+LOCAL_PHP=7.3-fpm
+
+##
+# 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=6-php-${LOCAL_PHP}
+
+# Whether or not to enable XDebug.
+LOCAL_PHP_XDEBUG=false
+
+# Whether or not to enable Memcached.
+LOCAL_PHP_MEMCACHED=false
+
+# The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions.
+LOCAL_MYSQL=5.7
+
+# The debug settings to add to `wp-config.php`.
+LOCAL_WP_DEBUG=true
+LOCAL_WP_DEBUG_LOG=true
+LOCAL_WP_DEBUG_DISPLAY=true
+LOCAL_SCRIPT_DEBUG=true
+LOCAL_WP_ENVIRONMENT_TYPE=local
+
+# The URL to use when running e2e tests.
+WP_BASE_URL=http://localhost:${LOCAL_PORT}
</ins></span></pre></div>
<a id="branches50travisyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/.travis.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/.travis.yml  2020-11-06 17:24:43 UTC (rev 49528)
+++ branches/5.0/.travis.yml    2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,28 +1,54 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-sudo: false
-dist: trusty
</del><span class="cx" style="display: block; padding: 0 10px"> language: php
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+services:
+  - docker
+
</ins><span class="cx" style="display: block; padding: 0 10px"> cache:
</span><span class="cx" style="display: block; padding: 0 10px">   apt: true
</span><span class="cx" style="display: block; padding: 0 10px">   directories:
</span><span class="cx" style="display: block; padding: 0 10px">     - $HOME/.npm
</span><span class="cx" style="display: block; padding: 0 10px">     - vendor
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    - $HOME/.composer/cache
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> env:
</span><span class="cx" style="display: block; padding: 0 10px">   global:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    - WP_TRAVISCI=travis:phpunit
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    - LOCAL_DIR: build
+    - NPM_INSTALL: true
+    - WP_INSTALL: true
+    - PHP_FPM_UID: "`id -u`"
+    - PHP_FPM_GID: "`id -g`"
+
</ins><span class="cx" style="display: block; padding: 0 10px"> matrix:
</span><span class="cx" style="display: block; padding: 0 10px">   include:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-  - php: 7.1
-    env: WP_TRAVISCI=travis:js
-  - php: 7.3
-  - php: 5.6
-    env: WP_TRAVIS_OBJECT_CACHE=true
-    services: memcached
-  - php: 5.2
-    dist: precise
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    - env: WP_TRAVISCI=travis:js LOCAL_PHP=7.1-fpm WP_INSTALL=false
+      name: "JS Tests"
+    - env: LOCAL_PHPUNIT=6-php-7.3-fpm WP_TRAVISCI=test:php
+      name: "PHPUnit Tests: PHP 7.3"
+    - env: LOCAL_PHP_MEMCACHED=true LOCAL_PHP=5.6-fpm LOCAL_PHPUNIT=4-php-5.6-fpm WP_TRAVISCI=test:php
+      name: "PHPUnit Tests: PHP 5.6 with Memcached"
+    - env: WP_TRAVISCI=travis:phpunit WP_INSTALL=false
+      php: 5.2
+      dist: precise
+  fast_finish: true
+
</ins><span class="cx" style="display: block; padding: 0 10px"> before_install:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-- |
-  if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  - |
+    if [[ "$WP_TRAVISCI" == "test:php" ]]; then
+      travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
+    fi
+  - |
+    if [[ "$WP_TRAVISCI" != "travis:phpunit" ]]; then
+      curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+      sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
+      sudo apt-get update
+      sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
+    fi
+  - |
+    sudo rm /usr/local/bin/docker-compose
+    curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
+    chmod +x docker-compose
+    sudo mv docker-compose /usr/local/bin
+  - |
+    if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
</ins><span class="cx" style="display: block; padding: 0 10px">       mysql -u root -e "CREATE DATABASE wordpress_tests;"
</span><span class="cx" style="display: block; padding: 0 10px">       cp wp-tests-config-sample.php wp-tests-config.php
</span><span class="cx" style="display: block; padding: 0 10px">       sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -29,68 +55,76 @@
</span><span class="cx" style="display: block; padding: 0 10px">       sed -i "s/yourusernamehere/root/" wp-tests-config.php
</span><span class="cx" style="display: block; padding: 0 10px">       sed -i "s/yourpasswordhere//" wp-tests-config.php
</span><span class="cx" style="display: block; padding: 0 10px">       travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-  fi
-- |
-  if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
-    cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
-    echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
-  fi
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    fi
+
</ins><span class="cx" style="display: block; padding: 0 10px"> before_script:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-- |
-  # Remove Xdebug for a huge performance increase:
-  if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
-    phpenv config-rm xdebug.ini
-  else
-    echo "xdebug.ini does not exist"
-  fi
-- |
-  # Export Composer's global bin dir to PATH, but not on PHP 5.2:
-  if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]]; then
-    composer config --list --global
-    export PATH=`composer config --list --global | grep '\[home\]' | { read a; echo "${a#* }/vendor/bin:$PATH"; }`
-  fi
-- |
-  # Install the specified version of PHPUnit depending on the PHP version:
-  if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
-    case "$TRAVIS_PHP_VERSION" in
-      7.3|7.2|7.1|7.0|nightly)
-        echo "Using PHPUnit 6.x"
-        travis_retry composer global require "phpunit/phpunit:^6"
-        ;;
-      5.6|5.5|5.4|5.3)
-        echo "Using PHPUnit 4.x"
-        travis_retry composer global require "phpunit/phpunit:^4"
-        ;;
-      5.2)
-        # Do nothing, use default PHPUnit 3.6.x
-        echo "Using default PHPUnit, hopefully 3.6"
-        ;;
-      *)
-        echo "No PHPUnit version handling for PHP version $TRAVIS_PHP_VERSION"
-        exit 1
-        ;;
-    esac
-  fi
-- npm --version
-- node --version
-- nvm install
-- npm install -g grunt-cli
-- npm install
-- npm prune
-- mysql --version
-- phpenv versions
-- php --version
-- php -m
-- npm --version
-- node --version
-- which phpunit
-- phpunit --version
-- curl --version
-- grunt --version
-- git --version
-- svn --version
-- locale -a
-script: grunt $WP_TRAVISCI
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  - npm --version
+  - node --version
+  - nvm install
+  - |
+    if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
+      phpenv config-rm xdebug.ini
+      npm install -g grunt-cli
+      mysql --version
+      phpenv versions
+      php --version
+      php -m
+    fi
+  - |
+    if [[ "$NPM_INSTALL" == "true" ]]; then
+      npm install
+    fi
+  - |
+    if [[ "$WP_TRAVISCI" == "test:php" ]]; then
+      npm run env:start
+      npm run build
+      docker-compose run --rm mysql mysql --version
+      docker-compose run --rm php php --version
+      docker-compose run --rm php php -m
+      docker-compose run --rm phpunit phpunit --version
+    fi
+  - |
+    if [[ "$LOCAL_PHP_MEMCACHED" == "true" ]]; then
+      cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
+      # The memcached server needs to start after `npm run env:start`, which sets up the Docker network.
+      docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
+    fi
+  - |
+    if [[ "$WP_INSTALL" == "true" ]]; then
+      # Run the install process after memcached has started.
+      npm run env:install
+    fi
+  - npm --version
+  - node --version
+  - curl --version
+  - git --version
+  - svn --version
+  - php --version
+  - php -i
+  - locale -a
+
+script:
+  - |
+    if [[ "$WP_TRAVISCI" == "test:php" ]]; then
+      npm run test:php -- --verbose -c phpunit.xml.dist &&
+      npm run test:php -- --verbose -c phpunit.xml.dist --group ajax &&
+      npm run test:php -- --verbose -c tests/phpunit/multisite.xml &&
+      npm run test:php -- --verbose -c tests/phpunit/multisite.xml --group ms-files &&
+      npm run test:php -- --verbose -c phpunit.xml.dist --group external-http &&
+      npm run test:php -- --verbose -c phpunit.xml.dist --group restapi-jsclient &&
+      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
+      LOCAL_PHP_XDEBUG=true npm run test:php -- -v --group xdebug --exclude-group __fakegroup__
+    else
+      npm run grunt $WP_TRAVISCI
+    fi
+
+after_script:
+  - |
+    if [[ "$WP_TEST_REPORTER" == "true" ]]; then
+      git clone https://github.com/WordPress/phpunit-test-runner.git test-runner
+      docker-compose run --rm -e WPT_PREPARE_DIR=/var/www -e WPT_TEST_DIR=/var/www php php test-runner/report.php
+    fi
+
</ins><span class="cx" style="display: block; padding: 0 10px"> notifications:
</span><span class="cx" style="display: block; padding: 0 10px">   slack:
</span><span class="cx" style="display: block; padding: 0 10px">     rooms:
</span></span></pre></div>
<a id="branches50dockercomposeyml"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/docker-compose.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/docker-compose.yml                           (rev 0)
+++ branches/5.0/docker-compose.yml     2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,136 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+version: '3.7'
+
+services:
+
+  ##
+  # The web server container.
+  ##
+  wordpress-develop:
+    image: nginx:alpine
+
+    networks:
+      - wpdevnet
+
+    ports:
+      - ${LOCAL_PORT-8889}:80
+
+    environment:
+      LOCAL_DIR: ${LOCAL_DIR-src}
+
+    volumes:
+      - ./tools/local-env/default.template:/etc/nginx/conf.d/default.template
+      - ./:/var/www
+
+    # Load our config file, substituting environment variables into the config.
+    command: /bin/sh -c "envsubst '$$LOCAL_DIR' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
+
+    depends_on:
+      - php
+
+  ##
+  # The PHP container.
+  ##
+  php:
+    image: wordpressdevelop/php:${LOCAL_PHP-7.3-fpm}
+
+    networks:
+      - wpdevnet
+
+    environment:
+      LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
+      LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
+      PHP_FPM_UID: ${PHP_FPM_UID-1000}
+      PHP_FPM_GID: ${PHP_FPM_GID-1000}
+
+    volumes:
+      - ./tools/local-env/php-config.ini:/usr/local/etc/php/conf.d/php-config.ini
+      - ./:/var/www
+
+    depends_on:
+      - mysql
+
+  ##
+  # The MySQL container.
+  ##
+  mysql:
+    image: mysql:${LOCAL_MYSQL-5.7}
+
+    networks:
+      - wpdevnet
+
+    ports:
+      - "3306"
+
+    environment:
+      MYSQL_ROOT_PASSWORD: password
+
+    volumes:
+      - ./tools/local-env/mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql
+      - mysql:/var/lib/mysql
+
+    # For compatibility with PHP versions that don't support the caching_sha2_password auth plugin used in MySQL 8.0.
+    command: --default-authentication-plugin=mysql_native_password
+
+  ##
+  # The WP CLI container.
+  ##
+  cli:
+    image: wordpressdevelop/cli:${LOCAL_PHP-7.3-fpm}
+
+    networks:
+      - wpdevnet
+
+    environment:
+      LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
+      LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
+      PHP_FPM_UID: ${PHP_FPM_UID-1000}
+      PHP_FPM_GID: ${PHP_FPM_GID-1000}
+
+    volumes:
+      - ./:/var/www
+
+    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
+    init: true
+
+  ##
+  # The PHPUnit container.
+  ##
+  phpunit:
+    image: wordpressdevelop/phpunit:${LOCAL_PHPUNIT-6-php-7.3-fpm}
+
+    networks:
+      - wpdevnet
+
+    environment:
+      LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
+      LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
+      LOCAL_DIR: ${LOCAL_DIR-src}
+      WP_MULTISITE: ${WP_MULTISITE-false}
+      PHP_FPM_UID: ${PHP_FPM_UID-1000}
+      PHP_FPM_GID: ${PHP_FPM_GID-1000}
+      TRAVIS_BRANCH: ${TRAVIS_BRANCH-false}
+      TRAVIS_PULL_REQUEST: ${TRAVIS_PULL_REQUEST-false}
+      GITHUB_REF: ${GITHUB_REF-false}
+      GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME-false}
+
+    volumes:
+      - ./tools/local-env/phpunit-config.ini:/usr/local/etc/php/conf.d/phpunit-config.ini
+      - ./:/var/www
+      - phpunit-uploads:/var/www/${LOCAL_DIR-src}/wp-content/uploads
+
+    # The init directive ensures the command runs with a PID > 1, so Ctrl+C works correctly.
+    init: true
+
+    depends_on:
+      - mysql
+
+volumes:
+  # So that sites aren't wiped every time containers are restarted, MySQL uses a persistent volume.
+  mysql: {}
+  # Using a volume for the uploads directory improves PHPUnit performance.
+  phpunit-uploads: {}
+
+networks:
+  # Creating our own network allows us to connect between containers using their service name.
+  wpdevnet:
+    driver: bridge
</ins></span></pre></div>
<a id="branches50packagelockjson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/package-lock.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/package-lock.json    2020-11-06 17:24:43 UTC (rev 49528)
+++ branches/5.0/package-lock.json      2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,6 +28,45 @@
</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">                },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                "@hapi/address": {
+                       "version": "2.1.4",
+                       "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz",
+                       "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==",
+                       "dev": true
+               },
+               "@hapi/bourne": {
+                       "version": "1.3.2",
+                       "resolved": "https://registry.npmjs.org/@hapi/bourne/-/bourne-1.3.2.tgz",
+                       "integrity": "sha512-1dVNHT76Uu5N3eJNTYcvxee+jzX4Z9lfciqRRHCU27ihbUcYi+iSc2iml5Ke1LXe1SyJCLA0+14Jh4tXJgOppA==",
+                       "dev": true
+               },
+               "@hapi/hoek": {
+                       "version": "8.5.1",
+                       "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-8.5.1.tgz",
+                       "integrity": "sha512-yN7kbciD87WzLGc5539Tn0sApjyiGHAJgKvG9W8C7O+6c7qmoQMfVs0W4bX17eqz6C78QJqqFrtgdK5EWf6Qow==",
+                       "dev": true
+               },
+               "@hapi/joi": {
+                       "version": "15.1.1",
+                       "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-15.1.1.tgz",
+                       "integrity": "sha512-entf8ZMOK8sc+8YfeOlM8pCfg3b5+WZIKBfUaaJT8UsjAAPjartzxIYm3TIbjvA4u+u++KbcXD38k682nVHDAQ==",
+                       "dev": true,
+                       "requires": {
+                               "@hapi/address": "2.x.x",
+                               "@hapi/bourne": "1.x.x",
+                               "@hapi/hoek": "8.x.x",
+                               "@hapi/topo": "3.x.x"
+                       }
+               },
+               "@hapi/topo": {
+                       "version": "3.1.6",
+                       "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-3.1.6.tgz",
+                       "integrity": "sha512-tAag0jEcjwH+P2quUfipd7liWCNX2F8NvYjQp2wtInsZxnMlypdw0FtAOLxtvvkO+GSRRbmNi8m/5y42PQJYCQ==",
+                       "dev": true,
+                       "requires": {
+                               "@hapi/hoek": "^8.3.0"
+                       }
+               },
</ins><span class="cx" style="display: block; padding: 0 10px">                 "@tannin/compile": {
</span><span class="cx" style="display: block; padding: 0 10px">                        "version": "1.0.1",
</span><span class="cx" style="display: block; padding: 0 10px">                        "resolved": "https://registry.npmjs.org/@tannin/compile/-/compile-1.0.1.tgz",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4312,6 +4351,18 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                "is-obj": "^1.0.0"
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                "dotenv": {
+                       "version": "8.2.0",
+                       "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
+                       "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==",
+                       "dev": true
+               },
+               "dotenv-expand": {
+                       "version": "5.1.0",
+                       "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz",
+                       "integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==",
+                       "dev": true
+               },
</ins><span class="cx" style="display: block; padding: 0 10px">                 "download": {
</span><span class="cx" style="display: block; padding: 0 10px">                        "version": "4.4.3",
</span><span class="cx" style="display: block; padding: 0 10px">                        "resolved": "https://registry.npmjs.org/download/-/download-4.4.3.tgz",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -12434,6 +12485,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        "resolved": "https://registry.npmjs.org/rungen/-/rungen-0.3.2.tgz",
</span><span class="cx" style="display: block; padding: 0 10px">                        "integrity": "sha1-QAwJ6+kU57F+C27zJjQA/Cq8fLM="
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                "rx": {
+                       "version": "4.1.0",
+                       "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz",
+                       "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=",
+                       "dev": true
+               },
</ins><span class="cx" style="display: block; padding: 0 10px">                 "rxjs": {
</span><span class="cx" style="display: block; padding: 0 10px">                        "version": "5.5.12",
</span><span class="cx" style="display: block; padding: 0 10px">                        "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14549,6 +14606,33 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                "indexof": "0.0.1"
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                },
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                "wait-on": {
+                       "version": "3.3.0",
+                       "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-3.3.0.tgz",
+                       "integrity": "sha512-97dEuUapx4+Y12aknWZn7D25kkjMk16PbWoYzpSdA8bYpVfS6hpl2a2pOWZ3c+Tyt3/i4/pglyZctG3J4V1hWQ==",
+                       "dev": true,
+                       "requires": {
+                               "@hapi/joi": "^15.0.3",
+                               "core-js": "^2.6.5",
+                               "minimist": "^1.2.0",
+                               "request": "^2.88.0",
+                               "rx": "^4.1.0"
+                       },
+                       "dependencies": {
+                               "core-js": {
+                                       "version": "2.6.11",
+                                       "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
+                                       "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==",
+                                       "dev": true
+                               },
+                               "minimist": {
+                                       "version": "1.2.5",
+                                       "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+                                       "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+                                       "dev": true
+                               }
+                       }
+               },
</ins><span class="cx" style="display: block; padding: 0 10px">                 "walkdir": {
</span><span class="cx" style="display: block; padding: 0 10px">                        "version": "0.0.11",
</span><span class="cx" style="display: block; padding: 0 10px">                        "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.11.tgz",
</span></span></pre></div>
<a id="branches50packagejson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/package.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/package.json 2020-11-06 17:24:43 UTC (rev 49528)
+++ branches/5.0/package.json   2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +18,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                "autoprefixer": "^9.1.5",
</span><span class="cx" style="display: block; padding: 0 10px">                "copy-webpack-plugin": "^4.6.0",
</span><span class="cx" style="display: block; padding: 0 10px">                "cssnano": "^4.1.4",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                "dotenv": "^8.2.0",
+               "dotenv-expand": "^5.1.0",
</ins><span class="cx" style="display: block; padding: 0 10px">                 "grunt": "~1.0.3",
</span><span class="cx" style="display: block; padding: 0 10px">                "grunt-banner": "^0.6.0",
</span><span class="cx" style="display: block; padding: 0 10px">                "grunt-contrib-clean": "~2.0.0",
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,6 +46,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                "matchdep": "~2.0.0",
</span><span class="cx" style="display: block; padding: 0 10px">                "source-map-loader": "^0.2.4",
</span><span class="cx" style="display: block; padding: 0 10px">                "uglify-js": "^3.4.9",
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                "wait-on": "^3.3.0",
</ins><span class="cx" style="display: block; padding: 0 10px">                 "webpack": "^4.24.0",
</span><span class="cx" style="display: block; padding: 0 10px">                "webpack-dev-server": "^3.1.9",
</span><span class="cx" style="display: block; padding: 0 10px">                "webpack-livereload-plugin": "^2.1.1"
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,6 +100,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">                "whatwg-fetch": "^3.0.0"
</span><span class="cx" style="display: block; padding: 0 10px">        },
</span><span class="cx" style="display: block; padding: 0 10px">        "scripts": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                "grunt": "grunt"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         "build": "grunt build",
+               "build:dev": "grunt build --dev",
+               "dev": "grunt watch --dev",
+               "test": "grunt test",
+               "watch": "grunt watch",
+               "grunt": "grunt",
+               "env:start": "node ./tools/local-env/scripts/start.js",
+               "env:stop": "node ./tools/local-env/scripts/docker.js down",
+               "env:restart": "npm run env:stop && npm run env:start",
+               "env:clean": "node ./tools/local-env/scripts/docker.js down -v --remove-orphans",
+               "env:reset": "node ./tools/local-env/scripts/docker.js down --rmi all -v --remove-orphans",
+               "env:install": "node ./tools/local-env/scripts/install.js",
+               "env:cli": "node ./tools/local-env/scripts/docker.js run cli",
+               "env:logs": "node ./tools/local-env/scripts/docker.js logs",
+               "env:pull": "node ./tools/local-env/scripts/docker.js pull",
+               "test:php": "node ./tools/local-env/scripts/docker.js run --rm phpunit phpunit"
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches50testsphpunittestsajaxCustomizeMenusphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/tests/phpunit/tests/ajax/CustomizeMenus.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tests/phpunit/tests/ajax/CustomizeMenus.php  2020-11-06 17:24:43 UTC (rev 49528)
+++ branches/5.0/tests/phpunit/tests/ajax/CustomizeMenus.php    2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,7 +54,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( 'administrator' != $role ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        // If we're not an admin, we should get a wp_die(-1).
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->setExpectedException( 'WPAjaxDieStopException' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
</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">                wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -429,7 +429,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( 'administrator' != $role ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        // If we're not an admin, we should get a wp_die(-1).
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $this->setExpectedException( 'WPAjaxDieStopException' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
</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">                wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
</span></span></pre></div>
<a id="branches50toolslocalenvdefaulttemplate"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/tools/local-env/default.template</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tools/local-env/default.template                             (rev 0)
+++ branches/5.0/tools/local-env/default.template       2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,32 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+server {
+       index index.php index.html;
+
+       listen 80 default_server;
+       listen [::]:80 default_server;
+
+       server_name localhost;
+
+       client_max_body_size 1g;
+
+       error_log  /var/log/nginx/error.log;
+       access_log /var/log/nginx/access.log;
+
+       root /var/www/${LOCAL_DIR};
+
+       absolute_redirect off;
+
+       location / {
+               try_files $uri $uri/ /index.php?$args;
+       }
+
+       location ~ \.php$ {
+               try_files $uri =404;
+               fastcgi_split_path_info ^(.+\.php)(/.+)$;
+               fastcgi_pass php:9000;
+               fastcgi_index index.php;
+               include fastcgi_params;
+               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+               fastcgi_param PATH_INFO $fastcgi_path_info;
+               fastcgi_pass_header Authorization;
+       }
+}
</ins></span></pre></div>
<a id="branches50toolslocalenvmysqlinitsql"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/tools/local-env/mysql-init.sql</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tools/local-env/mysql-init.sql                               (rev 0)
+++ branches/5.0/tools/local-env/mysql-init.sql 2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,8 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * MySQL server init.
+ *
+ * SQL queries in this file will be executed the first time the MySQL server is started.
+ */
+
+CREATE DATABASE IF NOT EXISTS wordpress_develop;
+CREATE DATABASE IF NOT EXISTS wordpress_develop_tests;
</ins></span></pre></div>
<a id="branches50toolslocalenvphpconfigini"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/tools/local-env/php-config.ini</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tools/local-env/php-config.ini                               (rev 0)
+++ branches/5.0/tools/local-env/php-config.ini 2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,2 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+upload_max_filesize = 1G
+post_max_size = 1G
</ins></span></pre></div>
<a id="branches50toolslocalenvphpunitconfigini"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/tools/local-env/phpunit-config.ini</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tools/local-env/phpunit-config.ini                           (rev 0)
+++ branches/5.0/tools/local-env/phpunit-config.ini     2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,6 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+upload_max_filesize = 1G
+post_max_size = 1G
+
+opcache.enable = 1
+opcache.enable_cli = 1
+opache.file_cache = /tmp/php-opcache
</ins></span></pre></div>
<a id="branches50toolslocalenvscriptsdockerjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/tools/local-env/scripts/docker.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tools/local-env/scripts/docker.js                            (rev 0)
+++ branches/5.0/tools/local-env/scripts/docker.js      2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,8 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const dotenv       = require( 'dotenv' );
+const dotenvExpand = require( 'dotenv-expand' );
+const { execSync } = require( 'child_process' );
+
+dotenvExpand( dotenv.config() );
+
+// Execute any docker-compose command passed to this script.
+execSync( 'docker-compose ' + process.argv.slice( 2 ).join( ' ' ), { stdio: 'inherit' } );
</ins></span></pre></div>
<a id="branches50toolslocalenvscriptsinstalljs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/tools/local-env/scripts/install.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tools/local-env/scripts/install.js                           (rev 0)
+++ branches/5.0/tools/local-env/scripts/install.js     2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,47 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const dotenv       = require( 'dotenv' );
+const dotenvExpand = require( 'dotenv-expand' );
+const wait_on = require( 'wait-on' );
+const { execSync } = require( 'child_process' );
+const { renameSync, readFileSync, writeFileSync } = require( 'fs' );
+
+dotenvExpand( dotenv.config() );
+
+// Create wp-config.php.
+wp_cli( 'config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force' );
+
+// Add the debug settings to wp-config.php.
+// Windows requires this to be done as an additional step, rather than using the --extra-php option in the previous step.
+wp_cli( `config set WP_DEBUG ${process.env.LOCAL_WP_DEBUG} --raw --type=constant` );
+wp_cli( `config set WP_DEBUG_LOG ${process.env.LOCAL_WP_DEBUG_LOG} --raw --type=constant` );
+wp_cli( `config set WP_DEBUG_DISPLAY ${process.env.LOCAL_WP_DEBUG_DISPLAY} --raw --type=constant` );
+wp_cli( `config set SCRIPT_DEBUG ${process.env.LOCAL_SCRIPT_DEBUG} --raw --type=constant` );
+wp_cli( `config set WP_ENVIRONMENT_TYPE ${process.env.LOCAL_WP_ENVIRONMENT_TYPE} --type=constant` );
+
+// Move wp-config.php to the base directory, so it doesn't get mixed up in the src or build directories.
+renameSync( 'src/wp-config.php', 'wp-config.php' );
+
+// Read in wp-tests-config-sample.php, edit it to work with our config, then write it to wp-tests-config.php.
+const testConfig = readFileSync( 'wp-tests-config-sample.php', 'utf8' )
+       .replace( 'youremptytestdbnamehere', 'wordpress_develop_tests' )
+       .replace( 'yourusernamehere', 'root' )
+       .replace( 'yourpasswordhere', 'password' )
+       .replace( 'localhost', 'mysql' )
+       .concat( "\ndefine( 'FS_METHOD', 'direct' );\n" );
+
+writeFileSync( 'wp-tests-config.php', testConfig );
+
+// Once the site is available, install WordPress!
+wait_on( { resources: [ `tcp:localhost:${process.env.LOCAL_PORT}`] } )
+       .then( () => {
+               wp_cli( 'db reset --yes' );
+               wp_cli( `core install --title="WordPress Develop" --admin_user=admin --admin_password=password --admin_email=test@test.com --skip-email --url=http://localhost:${process.env.LOCAL_PORT}` );
+       } );
+
+/**
+ * Runs WP-CLI commands in the Docker environment.
+ *
+ * @param {string} cmd The WP-CLI command to run.
+ */
+function wp_cli( cmd ) {
+       execSync( `docker-compose run --rm cli ${cmd}`, { stdio: 'inherit' } );
+}
</ins></span></pre></div>
<a id="branches50toolslocalenvscriptsstartjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: branches/5.0/tools/local-env/scripts/start.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tools/local-env/scripts/start.js                             (rev 0)
+++ branches/5.0/tools/local-env/scripts/start.js       2020-11-06 17:29:16 UTC (rev 49529)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,36 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const dotenv       = require( 'dotenv' );
+const dotenvExpand = require( 'dotenv-expand' );
+const { execSync } = require( 'child_process' );
+
+dotenvExpand( dotenv.config() );
+
+// Start the local-env containers.
+execSync( 'docker-compose up -d wordpress-develop', { stdio: 'inherit' } );
+
+// If Docker Toolbox is being used, we need to manually forward LOCAL_PORT to the Docker VM.
+if ( process.env.DOCKER_TOOLBOX_INSTALL_PATH ) {
+       // VBoxManage is added to the PATH on every platform except Windows.
+       const vboxmanage = process.env.VBOX_MSI_INSTALL_PATH ? `${ process.env.VBOX_MSI_INSTALL_PATH }/VBoxManage` : 'VBoxManage'
+
+       // Check if the port forwarding is already configured for this port.
+       const vminfoBuffer = execSync( `"${ vboxmanage }" showvminfo "${ process.env.DOCKER_MACHINE_NAME }" --machinereadable` );
+       const vminfo = vminfoBuffer.toString().split( /[\r\n]+/ );
+
+       vminfo.forEach( ( info ) => {
+               if ( ! info.startsWith( 'Forwarding' ) ) {
+                       return;
+               }
+
+               // `info` is in the format: Forwarding(1)="tcp-port8889,tcp,127.0.0.1,8889,,8889"
+               // Parse it down so `rule` only contains the data inside quotes, split by ','.
+               const rule = info.replace( /(^.*?"|"$)/, '' ).split( ',' );
+
+               // Delete rules that are using the port we need.
+               if ( rule[ 3 ] === process.env.LOCAL_PORT || rule[ 5 ] === process.env.LOCAL_PORT ) {
+                       execSync( `"${ vboxmanage }" controlvm "${ process.env.DOCKER_MACHINE_NAME }" natpf1 delete ${ rule[ 0 ] }`, { stdio: 'inherit' } );
+               }
+       } );
+
+       // Add our port forwarding rule.
+       execSync( `"${ vboxmanage }" controlvm "${ process.env.DOCKER_MACHINE_NAME }" natpf1 "tcp-port${ process.env.LOCAL_PORT },tcp,127.0.0.1,${ process.env.LOCAL_PORT },,${ process.env.LOCAL_PORT }"`, { stdio: 'inherit' } );
+}
</ins></span></pre>
</div>
</div>

</body>
</html>