<!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>[51839] branches/5.7: Build/Test Tools: Introduce the PHPUnit Polyfills package for easier cross branch testing.</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/51839">51839</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/51839","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>2021-09-21 19:28:47 +0000 (Tue, 21 Sep 2021)</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: Introduce the PHPUnit Polyfills package for easier cross branch testing.
This backports the PHPUnit Polyfills package and related test infrastructure changes to make it easier for developers to continue testing on multiple versions WordPress while adding tests for newer versions of PHP, which require more modern PHPUnit practices.
One of the changes included is the addition of wrappers for the new snake_case fixture methods in PHPUnit. This allows the native camelCase standard in PHPUnit to be used, but allows for developers to transition to the new naming conventions.
Props hellofromTonya, jrf, SergeyBiryukov, johnbillion, netweb, schlessera, jeherve, lucatume, desrosj.
Merges [51559,51560,51810-51813,51828] to the 5.7 branch.
See <a href="https://core.trac.wordpress.org/ticket/53911">#53911</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches57githubworkflowsphpunittestsyml">branches/5.7/.github/workflows/phpunit-tests.yml</a></li>
<li><a href="#branches57githubworkflowstestcoverageyml">branches/5.7/.github/workflows/test-coverage.yml</a></li>
<li><a href="#branches57composerjson">branches/5.7/composer.json</a></li>
<li><a href="#branches57composerlock">branches/5.7/composer.lock</a></li>
<li><a href="#branches57testsphpunitincludesbootstrapphp">branches/5.7/tests/phpunit/includes/bootstrap.php</a></li>
<li><a href="#branches57testsphpunitincludesphpunit7testcasephp">branches/5.7/tests/phpunit/includes/phpunit7/testcase.php</a></li>
<li><a href="#branches57testsphpunitincludestestcasephp">branches/5.7/tests/phpunit/includes/testcase.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#branches57">branches/5.7/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/5.7
</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.7 2021-09-21 19:04:34 UTC (rev 51838)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/5.7 2021-09-21 19:28:47 UTC (rev 51839)
</ins><a id="branches57"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/5.7</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.9:43557,43622
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43747,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43785,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43863,43867-43889,43891-43894,43897-43905,43908-43909,43911-43929,43931-43942,43946-43947,43949-43956,43959-43964,43967-43969,43988,43994,44014,44017,44047,44183,44185,44187-44206,44208-44213,44231-44232,44235,44248,44284,44287-44288
</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:50428-50430,50432,50435-50436,50439,50441-50445,50460-50461,50465-50466,50471,50475,50478-50479,50483,50485-50487,50493,50495,50499,50501,50507,50510,50518,50523,50525,50534-50535,50545,50551-50552,50566-50569,50571,50575,50577,50579,50585-50586,50590-50598,50628,50634,50653-50654,50659,50663,50667,50669-50670,50682-50683,50687,50708,50710,50714,50717,50799,50938,50940-50941,50954,51002,51035,51169,51426,51740
</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:50428-50430,50432,50435-50436,50439,50441-50445,50460-50461,50465-50466,50471,50475,50478-50479,50483,50485-50487,50493,50495,50499,50501,50507,50510,50518,50523,50525,50534-50535,50545,50551-50552,50566-50569,50571,50575,50577,50579,50585-50586,50590-50598,50628,50634,50653-50654,50659,50663,50667,50669-50670,50682-50683,50687,50708,50710,50714,50717,50799,50938,50940-50941,50954,51002,51035,51169,51426,51559-51560,51740,51810-51813,51828
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches57githubworkflowsphpunittestsyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.7/.github/workflows/phpunit-tests.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.7/.github/workflows/phpunit-tests.yml 2021-09-21 19:04:34 UTC (rev 51838)
+++ branches/5.7/.github/workflows/phpunit-tests.yml 2021-09-21 19:28:47 UTC (rev 51839)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -21,7 +21,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> env:
</span><span class="cx" style="display: block; padding: 0 10px"> PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- COMPOSER_INSTALL: ${{ false }}
</del><span class="cx" style="display: block; padding: 0 10px"> # Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
</span><span class="cx" style="display: block; padding: 0 10px"> PHPUNIT_SCRIPT: php
</span><span class="cx" style="display: block; padding: 0 10px"> LOCAL_PHP_MEMCACHED: ${{ false }}
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -137,11 +136,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> - name: Get composer cache directory
</span><span class="cx" style="display: block; padding: 0 10px"> id: composer-cache
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }}
</del><span class="cx" style="display: block; padding: 0 10px"> run: echo "::set-output name=dir::$(composer config cache-files-dir)"
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> - name: Cache Composer dependencies
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }}
</del><span class="cx" style="display: block; padding: 0 10px"> uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
</span><span class="cx" style="display: block; padding: 0 10px"> env:
</span><span class="cx" style="display: block; padding: 0 10px"> cache-name: cache-composer-dependencies
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -150,7 +147,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> - name: Install Composer dependencies
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if: ${{ env.COMPOSER_INSTALL == true || env.LOCAL_PHP == '8.0-fpm' }}
</del><span class="cx" style="display: block; padding: 0 10px"> run: |
</span><span class="cx" style="display: block; padding: 0 10px"> docker-compose run --rm php composer --version
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -160,6 +156,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if [ ${{ env.LOCAL_PHP }} == '8.0-fpm' ]; then
</span><span class="cx" style="display: block; padding: 0 10px"> docker-compose run --rm php composer install --ignore-platform-reqs
</span><span class="cx" style="display: block; padding: 0 10px"> echo "PHPUNIT_SCRIPT=php-composer" >> $GITHUB_ENV
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ elif [ ${{ env.LOCAL_PHP }} == '7.1-fpm' ]; then
+ docker-compose run --rm php composer update
+ git checkout -- composer.lock
+ elif [[ ${{ env.LOCAL_PHP }} == '5.6.20-fpm' || ${{ env.LOCAL_PHP }} == '7.0-fpm' ]]; then
+ docker-compose run --rm php composer require --dev phpunit/phpunit:"^5.7" --update-with-dependencies
+ git checkout -- composer.lock composer.json
</ins><span class="cx" style="display: block; padding: 0 10px"> else
</span><span class="cx" style="display: block; padding: 0 10px"> docker-compose run --rm php composer install
</span><span class="cx" style="display: block; padding: 0 10px"> fi
</span></span></pre></div>
<a id="branches57githubworkflowstestcoverageyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.7/.github/workflows/test-coverage.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.7/.github/workflows/test-coverage.yml 2021-09-21 19:04:34 UTC (rev 51838)
+++ branches/5.7/.github/workflows/test-coverage.yml 2021-09-21 19:28:47 UTC (rev 51839)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,7 +18,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> env:
</span><span class="cx" style="display: block; padding: 0 10px"> PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- COMPOSER_INSTALL: ${{ false }}
</del><span class="cx" style="display: block; padding: 0 10px"> # Controls which NPM script to use for running PHPUnit tests. Options ar `php` and `php-composer`.
</span><span class="cx" style="display: block; padding: 0 10px"> PHPUNIT_SCRIPT: php
</span><span class="cx" style="display: block; padding: 0 10px"> LOCAL_PHP: '7.4-fpm'
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -95,6 +94,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> - name: Install Dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> run: npm ci
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
+ - name: Cache Composer dependencies
+ uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
+ env:
+ cache-name: cache-composer-dependencies
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
+
+ - name: Install Composer dependencies
+ run: |
+ docker-compose run --rm php composer --version
+ docker-compose run --rm php composer install
+
</ins><span class="cx" style="display: block; padding: 0 10px"> - name: Docker debug information
</span><span class="cx" style="display: block; padding: 0 10px"> run: |
</span><span class="cx" style="display: block; padding: 0 10px"> docker -v
</span></span></pre></div>
<a id="branches57composerjson"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.7/composer.json</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.7/composer.json 2021-09-21 19:04:34 UTC (rev 51838)
+++ branches/5.7/composer.json 2021-09-21 19:28:47 UTC (rev 51839)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,7 +16,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0",
</span><span class="cx" style="display: block; padding: 0 10px"> "wp-coding-standards/wpcs": "~2.3.0",
</span><span class="cx" style="display: block; padding: 0 10px"> "phpcompatibility/phpcompatibility-wp": "^2.1.0",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "phpunit/phpunit": "^7.5"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "phpunit/phpunit": "^7.5",
+ "yoast/phpunit-polyfills": "^1.0.1"
</ins><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "autoload-dev": {
</span><span class="cx" style="display: block; padding: 0 10px"> "files": [
</span></span></pre></div>
<a id="branches57composerlock"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.7/composer.lock</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.7/composer.lock 2021-09-21 19:04:34 UTC (rev 51838)
+++ branches/5.7/composer.lock 2021-09-21 19:28:47 UTC (rev 51839)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,7 +4,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
</span><span class="cx" style="display: block; padding: 0 10px"> "This file is @generated automatically"
</span><span class="cx" style="display: block; padding: 0 10px"> ],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "content-hash": "463db2b4afb439fb63d93173c0852e27",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "content-hash": "d8bcbf1466f6595287a44721f525844d",
</ins><span class="cx" style="display: block; padding: 0 10px"> "packages": [],
</span><span class="cx" style="display: block; padding: 0 10px"> "packages-dev": [
</span><span class="cx" style="display: block; padding: 0 10px"> {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1827,6 +1827,69 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "wordpress"
</span><span class="cx" style="display: block; padding: 0 10px"> ],
</span><span class="cx" style="display: block; padding: 0 10px"> "time": "2020-05-13T23:57:56+00:00"
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ },
+ {
+ "name": "yoast/phpunit-polyfills",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Yoast/PHPUnit-Polyfills.git",
+ "reference": "f014fb21c2b0038fd329515d59025af42fb98715"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/f014fb21c2b0038fd329515d59025af42fb98715",
+ "reference": "f014fb21c2b0038fd329515d59025af42fb98715",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4",
+ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0"
+ },
+ "require-dev": {
+ "php-parallel-lint/php-console-highlighter": "^0.5",
+ "php-parallel-lint/php-parallel-lint": "^1.3.0",
+ "yoast/yoastcs": "^2.1.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "1.x-dev",
+ "dev-develop": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "phpunitpolyfills-autoload.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Team Yoast",
+ "email": "support@yoast.com",
+ "homepage": "https://yoast.com"
+ },
+ {
+ "name": "Contributors",
+ "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors"
+ }
+ ],
+ "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests",
+ "homepage": "https://github.com/Yoast/PHPUnit-Polyfills",
+ "keywords": [
+ "phpunit",
+ "polyfill",
+ "testing"
+ ],
+ "support": {
+ "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues",
+ "source": "https://github.com/Yoast/PHPUnit-Polyfills"
+ },
+ "time": "2021-08-09T16:28:08+00:00"
</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"> "aliases": [],
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1838,5 +1901,5 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "php": ">=5.6"
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px"> "platform-dev": [],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "plugin-api-version": "1.1.0"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "plugin-api-version": "2.1.0"
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches57testsphpunitincludesbootstrapphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.7/tests/phpunit/includes/bootstrap.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.7/tests/phpunit/includes/bootstrap.php 2021-09-21 19:04:34 UTC (rev 51838)
+++ branches/5.7/tests/phpunit/includes/bootstrap.php 2021-09-21 19:28:47 UTC (rev 51839)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -44,9 +44,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $phpunit_version = tests_get_phpunit_version();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( version_compare( $phpunit_version, '5.4', '<' ) || version_compare( $phpunit_version, '8.0', '>=' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+if ( version_compare( $phpunit_version, '5.7.21', '<' ) || version_compare( $phpunit_version, '8.0', '>=' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.4 and is currently only compatible with PHPUnit up to 7.x.\n",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.7.21 and is currently only compatible with PHPUnit up to 7.x.\n",
</ins><span class="cx" style="display: block; padding: 0 10px"> $phpunit_version
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> echo "Please use the latest PHPUnit version from the 7.x branch.\n";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,6 +53,113 @@
</span><span class="cx" style="display: block; padding: 0 10px"> exit( 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">+/*
+ * Load the PHPUnit Polyfills autoloader.
+ *
+ * The PHPUnit Polyfills are a requirement for the WP test suite.
+ *
+ * For running the Core tests, the Make WordPress Core handbook contains step-by-step instructions
+ * on how to get up and running for a variety of supported workflows:
+ * {@link https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/#test-running-workflow-options}
+ *
+ * Plugin/theme integration tests can handle this in any of the following ways:
+ * - When using a full WP install: run `composer install` for the WP install prior to running the tests.
+ * - When using a partial WP test suite install:
+ * - Add a `yoast/phpunit-polyfills` (dev) requirement to the plugin/theme's own `composer.json` file.
+ * - And then:
+ * - Either load the PHPUnit Polyfills autoload file prior to running the WP core bootstrap file.
+ * - Or declare a `WP_TESTS_PHPUNIT_POLYFILLS_PATH` constant containing the absolute path to the
+ * root directory of the PHPUnit Polyfills installation.
+ * If the constant is used, it is strongly recommended to declare this constant in the plugin/theme's
+ * own test bootstrap file.
+ * The constant MUST be declared prior to calling this file.
+ */
+if ( ! class_exists( 'Yoast\PHPUnitPolyfills\Autoload' ) ) {
+ // Default location of the autoloader for WP core test runs.
+ $phpunit_polyfills_autoloader = dirname( dirname( dirname( __DIR__ ) ) ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';
+ $phpunit_polyfills_error = false;
+
+ // Allow for a custom installation location to be provided for plugin/theme integration tests.
+ if ( defined( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH' ) ) {
+ $phpunit_polyfills_path = WP_TESTS_PHPUNIT_POLYFILLS_PATH;
+
+ if ( is_string( WP_TESTS_PHPUNIT_POLYFILLS_PATH )
+ && '' !== WP_TESTS_PHPUNIT_POLYFILLS_PATH
+ ) {
+ // Be tolerant to the path being provided including the filename.
+ if ( substr( $phpunit_polyfills_path, -29 ) !== 'phpunitpolyfills-autoload.php' ) {
+ $phpunit_polyfills_path = rtrim( $phpunit_polyfills_path, '/\\' );
+ $phpunit_polyfills_path = $phpunit_polyfills_path . '/phpunitpolyfills-autoload.php';
+ }
+
+ $phpunit_polyfills_autoloader = $phpunit_polyfills_path;
+ } else {
+ $phpunit_polyfills_error = true;
+ }
+ }
+
+ if ( $phpunit_polyfills_error || ! file_exists( $phpunit_polyfills_autoloader ) ) {
+ echo 'Error: The PHPUnit Polyfills library is a requirement for running the WP test suite.' . PHP_EOL;
+ if ( defined( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH' ) ) {
+ printf(
+ 'The PHPUnit Polyfills autoload file was not found in "%s"' . PHP_EOL,
+ WP_TESTS_PHPUNIT_POLYFILLS_PATH
+ );
+ echo 'Please verify that the file path provided in the WP_TESTS_PHPUNIT_POLYFILLS_PATH constant is correct.' . PHP_EOL;
+ echo 'The WP_TESTS_PHPUNIT_POLYFILLS_PATH constant should contain an absolute path to the root directory'
+ . ' of the PHPUnit Polyfills library.' . PHP_EOL;
+ } elseif ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
+ echo 'You need to run `composer install` before running the tests.' . PHP_EOL;
+ echo 'Once the dependencies are installed, you can run the tests using the Composer-installed version'
+ . ' of PHPUnit or using a PHPUnit phar file, but the dependencies do need to be installed'
+ . ' whichever way the tests are run.' . PHP_EOL;
+ } else {
+ echo 'If you are trying to run plugin/theme integration tests, make sure the PHPUnit Polyfills library'
+ . ' (https://github.com/Yoast/PHPUnit-Polyfills) is available and either load the autoload file'
+ . ' of this library in your own test bootstrap before calling the WP Core test bootstrap file;'
+ . ' or set the absolute path to the PHPUnit Polyfills library in a "WP_TESTS_PHPUNIT_POLYFILLS_PATH"'
+ . ' constant to allow the WP Core bootstrap to load the Polyfills.' . PHP_EOL . PHP_EOL;
+ echo 'If you are trying to run the WP Core tests, make sure to set the "WP_RUN_CORE_TESTS" constant'
+ . ' to 1 and run `composer install` before running the tests.' . PHP_EOL;
+ echo 'Once the dependencies are installed, you can run the tests using the Composer-installed'
+ . ' version of PHPUnit or using a PHPUnit phar file, but the dependencies do need to be'
+ . ' installed whichever way the tests are run.' . PHP_EOL;
+ }
+ exit( 1 );
+ }
+
+ require_once $phpunit_polyfills_autoloader;
+}
+unset( $phpunit_polyfills_autoloader, $phpunit_polyfills_error, $phpunit_polyfills_path );
+
+/*
+ * Minimum version of the PHPUnit Polyfills package as declared in `composer.json`.
+ * Only needs updating when new polyfill features start being used in the test suite.
+ */
+$phpunit_polyfills_minimum_version = '1.0.1';
+if ( class_exists( '\Yoast\PHPUnitPolyfills\Autoload' )
+ && ( defined( '\Yoast\PHPUnitPolyfills\Autoload::VERSION' ) === false
+ || version_compare( Yoast\PHPUnitPolyfills\Autoload::VERSION, $phpunit_polyfills_minimum_version, '<' ) )
+) {
+ printf(
+ 'Error: Version mismatch detected for the PHPUnit Polyfills.'
+ . ' Please ensure that PHPUnit Polyfills %s or higher is loaded. Found version: %s' . PHP_EOL,
+ $phpunit_polyfills_minimum_version,
+ defined( '\Yoast\PHPUnitPolyfills\Autoload::VERSION' ) ? Yoast\PHPUnitPolyfills\Autoload::VERSION : '1.0.0 or lower'
+ );
+ if ( defined( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH' ) ) {
+ printf(
+ 'Please ensure that the PHPUnit Polyfill installation in "%s" is updated to version %s or higher.' . PHP_EOL,
+ WP_TESTS_PHPUNIT_POLYFILLS_PATH,
+ $phpunit_polyfills_minimum_version
+ );
+ } elseif ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
+ echo 'Please run `composer install` to install the latest version.' . PHP_EOL;
+ }
+ exit( 1 );
+}
+unset( $phpunit_polyfills_minimum_version );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // If running core tests, check if all the required PHP extensions are loaded before running the test suite.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $required_extensions = array(
</span></span></pre></div>
<a id="branches57testsphpunitincludesphpunit7testcasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.7/tests/phpunit/includes/phpunit7/testcase.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.7/tests/phpunit/includes/phpunit7/testcase.php 2021-09-21 19:04:34 UTC (rev 51838)
+++ branches/5.7/tests/phpunit/includes/phpunit7/testcase.php 2021-09-21 19:28:47 UTC (rev 51839)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Yoast\PHPUnitPolyfills\Helpers\AssertAttributeHelper;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertClosedResource;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertEqualsSpecializations;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertFileDirectory;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertFileEqualsSpecializations;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertionRenames;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEquals;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertStringContains;
+use Yoast\PHPUnitPolyfills\Polyfills\EqualToSpecializations;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionMessageMatches;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionObject;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once dirname( __DIR__ ) . '/abstract-testcase.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,28 +29,47 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_UnitTestCase extends WP_UnitTestCase_Base {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ use AssertAttributeHelper;
+ use AssertClosedResource;
+ use AssertEqualsSpecializations;
+ use AssertFileDirectory;
+ use AssertFileEqualsSpecializations;
+ use AssertionRenames;
+ use AssertIsType;
+ use AssertNumericType;
+ use AssertObjectEquals;
+ use AssertStringContains;
+ use EqualToSpecializations;
+ use ExpectException;
+ use ExpectExceptionMessageMatches;
+ use ExpectExceptionObject;
+ use ExpectPHPException;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Asserts that two variables are equal (with delta).
- *
- * This method has been backported from a more recent PHPUnit version,
- * as tests running on PHP 5.6 use PHPUnit 5.7.x.
- *
- * @since 5.6.0
- *
- * @param mixed $expected First value to compare.
- * @param mixed $actual Second value to compare.
- * @param float $delta Allowed numerical distance between two values to consider them equal.
- * @param string $message Optional. Message to display when the assertion fails.
- *
- * @throws ExpectationFailedException
- * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Wrapper method for the `setUpBeforeClass()` method for forward-compatibility with WP 5.9.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function assertEqualsWithDelta( $expected, $actual, float $delta, string $message = '' ): void {
- $constraint = new PHPUnit\Framework\Constraint\IsEqual(
- $expected,
- $delta
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function set_up_before_class() {
+ static::setUpBeforeClass();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- static::assertThat( $actual, $constraint, $message );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Wrapper method for the `tearDownAfterClass()` method for forward-compatibility with WP 5.9.
+ */
+ public static function tear_down_after_class() {
+ static::tearDownAfterClass();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Wrapper method for the `setUp()` method for forward-compatibility with WP 5.9.
+ */
+ public function set_up() {
+ static::setUp();
+ }
+
+ /**
+ * Wrapper method for the `tearDown()` method for forward-compatibility with WP 5.9.
+ */
+ public function tear_down() {
+ static::tearDown();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches57testsphpunitincludestestcasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.7/tests/phpunit/includes/testcase.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.7/tests/phpunit/includes/testcase.php 2021-09-21 19:04:34 UTC (rev 51838)
+++ branches/5.7/tests/phpunit/includes/testcase.php 2021-09-21 19:28:47 UTC (rev 51839)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use Yoast\PHPUnitPolyfills\Helpers\AssertAttributeHelper;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertClosedResource;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertEqualsSpecializations;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertFileDirectory;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertFileEqualsSpecializations;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertionRenames;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertIsType;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertNumericType;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEquals;
+use Yoast\PHPUnitPolyfills\Polyfills\AssertStringContains;
+use Yoast\PHPUnitPolyfills\Polyfills\EqualToSpecializations;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectException;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionMessageMatches;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectExceptionObject;
+use Yoast\PHPUnitPolyfills\Polyfills\ExpectPHPException;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once __DIR__ . '/abstract-testcase.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,28 +29,47 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class WP_UnitTestCase extends WP_UnitTestCase_Base {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ use AssertAttributeHelper;
+ use AssertClosedResource;
+ use AssertEqualsSpecializations;
+ use AssertFileDirectory;
+ use AssertFileEqualsSpecializations;
+ use AssertionRenames;
+ use AssertIsType;
+ use AssertNumericType;
+ use AssertObjectEquals;
+ use AssertStringContains;
+ use EqualToSpecializations;
+ use ExpectException;
+ use ExpectExceptionMessageMatches;
+ use ExpectExceptionObject;
+ use ExpectPHPException;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Asserts that two variables are equal (with delta).
- *
- * This method has been backported from a more recent PHPUnit version,
- * as tests running on PHP 5.6 use PHPUnit 5.7.x.
- *
- * @since 5.6.0
- *
- * @param mixed $expected First value to compare.
- * @param mixed $actual Second value to compare.
- * @param float $delta Allowed numerical distance between two values to consider them equal.
- * @param string $message Optional. Message to display when the assertion fails.
- *
- * @throws ExpectationFailedException
- * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Wrapper method for the `setUpBeforeClass()` method for forward-compatibility with WP 5.9.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function assertEqualsWithDelta( $expected, $actual, $delta, $message = '' ) {
- $constraint = new PHPUnit_Framework_Constraint_IsEqual(
- $expected,
- $delta
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function set_up_before_class() {
+ static::setUpBeforeClass();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- static::assertThat( $actual, $constraint, $message );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Wrapper method for the `tearDownAfterClass()` method for forward-compatibility with WP 5.9.
+ */
+ public static function tear_down_after_class() {
+ static::tearDownAfterClass();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /**
+ * Wrapper method for the `setUp()` method for forward-compatibility with WP 5.9.
+ */
+ public function set_up() {
+ static::setUp();
+ }
+
+ /**
+ * Wrapper method for the `tearDown()` method for forward-compatibility with WP 5.9.
+ */
+ public function tear_down() {
+ static::tearDown();
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>