<!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>[50441] trunk: Build/Test Tools: Switch back to running the PHPUnit test suite against the `src` directory instead of `build`.</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/50441">50441</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/50441","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>johnbillion</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-02-26 14:07:53 +0000 (Fri, 26 Feb 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: Switch back to running the PHPUnit test suite against the `src` directory instead of `build`.
Some PHPUnit tests were concerned with the state of files in the `build` directory. In order to allow the tests to run without requiring a build to be run first, these have been moved into assertions that run after the build step (and therefore cause it to fail if they do not pass), or into QUnit tests as necessary.
Various other PHPUnit tests implictly depend on built JavaScript files being present. These files are now touched during the test setup to avoid PHP warnings if the `build` files are not present.
The `wp-tests-config-sample.php` file and the GitHub Actions configuration have also been changed so `ABSPATH` uses `src` instead of `build`, therefore allowing the PHPUnit tests to be run without a build having to be run first. This means all new local installations of WordPress will use `src` for PHPUnit testing. If you would like to switch your existing installation over then change the location of `ABSPATH` in `wp-tests-config.php` to point to `src` instead of `build`.
Props peterwilsoncc, iandunn, gziolo, desroj, johnbillion
Fixes <a href="https://core.trac.wordpress.org/ticket/51734">#51734</a>
See <a href="https://core.trac.wordpress.org/ticket/45863">#45863</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkgithubworkflowsphpunittestsyml">trunk/.github/workflows/phpunit-tests.yml</a></li>
<li><a href="#trunkgithubworkflowstestcoverageyml">trunk/.github/workflows/test-coverage.yml</a></li>
<li><a href="#trunkGruntfilejs">trunk/Gruntfile.js</a></li>
<li><a href="#trunkREADMEmd">trunk/README.md</a></li>
<li><a href="#trunktestsphpunitincludesabstracttestcasephp">trunk/tests/phpunit/includes/abstract-testcase.php</a></li>
<li><a href="#trunktestsphpunittestsdependenciesjqueryphp">trunk/tests/phpunit/tests/dependencies/jquery.php</a></li>
<li><a href="#trunktestsphpunittestsdependenciesscriptsphp">trunk/tests/phpunit/tests/dependencies/scripts.php</a></li>
<li><a href="#trunktestsphpunittestsformattingEmojiphp">trunk/tests/phpunit/tests/formatting/Emoji.php</a></li>
<li><a href="#trunktestsphpunittestsoembedcontrollerphp">trunk/tests/phpunit/tests/oembed/controller.php</a></li>
<li><a href="#trunktestsphpunittestsoembedgetResponseDataphp">trunk/tests/phpunit/tests/oembed/getResponseData.php</a></li>
<li><a href="#trunktestsphpunittestsoembedtemplatephp">trunk/tests/phpunit/tests/oembed/template.php</a></li>
<li><a href="#trunktestsphpunittestsoembedwpOembedphp">trunk/tests/phpunit/tests/oembed/wpOembed.php</a></li>
<li><a href="#trunktestsphpunittestsshortcodephp">trunk/tests/phpunit/tests/shortcode.php</a></li>
<li><a href="#trunktestsqunitindexhtml">trunk/tests/qunit/index.html</a></li>
<li><a href="#trunkwptestsconfigsamplephp">trunk/wp-tests-config-sample.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsqunitwpincludesjsjqueryjs">trunk/tests/qunit/wp-includes/js/jquery.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunktestsphpunittestsadminincludesUpdateCorephp">trunk/tests/phpunit/tests/admin/includesUpdateCore.php</a></li>
<li><a href="#trunktestsphpunittestsdependenciesmediaelementjsphp">trunk/tests/phpunit/tests/dependencies/mediaelementjs.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkgithubworkflowsphpunittestsyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/.github/workflows/phpunit-tests.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/.github/workflows/phpunit-tests.yml 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/.github/workflows/phpunit-tests.yml 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,7 +19,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> - cron: '0 0 * * 0'
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> env:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- LOCAL_DIR: build
</del><span class="cx" style="display: block; padding: 0 10px"> PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
</span><span class="cx" style="display: block; padding: 0 10px"> COMPOSER_INSTALL: ${{ false }}
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,20 +26,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> LOCAL_PHP_MEMCACHED: ${{ false }}
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> jobs:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # Sets up WordPress for testing or development use.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ # Sets up the workflow for testing.
</ins><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # Performs the following steps:
</span><span class="cx" style="display: block; padding: 0 10px"> # - Cancels all previous workflow runs for pull requests that have not completed.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # - Checks out the repository.
- # - Logs debug information about the runner container.
- # - Installs NodeJS 14.
- # - Sets up caching for NPM.
- # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
- # - Builds WordPress to run from the `build` directory.
- # - Creates a ZIP file of compiled WordPress.
- # - Uploads ZIP file as an artifact.
- setup-wordpress:
- name: Setup WordPress
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ setup-workflow:
+ name: Setup Workflow
</ins><span class="cx" style="display: block; padding: 0 10px"> runs-on: ubuntu-latest
</span><span class="cx" style="display: block; padding: 0 10px"> if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }}
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -51,67 +42,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> with:
</span><span class="cx" style="display: block; padding: 0 10px"> access_token: ${{ github.token }}
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- - name: Checkout repository
- uses: actions/checkout@v2
-
- - name: Log debug information
- run: |
- echo "$GITHUB_REF"
- echo "$GITHUB_EVENT_NAME"
- npm --version
- node --version
- curl --version
- git --version
- svn --version
- php --version
- php -i
- locale -a
-
- - name: Install NodeJS
- uses: actions/setup-node@v2
- with:
- node-version: 14
-
- - name: Cache NodeJS modules
- uses: actions/cache@v2
- env:
- cache-name: cache-node-modules
- with:
- # npm cache files are stored in `~/.npm` on Linux/macOS
- path: ~/.npm
- key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
-
- - name: Install Dependencies
- run: npx install-changed --install-command="npm ci"
-
- - name: Build WordPress
- run: npm run build
-
- - name: Create ZIP artifact
- uses: thedoctor0/zip-release@0.4.1
- with:
- filename: built-wp-${{ github.sha }}.zip
- exclusions: '*.git* /*node_modules/* packagehash.txt'
-
- - name: Upload build artifact
- uses: actions/upload-artifact@v2
- with:
- name: built-wp-${{ github.sha }}
- path: built-wp-${{ github.sha }}.zip
- if-no-files-found: error
-
</del><span class="cx" style="display: block; padding: 0 10px"> # Runs the PHPUnit tests for WordPress.
</span><span class="cx" style="display: block; padding: 0 10px"> #
</span><span class="cx" style="display: block; padding: 0 10px"> # Performs the following steps:
</span><span class="cx" style="display: block; padding: 0 10px"> # - Set environment variables.
</span><span class="cx" style="display: block; padding: 0 10px"> # - Sets up the environment variables needed for testing with memcached (if desired).
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # - Downloads the built WordPress artifact from the previous job.
- # - Unzips the artifact.
</del><span class="cx" style="display: block; padding: 0 10px"> # - Installs NodeJS 14.
</span><span class="cx" style="display: block; padding: 0 10px"> # - Sets up caching for NPM.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ # - Installs NPM dependencies
</ins><span class="cx" style="display: block; padding: 0 10px"> # - Configures caching for Composer.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # _ Installs Composer dependencies (if desired).
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ # - Installs Composer dependencies (if desired).
</ins><span class="cx" style="display: block; padding: 0 10px"> # - Logs Docker debug information (about both the Docker installation within the runner).
</span><span class="cx" style="display: block; padding: 0 10px"> # - Starts the WordPress Docker container.
</span><span class="cx" style="display: block; padding: 0 10px"> # - Starts the memcached server after the Docker network has been created (if desired).
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -127,7 +67,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> # - todo: Configure Slack notifications for failing tests.
</span><span class="cx" style="display: block; padding: 0 10px"> test-php:
</span><span class="cx" style="display: block; padding: 0 10px"> name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }}
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- needs: setup-wordpress
</del><span class="cx" style="display: block; padding: 0 10px"> runs-on: ${{ matrix.os }}
</span><span class="cx" style="display: block; padding: 0 10px"> strategy:
</span><span class="cx" style="display: block; padding: 0 10px"> fail-fast: false
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -163,14 +102,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
</span><span class="cx" style="display: block; padding: 0 10px"> echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- - name: Download the built WordPress artifact
- uses: actions/download-artifact@v2
- with:
- name: built-wp-${{ github.sha }}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ - name: Checkout repository
+ uses: actions/checkout@v2
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- - name: Unzip built artifact
- run: unzip built-wp-${{ github.sha }}.zip
-
</del><span class="cx" style="display: block; padding: 0 10px"> - name: Install NodeJS
</span><span class="cx" style="display: block; padding: 0 10px"> uses: actions/setup-node@v2
</span><span class="cx" style="display: block; padding: 0 10px"> with:
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,7 +164,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> - name: Start the Memcached server.
</span><span class="cx" style="display: block; padding: 0 10px"> if: ${{ matrix.memcached }}
</span><span class="cx" style="display: block; padding: 0 10px"> run: |
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
</ins><span class="cx" style="display: block; padding: 0 10px"> docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> - name: General debug information
</span></span></pre></div>
<a id="trunkgithubworkflowstestcoverageyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/.github/workflows/test-coverage.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/.github/workflows/test-coverage.yml 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/.github/workflows/test-coverage.yml 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -6,7 +6,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> - cron: '0 0 * * *'
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> env:
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- LOCAL_DIR: build
</del><span class="cx" style="display: block; padding: 0 10px"> PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }}
</span><span class="cx" style="display: block; padding: 0 10px"> COMPOSER_INSTALL: ${{ false }}
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,7 +25,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> # - Installs NodeJS 14.
</span><span class="cx" style="display: block; padding: 0 10px"> # - Sets up caching for NPM.
</span><span class="cx" style="display: block; padding: 0 10px"> # _ Installs NPM dependencies using install-changed to hash the `package.json` file.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- # - Builds WordPress to run from the `build` directory.
</del><span class="cx" style="display: block; padding: 0 10px"> # - Logs Docker debug information (about the Docker installation within the runner).
</span><span class="cx" style="display: block; padding: 0 10px"> # - Starts the WordPress Docker container.
</span><span class="cx" style="display: block; padding: 0 10px"> # - Logs debug general information.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -85,9 +83,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> - name: Install Dependencies
</span><span class="cx" style="display: block; padding: 0 10px"> run: npx install-changed --install-command="npm ci"
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- - name: Build WordPress
- run: npm run build
-
</del><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="trunkGruntfilejs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/Gruntfile.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/Gruntfile.js 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/Gruntfile.js 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7,6 +7,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> module.exports = function(grunt) {
</span><span class="cx" style="display: block; padding: 0 10px"> var path = require('path'),
</span><span class="cx" style="display: block; padding: 0 10px"> fs = require( 'fs' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ glob = require( 'glob' ),
+ assert = require( 'assert' ).strict,
</ins><span class="cx" style="display: block; padding: 0 10px"> spawn = require( 'child_process' ).spawnSync,
</span><span class="cx" style="display: block; padding: 0 10px"> SOURCE_DIR = 'src/',
</span><span class="cx" style="display: block; padding: 0 10px"> BUILD_DIR = 'build/',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1431,6 +1433,126 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'copy:version',
</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">+ /**
+ * Build verification tasks.
+ */
+ grunt.registerTask( 'verify:build', [
+ 'verify:wp-embed',
+ 'verify:old-files',
+ 'verify:source-maps',
+ ] );
+
+ /**
+ * Build assertions for wp-embed.min.js.
+ *
+ * @ticket 34698
+ */
+ grunt.registerTask( 'verify:wp-embed', function() {
+ const file = `${ BUILD_DIR }/wp-includes/js/wp-embed.min.js`;
+
+ assert(
+ fs.existsSync( file ),
+ 'The build/wp-includes/js/wp-embed.min.js file does not exist.'
+ );
+
+ const contents = fs.readFileSync( file, {
+ encoding: 'utf8',
+ } );
+
+ assert(
+ contents.length > 0,
+ 'The build/wp-includes/js/wp-embed.min.js file must not be empty.'
+ );
+ assert(
+ false === contents.includes( '&' ),
+ 'The build/wp-includes/js/wp-embed.min.js file must not contain ampersands.'
+ );
+ } );
+
+ /**
+ * Build assertions to ensure no project files are inside `$_old_files` in the build directory.
+ *
+ * @ticket 36083
+ */
+ grunt.registerTask( 'verify:old-files', function() {
+ const file = `${ BUILD_DIR }wp-admin/includes/update-core.php`;
+
+ assert(
+ fs.existsSync( file ),
+ 'The build/wp-admin/includes/update-core.php file does not exist.'
+ );
+
+ const contents = fs.readFileSync( file, {
+ encoding: 'utf8',
+ } );
+
+ assert(
+ contents.length > 0,
+ 'The build/wp-admin/includes/update-core.php file must not be empty.'
+ );
+
+ const match = contents.match( /\$_old_files = array\(([^\)]+)\);/ );
+
+ assert(
+ match.length > 0,
+ 'The build/wp-admin/includes/update-core.php file does not include an `$_old_files` array.'
+ );
+
+ const files = match[1].split( '\n\t' ).filter( function( file ) {
+ // Filter out empty lines
+ if ( '' === file ) {
+ return false;
+ }
+
+ // Filter out commented out lines
+ if ( 0 === file.indexOf( '/' ) ) {
+ return false;
+ }
+
+ return true;
+ } ).map( function( file ) {
+ // Strip leading and trailing single quotes and commas
+ return file.replace( /^\'|\',$/g, '' );
+ } );
+
+ files.forEach(function( file ){
+ const search = `${ BUILD_DIR }${ file }`;
+ assert(
+ false === fs.existsSync( search ),
+ `${ search } should not be present in the $_old_files array.`
+ );
+ });
+ } );
+
+ /**
+ * Build assertions for the lack of source maps in JavaScript files.
+ *
+ * @ticket 24994
+ * @ticket 46218
+ */
+ grunt.registerTask( 'verify:source-maps', function() {
+ const path = `${ BUILD_DIR }**/*.js`;
+ const files = glob.sync( path );
+
+ assert(
+ files.length > 0,
+ 'No JavaScript files found in the build directory.'
+ );
+
+ files.forEach( function( file ) {
+ const contents = fs.readFileSync( file, {
+ encoding: 'utf8',
+ } );
+ // `data:` URLs are allowed:
+ const match = contents.match( /sourceMappingURL=((?!data:).)/ );
+
+ assert(
+ match === null,
+ `The ${ file } file must not contain a sourceMappingURL.`
+ );
+ } );
+ } );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> grunt.registerTask( 'build', function() {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( grunt.option( 'dev' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> grunt.task.run( [
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1444,7 +1566,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'build:css',
</span><span class="cx" style="display: block; padding: 0 10px"> 'includes:emoji',
</span><span class="cx" style="display: block; padding: 0 10px"> 'includes:embed',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'replace:emojiBannerText'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'replace:emojiBannerText',
+ 'verify:build'
</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"> } );
</span></span></pre></div>
<a id="trunkREADMEmd"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/README.md</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/README.md 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/README.md 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -45,7 +45,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> If you're making changes to WordPress core files, you should start the file watcher in order to build or copy the files as necessary:
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> ```
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-npm run watch
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+npm run dev
</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"> To stop the watcher, press `ctrl+c`.
</span></span></pre></div>
<a id="trunktestsphpunitincludesabstracttestcasephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/abstract-testcase.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/abstract-testcase.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/includes/abstract-testcase.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1293,4 +1293,26 @@
</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">+
+ /**
+ * Touches the given file and its directory if it doesn't already exist.
+ *
+ * This can be used to ensure a file that is implictly relied on in a test exists
+ * without it having to be built.
+ *
+ * @param string $file The file name.
+ */
+ public static function touch( $file ) {
+ if ( file_exists( $file ) ) {
+ return;
+ }
+
+ $dir = dirname( $file );
+
+ if ( ! file_exists( $dir ) ) {
+ mkdir( $dir, 0777, true );
+ }
+
+ touch( $file );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsadminincludesUpdateCorephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/admin/includesUpdateCore.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/admin/includesUpdateCore.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/admin/includesUpdateCore.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,34 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * @group admin
- * @group upgrade
- */
-class Tests_Admin_IncludesUpdateCore extends WP_UnitTestCase {
- public function data_old_files() {
- global $_old_files;
-
- require_once ABSPATH . 'wp-admin/includes/update-core.php';
-
- $files = $_old_files;
-
- foreach ( $files as &$file ) {
- $file = array( $file );
- }
-
- return $files;
- }
-
- /**
- * Ensure no project files are inside `$_old_files` in the build directory.
- *
- * @ticket 36083
- *
- * @dataProvider data_old_files
- *
- * @param string $file File name.
- */
- public function test_new_files_are_not_in_old_files_array_compiled( $file ) {
- $this->assertFileNotExists( dirname( ABSPATH ) . '/build/' . $file );
- }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsdependenciesjqueryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/dependencies/jquery.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/dependencies/jquery.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/dependencies/jquery.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,13 +39,6 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function test_presence_of_jquery_no_conflict() {
- $contents = trim( file_get_contents( ABSPATH . WPINC . '/js/jquery/jquery.js' ) );
- $noconflict = 'jQuery.noConflict();';
- $end = substr( $contents, - strlen( $noconflict ) );
- $this->assertSame( $noconflict, $end );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 22896
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span></span></pre></div>
<a id="trunktestsphpunittestsdependenciesmediaelementjsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/tests/phpunit/tests/dependencies/mediaelementjs.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/dependencies/mediaelementjs.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/dependencies/mediaelementjs.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,36 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-
-/**
- * @group dependencies
- * @group scripts
- */
-class Tests_Dependencies_MediaElementjs extends WP_UnitTestCase {
- /**
- * Test if the MediaElement.js Flash fallbacks have been re-added.
- *
- * MediaElement's Flash fallbacks were removed in WordPress 4.9.2 due to limited use cases and
- * a history of security vulnerabilities. It's unlikely that there'll ever be a need to
- * restore them in the future, and doing so could introduce security vulnerabilities. If you
- * want to re-add them, please discuss that with the Security team first.
- *
- * @since 5.1.0
- *
- * @ticket 42720
- */
- function test_exclusion_of_flash() {
- $mejs_folder = ABSPATH . WPINC . '/js/mediaelement';
- $js_files = glob( $mejs_folder . '/*.js' );
-
- /*
- * The path in $mejs_folder is hardcoded, so this is just a sanity check to make sure the
- * correct directory is used, in case it gets renamed in the future.
- */
- $this->assertGreaterThan( 0, count( $js_files ) );
-
- $mejs_directory_iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $mejs_folder ) );
- $mejs_swf_iterator = new RegexIterator( $mejs_directory_iterator, '/\.swf$/i', RecursiveRegexIterator::GET_MATCH );
-
- // Make sure the Flash files haven't been re-added accidentally.
- $this->assertCount( 0, iterator_to_array( $mejs_swf_iterator ) );
- }
-}
</del></span></pre></div>
<a id="trunktestsphpunittestsdependenciesscriptsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/dependencies/scripts.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/dependencies/scripts.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/dependencies/scripts.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -728,7 +728,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
</span><span class="cx" style="display: block; padding: 0 10px"> $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/vendor/wp-polyfill{$suffix}.js' id='wp-polyfill-js'></script>\n";
</span><span class="cx" style="display: block; padding: 0 10px"> $expected .= "<script type='text/javascript' id='wp-polyfill-js-after'>\n";
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected .= "( 'fetch' in window ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-fetch{$suffix}.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains{$suffix}.js\"></scr' + 'ipt>' );( window.DOMRect ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-dom-rect{$suffix}.js\"></scr' + 'ipt>' );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-url{$suffix}.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"http://example
.org/wp-includes/js/dist/vendor/wp-polyfill-formdata{$suffix}.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest{$suffix}.js\"></scr' + 'ipt>' );( 'objectFit' in document.documentElement.style ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-object-fit.min.js\"></scr' + 'ipt>' );\n";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected .= "( 'fetch' in window ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-fetch{$suffix}.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains{$suffix}.js\"></scr' + 'ipt>' );( window.DOMRect ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-dom-rect{$suffix}.js\"></scr' + 'ipt>' );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-url{$suffix}.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"http://example.
org/wp-includes/js/dist/vendor/wp-polyfill-formdata{$suffix}.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest{$suffix}.js\"></scr' + 'ipt>' );( 'objectFit' in document.documentElement.style ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-object-fit{$suffix}.js\"></scr' + 'ipt>' );\n";
</ins><span class="cx" style="display: block; padding: 0 10px"> $expected .= "</script>\n";
</span><span class="cx" style="display: block; padding: 0 10px"> $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/dom-ready{$suffix}.js' id='wp-dom-ready-js'></script>\n";
</span><span class="cx" style="display: block; padding: 0 10px"> $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/hooks{$suffix}.js' id='wp-hooks-js'></script>\n";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1417,18 +1417,6 @@
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- function test_no_source_mapping() {
- $all_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( dirname( ABSPATH ) . '/build/' ) );
- $js_files = new RegexIterator( $all_files, '/\.js$/' );
- foreach ( $js_files as $js_file ) {
- $contents = trim( file_get_contents( $js_file ) );
-
- // We allow data: URLs.
- $found = preg_match( '/sourceMappingURL=((?!data:).)/', $contents );
- $this->assertSame( $found, 0, "sourceMappingURL found in $js_file" );
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 52534
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers ::wp_localize_script
</span></span></pre></div>
<a id="trunktestsphpunittestsformattingEmojiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/formatting/Emoji.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/formatting/Emoji.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/formatting/Emoji.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,6 +13,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 36525
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_unfiltered_emoji_cdns() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present:
+ self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $output = get_echo( '_print_emoji_detection_script' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertContains( wp_json_encode( $this->png_cdn ), $output );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,6 +33,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'emoji_svg_url', array( $this, '_filtered_emoji_svn_cdn' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present:
+ self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $output = get_echo( '_print_emoji_detection_script' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertContains( wp_json_encode( $this->png_cdn ), $output );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,6 +56,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'emoji_url', array( $this, '_filtered_emoji_png_cdn' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present:
+ self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $output = get_echo( '_print_emoji_detection_script' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertContains( wp_json_encode( $filtered_png_cdn ), $output );
</span></span></pre></div>
<a id="trunktestsphpunittestsoembedcontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/oembed/controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/oembed/controller.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/oembed/controller.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -34,6 +34,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'user_email' => 'administrator@example.com',
</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">+
+ // `get_post_embed_html()` assumes `wp-includes/js/wp-embed.js` is present:
+ self::touch( ABSPATH . WPINC . '/js/wp-embed.js' );
</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"> public static function wpTearDownAfterClass() {
</span></span></pre></div>
<a id="trunktestsphpunittestsoembedgetResponseDataphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/oembed/getResponseData.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/oembed/getResponseData.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/oembed/getResponseData.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,6 +5,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers ::get_oembed_response_data
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> class Tests_oEmbed_Response_Data extends WP_UnitTestCase {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function setUp() {
+ parent::setUp();
+
+ // `get_post_embed_html()` assumes `wp-includes/js/wp-embed.js` is present:
+ self::touch( ABSPATH . WPINC . '/js/wp-embed.js' );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function test_get_oembed_response_data_non_existent_post() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( get_oembed_response_data( 0, 100 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsoembedtemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/oembed/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/oembed/template.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/oembed/template.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,6 +23,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertQueryTrue( 'is_single', 'is_singular', 'is_embed' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // `print_embed_scripts()` assumes `wp-includes/js/wp-embed-template.js` is present:
+ self::touch( ABSPATH . WPINC . '/js/wp-embed-template.js' );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> ob_start();
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/theme-compat/embed.php';
</span><span class="cx" style="display: block; padding: 0 10px"> $actual = ob_get_clean();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -290,50 +293,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Confirms that no ampersands exist in src/wp-includes/js/wp-embed.js.
+ *
+ * See also the `verify:wp-embed` Grunt task for verifying the built file.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @ticket 34698
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function test_js_no_ampersands() {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNotContains( '&', file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- /**
- * @ticket 34698
- *
- * @depends test_js_no_ampersands
- *
- * The previous test confirms that no ampersands exist in src/wp-includes/js/wp-embed.js.
- * However, we must also confirm that UglifyJS does not add ampersands during its
- * optimizations (which we tweak to avoid, but indirectly -- understandably, there's
- * no "don't add ampersands to my JavaScript file" option).
- *
- * So this test checks for ampersands in build/wp-includes/js/wp-embed.min.js.
- * In many cases, this file will not exist; in those cases, we simply skip the test.
- *
- * So when would it be run? We have Travis CI run `npm run test` which then runs, in order,
- * `qunit:compiled` (which runs the build) and then `phpunit`. Thus, this test will at least be
- * run during continuous integration.
- *
- * However, we need to verify that `qunit:compiled` runs before `phpunit`. So this test also
- * does a cheap check for a registered Grunt task called `test` that contains both
- * `qunit:compiled` and `phpunit`, in that order.
- *
- * One final failsafe: The Gruntfile.js assertion takes place before checking for the existence
- * of wp-embed.min.js. If the Grunt tasks are significantly refactored later, it could indicate
- * that wp-embed.min.js doesn't exist anymore. We wouldn't want the test to silently become one
- * that is always skipped, and thus useless.
- */
- function test_js_no_ampersands_in_compiled() {
- $gruntfile = file_get_contents( dirname( ABSPATH ) . '/Gruntfile.js' );
-
- // Confirm this file *should* exist, otherwise this test will always be skipped.
- $test = '/grunt.registerTask\(\s*\'test\',.*\'qunit:compiled\'.*\'phpunit\'/';
- $this->assertTrue( (bool) preg_match( $test, $gruntfile ) );
-
- $file = dirname( ABSPATH ) . '/build/' . WPINC . '/js/wp-embed.min.js';
- if ( ! file_exists( $file ) ) {
- return;
- }
- $this->assertNotContains( '&', file_get_contents( $file ) );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunittestsoembedwpOembedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/oembed/wpOembed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/oembed/wpOembed.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/oembed/wpOembed.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,6 +18,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->oembed = _wp_oembed_get_object();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->pre_oembed_result_filtered = false;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // `get_post_embed_html()` assumes `wp-includes/js/wp-embed.js` is present:
+ self::touch( ABSPATH . WPINC . '/js/wp-embed.js' );
</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"> public function _filter_pre_oembed_result( $result ) {
</span></span></pre></div>
<a id="trunktestsphpunittestsshortcodephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/shortcode.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/shortcode.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/phpunit/tests/shortcode.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -746,7 +746,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function test_php_and_js_shortcode_attribute_regexes_match() {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $file = file_get_contents( ABSPATH . WPINC . '/js/shortcode.js' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $file = file_get_contents( ABSPATH . 'js/_enqueues/wp/shortcode.js' );
</ins><span class="cx" style="display: block; padding: 0 10px"> $matched = preg_match( '|\s+pattern = (\/.+\/)g;|', $file, $matches );
</span><span class="cx" style="display: block; padding: 0 10px"> $php = get_shortcode_atts_regex();
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsqunitindexhtml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/qunit/index.html</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/index.html 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/tests/qunit/index.html 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -152,6 +152,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <script src="wp-admin/js/dashboard.js"></script>
</span><span class="cx" style="display: block; padding: 0 10px"> <script src="wp-includes/js/shortcode.js"></script>
</span><span class="cx" style="display: block; padding: 0 10px"> <script src="wp-includes/js/api-request.js"></script>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <script src="wp-includes/js/jquery.js"></script>
</ins><span class="cx" style="display: block; padding: 0 10px"> <script src="wp-includes/js/wp-api.js"></script>
</span><span class="cx" style="display: block; padding: 0 10px"> <script src="wp-admin/js/customize-controls.js"></script>
</span><span class="cx" style="display: block; padding: 0 10px"> <script src="wp-admin/js/customize-controls-utils.js"></script>
</span></span></pre></div>
<a id="trunktestsqunitwpincludesjsjqueryjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/qunit/wp-includes/js/jquery.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/qunit/wp-includes/js/jquery.js (rev 0)
+++ trunk/tests/qunit/wp-includes/js/jquery.js 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,10 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+( function( QUnit ) {
+ QUnit.module( 'jQuery' );
+
+ QUnit.test( 'jQuery is run in noConflict mode', function( assert ) {
+ assert.expect( 1 );
+
+ assert.ok( 'undefined' === typeof window.$ );
+ } );
+
+} )( window.QUnit );
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/qunit/wp-includes/js/jquery.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunkwptestsconfigsamplephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/wp-tests-config-sample.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/wp-tests-config-sample.php 2021-02-26 11:15:54 UTC (rev 50440)
+++ trunk/wp-tests-config-sample.php 2021-02-26 14:07:53 UTC (rev 50441)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,11 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* Path to the WordPress codebase you'd like to test. Add a forward slash in the end. */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) {
- define( 'ABSPATH', dirname( __FILE__ ) . '/build/' );
-} else {
- define( 'ABSPATH', dirname( __FILE__ ) . '/src/' );
-}
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+define( 'ABSPATH', dirname( __FILE__ ) . '/src/' );
</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"> * Path to the theme to test with.
</span></span></pre>
</div>
</div>
</body>
</html>