Changeset 50606
- Timestamp:
- 03/26/2021 08:02:01 PM (4 years ago)
- Location:
- branches/5.2
- Files:
-
- 2 added
- 3 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.2
-
branches/5.2/.github/workflows/coding-standards.yml
r50305 r50606 2 2 3 3 on: 4 # JSHint was introduced in WordPress 3.8. 5 # PHPCS checking was introduced in WordPress 5.1. 4 6 push: 5 7 branches: 6 8 - master 7 # JSHint was introduced in WordPress 3.8. 8 # PHPCS checking was introduced in WordPress 5.1. 9 - trunk 9 10 - '3.[89]' 10 11 - '[4-9].[0-9]' … … 13 14 - '[4-9].[0-9]*' 14 15 pull_request: 16 branches: 17 - master 18 - trunk 19 - '3.[89]' 20 - '[4-9].[0-9]' 21 paths: 22 # Any change to a PHP or JavaScript file should run checks. 23 - '**.js' 24 - '**.php' 25 # These files configure NPM. Changes could affect the outcome. 26 - 'package*.json' 27 # These files configure Composer. Changes could affect the outcome. 28 - 'composer.*' 29 # This file configures JSHint. Changes could affect the outcome. 30 - '.jshintrc' 31 # This file configures PHPCS. Changes could affect the outcome. 32 - 'phpcs.xml.dist' 33 # Changes to workflow files should always verify all workflows are successful. 34 - '.github/workflows/*.yml' 35 workflow_dispatch: 15 36 16 37 jobs: … … 36 57 steps: 37 58 - name: Checkout repository 38 uses: actions/checkout@ v259 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 39 60 40 61 - name: Set up PHP 41 uses: shivammathur/setup-php@ v262 uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0 42 63 with: 43 64 php-version: '7.3' … … 51 72 52 73 - name: Install Composer dependencies 53 uses: ramsey/composer-install@ v174 uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0 54 75 with: 55 76 composer-options: "--no-progress --no-ansi --no-interaction" … … 86 107 steps: 87 108 - name: Checkout repository 88 uses: actions/checkout@ v2109 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 89 110 90 111 - name: Log debug information … … 96 117 97 118 - name: Install NodeJS 98 uses: actions/setup-node@ v1119 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 99 120 with: 100 121 node-version: 14 101 122 102 123 - name: Cache NodeJS modules 103 uses: actions/cache@ v2124 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 104 125 env: 105 126 cache-name: cache-node-modules … … 108 129 path: ~/.npm 109 130 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 110 restore-keys: |111 ${{ runner.os }}-npm-112 131 113 132 - name: Log debug information … … 117 136 118 137 - name: Install Dependencies 119 run: np x install-changed --install-command="npm ci"138 run: npm ci 120 139 121 140 - name: Run JSHint -
branches/5.2/.github/workflows/end-to-end-tests.yml
r50305 r50606 2 2 3 3 on: 4 # The end to end test suite was introduced in WordPress 5.3. 4 5 push: 5 6 branches: 6 7 - master 7 # The end to end test suite was introduced in WordPress 5.3.8 - trunk 8 9 - '5.[3-9]' 9 10 - '[6-9].[0-9]' … … 12 13 - '[6-9].[0-9]*' 13 14 pull_request: 15 branches: 16 - master 17 - trunk 18 - '5.[3-9]' 19 - '[6-9].[0-9]' 14 20 15 21 env: … … 43 49 - name: Cancel previous runs of this workflow (pull requests only) 44 50 if: ${{ github.event_name == 'pull_request' }} 45 uses: styfle/cancel-workflow-action@0.5.0 46 with: 47 access_token: ${{ github.token }} 51 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 48 52 49 53 - name: Configure environment variables … … 53 57 54 58 - name: Checkout repository 55 uses: actions/checkout@ v259 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 56 60 57 61 - name: Log debug information … … 67 71 68 72 - name: Install NodeJS 69 uses: actions/setup-node@ v173 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 70 74 with: 71 75 node-version: 14 72 76 73 77 - name: Cache NodeJS modules 74 uses: actions/cache@ v278 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 75 79 env: 76 80 cache-name: cache-node-modules … … 79 83 path: ~/.npm 80 84 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 81 restore-keys: |82 ${{ runner.os }}-npm-83 85 84 86 - name: Install Dependencies 85 run: np x install-changed --install-command="npm ci"87 run: npm ci 86 88 87 89 - name: Build WordPress -
branches/5.2/.github/workflows/javascript-tests.yml
r50305 r50606 2 2 3 3 on: 4 # JavaScript testing was introduced in WordPress 3.8. 4 5 push: 5 6 branches: 6 7 - master 7 # JavaScript testing was introduced in WordPress 3.8.8 - trunk 8 9 - '3.[89]' 9 10 - '[4-9].[0-9]' … … 12 13 - '[4-9].[0-9]*' 13 14 pull_request: 15 branches: 16 - master 17 - trunk 18 - '3.[89]' 19 - '[4-9].[0-9]' 20 paths: 21 # Any change to a JavaScript file should run tests. 22 - '**.js' 23 # These files configure NPM. Changes could affect the outcome. 24 - 'package*.json' 25 # This file configures ESLint. Changes could affect the outcome. 26 - '.eslintignore' 27 # This file configures JSHint. Changes could affect the outcome. 28 - '.jshintrc' 29 # Any change to the QUnit directory should run tests. 30 - 'tests/qunit/**' 31 # Changes to workflow files should always verify all workflows are successful. 32 - '.github/workflows/*.yml' 33 workflow_dispatch: 14 34 15 35 jobs: … … 34 54 - name: Cancel previous runs of this workflow (pull requests only) 35 55 if: ${{ github.event_name == 'pull_request' }} 36 uses: styfle/cancel-workflow-action@0.5.0 37 with: 38 access_token: ${{ github.token }} 56 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 39 57 40 58 - name: Checkout repository 41 uses: actions/checkout@ v259 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 42 60 43 61 - name: Log debug information … … 49 67 50 68 - name: Install NodeJS 51 uses: actions/setup-node@ v169 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 52 70 with: 53 71 node-version: 14 54 72 55 73 - name: Cache NodeJS modules 56 uses: actions/cache@ v274 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 57 75 env: 58 76 cache-name: cache-node-modules … … 61 79 path: ~/.npm 62 80 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 63 restore-keys: |64 ${{ runner.os }}-npm-65 81 66 82 - name: Log debug information … … 70 86 71 87 - name: Install Dependencies 72 run: np x install-changed --install-command="npm ci"88 run: npm ci 73 89 74 90 - name: Run QUnit tests -
branches/5.2/.github/workflows/php-compatibility.yml
r50305 r50606 2 2 3 3 on: 4 # PHP compatibility testing was introduced in WordPress 5.5. 4 5 push: 5 6 branches: 6 7 - master 7 # The PHP compatibility testing was introduced in WordPress 5.5.8 - trunk 8 9 - '5.[5-9]' 9 10 - '[6-9].[0-9]' … … 12 13 - '[6-9].[0-9]*' 13 14 pull_request: 15 branches: 16 - master 17 - trunk 18 - '5.[5-9]' 19 - '[6-9].[0-9]' 20 paths: 21 # This workflow only scans PHP files. 22 - '**.php' 23 # These files configure Composer. Changes could affect the outcome. 24 - 'composer.*' 25 # This file configures PHP Compatibility scanning. Changes could affect the outcome. 26 - 'phpcompat.xml.dist' 27 # Changes to workflow files should always verify all workflows are successful. 28 - '.github/workflows/*.yml' 29 workflow_dispatch: 14 30 15 31 jobs: … … 35 51 steps: 36 52 - name: Checkout repository 37 uses: actions/checkout@ v253 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 38 54 39 55 - name: Set up PHP 40 uses: shivammathur/setup-php@ v256 uses: shivammathur/setup-php@afefcaf556d98dc7896cca380e181decb609ca44 # v2.10.0 41 57 with: 42 58 php-version: '7.4' … … 50 66 51 67 - name: Install Composer dependencies 52 uses: ramsey/composer-install@ v168 uses: ramsey/composer-install@92a7904348d4ad30236f3611e33b7f0c6f9edd70 # v1.1.0 53 69 with: 54 70 composer-options: "--no-progress --no-ansi --no-interaction" -
branches/5.2/.github/workflows/phpunit-tests.yml
r50336 r50606 5 5 branches: 6 6 - master 7 - trunk 7 8 - '3.[7-9]' 8 9 - '[4-9].[0-9]' … … 11 12 - '[4-9].[0-9]*' 12 13 pull_request: 14 branches: 15 - master 16 - trunk 17 - '3.[7-9]' 18 - '[4-9].[0-9]' 19 workflow_dispatch: 13 20 # Once weekly On Sundays at 00:00 UTC. 14 21 schedule: … … 16 23 17 24 env: 18 LOCAL_DIR: build19 25 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: ${{ true }} 20 26 COMPOSER_INSTALL: ${{ false }} … … 22 28 PHPUNIT_SCRIPT: php 23 29 LOCAL_PHP_MEMCACHED: ${{ false }} 30 SLOW_TESTS: 'external-http,media,restapi' 24 31 25 32 jobs: 26 # Sets up WordPress for testing or development use.33 # Sets up the workflow for testing. 27 34 # 28 35 # Performs the following steps: 29 36 # - Cancels all previous workflow runs for pull requests that have not completed. 30 # - Checks out the repository. 31 # - Logs debug information about the runner container. 32 # - Installs NodeJS 14. 33 # - Sets up caching for NPM. 34 # _ Installs NPM dependencies using install-changed to hash the `package.json` file. 35 # - Builds WordPress to run from the `build` directory. 36 # - Creates a ZIP file of compiled WordPress. 37 # - Uploads ZIP file as an artifact. 38 setup-wordpress: 39 name: Setup WordPress 37 setup-workflow: 38 name: Setup Workflow 40 39 runs-on: ubuntu-latest 41 40 if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} … … 44 43 - name: Cancel previous runs of this workflow (pull requests only) 45 44 if: ${{ github.event_name == 'pull_request' }} 46 uses: styfle/cancel-workflow-action@0.5.0 47 with: 48 access_token: ${{ github.token }} 49 50 - name: Checkout repository 51 uses: actions/checkout@v2 52 53 - name: Log debug information 54 run: | 55 echo "$GITHUB_REF" 56 echo "$GITHUB_EVENT_NAME" 57 npm --version 58 node --version 59 curl --version 60 git --version 61 svn --version 62 php --version 63 php -i 64 locale -a 65 66 - name: Install NodeJS 67 uses: actions/setup-node@v1 68 with: 69 node-version: 14 70 71 - name: Cache NodeJS modules 72 uses: actions/cache@v2 73 env: 74 cache-name: cache-node-modules 75 with: 76 # npm cache files are stored in `~/.npm` on Linux/macOS 77 path: ~/.npm 78 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 79 restore-keys: | 80 ${{ runner.os }}-npm- 81 82 - name: Install Dependencies 83 run: npx install-changed --install-command="npm ci" 84 85 - name: Build WordPress 86 run: npm run build 87 88 - name: Create ZIP artifact 89 uses: thedoctor0/zip-release@0.4.1 90 with: 91 filename: built-wp-${{ github.sha }}.zip 92 exclusions: '*.git* /*node_modules/* packagehash.txt' 93 94 - name: Upload build artifact 95 uses: actions/upload-artifact@v2 96 with: 97 name: built-wp-${{ github.sha }} 98 path: built-wp-${{ github.sha }}.zip 99 if-no-files-found: error 45 uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 100 46 101 47 # Runs the PHPUnit tests for WordPress. … … 104 50 # - Set environment variables. 105 51 # - Sets up the environment variables needed for testing with memcached (if desired). 106 # - Downloads the built WordPress artifact from the previous job.107 # - Unzips the artifact.108 52 # - Installs NodeJS 14. 109 53 # - Sets up caching for NPM. 110 # _ Installs NPM dependencies using install-changed to hash the `package.json` file.54 # - Installs NPM dependencies 111 55 # - Configures caching for Composer. 112 # _Installs Composer dependencies (if desired).56 # - Installs Composer dependencies (if desired). 113 57 # - Logs Docker debug information (about both the Docker installation within the runner). 114 58 # - Starts the WordPress Docker container. … … 125 69 # - todo: Configure Slack notifications for failing tests. 126 70 test-php: 127 name: ${{ matrix.php }}${{ matrix.m emcached && ' with memcached' || '' }} on ${{ matrix.os }}128 needs: setup-wor dpress71 name: ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.split_slow && ' slow tests' || '' }} ${{ matrix.memcached && ' with memcached' || '' }} on ${{ matrix.os }} 72 needs: setup-workflow 129 73 runs-on: ${{ matrix.os }} 130 74 strategy: 131 75 matrix: 132 php: [ ' 7.3', '7.2', '7.1', '7.0', '5.6' ]76 php: [ '5.6', '7.0', '7.1', '7.2', '7.3' ] 133 77 os: [ ubuntu-latest ] 134 78 memcached: [ false ] 79 split_slow: [ false ] 80 multisite: [ false, true ] 135 81 include: 136 # Include job for PHP 7.3 with memcached. 82 # Additional "slow" jobs for PHP 5.6. 83 - php: '5.6.20' 84 os: ubuntu-latest 85 memcached: false 86 multisite: false 87 split_slow: true 88 - php: '5.6.20' 89 os: ubuntu-latest 90 memcached: false 91 multisite: true 92 split_slow: true 93 # Include jobs for PHP 7.3 with memcached. 137 94 - php: '7.3' 138 95 os: ubuntu-latest 139 96 memcached: true 97 multisite: false 98 - php: '7.3' 99 os: ubuntu-latest 100 memcached: true 101 multisite: true 140 102 # Report the results of the PHP 7.3 without memcached job. 141 103 - php: '7.3' 142 104 os: ubuntu-latest 143 105 memcached: false 106 multisite: false 144 107 report: true 145 108 env: 146 109 LOCAL_PHP: ${{ matrix.php }}-fpm 147 110 LOCAL_PHP_MEMCACHED: ${{ matrix.memcached }} 111 PHPUNIT_CONFIG: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} 148 112 149 113 steps: … … 153 117 echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV 154 118 155 - name: Download the built WordPress artifact 156 uses: actions/download-artifact@v2 157 with: 158 name: built-wp-${{ github.sha }} 159 160 - name: Unzip built artifact 161 run: unzip built-wp-${{ github.sha }}.zip 119 - name: Checkout repository 120 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 162 121 163 122 - name: Install NodeJS 164 uses: actions/setup-node@ v1123 uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 165 124 with: 166 125 node-version: 14 167 126 168 127 - name: Use cached Node modules 169 uses: actions/cache@ v2128 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 170 129 env: 171 130 cache-name: cache-node-modules … … 174 133 path: ~/.npm 175 134 key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} 176 restore-keys: |177 ${{ runner.os }}-npm-178 135 179 136 - name: Install Dependencies 180 run: npx install-changed --install-command="npm ci" 137 run: npm ci 138 139 - name: Get composer cache directory 140 id: composer-cache 141 if: ${{ env.COMPOSER_INSTALL == true }} 142 run: echo "::set-output name=dir::$(composer config cache-files-dir)" 181 143 182 144 - name: Cache Composer dependencies 183 145 if: ${{ env.COMPOSER_INSTALL == true }} 184 uses: actions/cache@ v2146 uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 185 147 env: 186 148 cache-name: cache-composer-dependencies … … 188 150 path: ${{ steps.composer-cache.outputs.dir }} 189 151 key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} 190 restore-keys: |191 ${{ runner.os }}-php-${{ matrix.php }}-composer-192 152 193 153 - name: Install Composer dependencies … … 210 170 if: ${{ matrix.memcached }} 211 171 run: | 212 cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php172 cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php 213 173 docker run --name memcached --net $(basename "$PWD")_wpdevnet -d memcached 214 174 … … 235 195 run: npm run env:install 236 196 197 - name: Run slow PHPUnit tests 198 if: ${{ matrix.split_slow }} 199 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ${{ env.SLOW_TESTS }} 200 201 - name: Run PHPUnit tests for single site excluding slow tests 202 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && ! matrix.multisite }} 203 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-required 204 205 - name: Run PHPUnit tests for Multisite excluding slow tests 206 if: ${{ matrix.php < '7.0' && ! matrix.split_slow && matrix.multisite }} 207 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --exclude-group ${{ env.SLOW_TESTS }},ajax,ms-files,ms-excluded,oembed-headers 208 237 209 - name: Run PHPUnit tests 238 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist 210 if: ${{ matrix.php >= '7.0' }} 211 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} 239 212 240 213 - name: Run AJAX tests 241 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group ajax 214 if: ${{ ! matrix.split_slow && ! matrix.multisite }} 215 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c ${{ env.PHPUNIT_CONFIG }} --group ajax 242 216 243 217 - name: Run tests as a multisite install … … 245 219 246 220 - name: Run ms-files tests as a multisite install 221 if: ${{ matrix.multisite && ! matrix.split_slow }} 247 222 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c tests/phpunit/multisite.xml --group ms-files 248 223 249 224 - name: Run external HTTP tests 225 if: ${{ ! matrix.multisite && ! matrix.split_slow }} 250 226 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group external-http 251 252 - name: Run REST API tests253 run: npm run test:${{ env.PHPUNIT_SCRIPT }} -- --verbose -c phpunit.xml.dist --group restapi-jsclient254 227 255 228 - name: Checkout the WordPress Test Reporter 256 229 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }} 257 uses: actions/checkout@ v2230 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 258 231 with: 259 232 repository: 'WordPress/phpunit-test-runner' 260 233 path: 'test-runner' 261 262 - name: Set up the Git repository263 if: ${{ github.repository == 'WordPress/wordpress-develop' && github.ref == 'refs/heads/master' && matrix.report }}264 run: |265 git init266 git remote add origin https://github.com/WordPress/wordpress-develop.git267 git fetch268 git reset origin/master269 234 270 235 - name: Submit test results to the WordPress.org host test results -
branches/5.2/.github/workflows/welcome-new-contributors.yml
r50305 r50606 12 12 13 13 steps: 14 - uses: bubkoo/welcome-action@ v114 - uses: bubkoo/welcome-action@8dbbac2540d155744c90e4e37da6b05ffc9c5e2c # v1.0.3 15 15 with: 16 16 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -
branches/5.2/Gruntfile.js
r50191 r50606 7 7 var path = require('path'), 8 8 fs = require( 'fs' ), 9 glob = require( 'glob' ), 10 assert = require( 'assert' ).strict, 9 11 spawn = require( 'child_process' ).spawnSync, 10 12 SOURCE_DIR = 'src/', … … 487 489 'wp-admin/css/*.css', 488 490 'wp-includes/css/*.css', 491 492 // Exclude minified and already processed files, and files from external packages. 493 // These are present when running `grunt build` after `grunt --dev`. 494 '!wp-admin/css/*-rtl.css', 495 '!wp-includes/css/*-rtl.css', 496 '!wp-admin/css/*.min.css', 497 '!wp-includes/css/*.min.css', 498 '!wp-includes/css/dist', 489 499 490 500 // Exceptions … … 1363 1373 ] ); 1364 1374 1375 /** 1376 * Build verification tasks. 1377 */ 1378 grunt.registerTask( 'verify:build', [ 1379 'verify:wp-embed', 1380 'verify:old-files', 1381 'verify:source-maps', 1382 ] ); 1383 1384 /** 1385 * Build assertions for wp-embed.min.js. 1386 * 1387 * @ticket 34698 1388 */ 1389 grunt.registerTask( 'verify:wp-embed', function() { 1390 const file = `${ BUILD_DIR }/wp-includes/js/wp-embed.min.js`; 1391 1392 assert( 1393 fs.existsSync( file ), 1394 'The build/wp-includes/js/wp-embed.min.js file does not exist.' 1395 ); 1396 1397 const contents = fs.readFileSync( file, { 1398 encoding: 'utf8', 1399 } ); 1400 1401 assert( 1402 contents.length > 0, 1403 'The build/wp-includes/js/wp-embed.min.js file must not be empty.' 1404 ); 1405 assert( 1406 false === contents.includes( '&' ), 1407 'The build/wp-includes/js/wp-embed.min.js file must not contain ampersands.' 1408 ); 1409 } ); 1410 1411 /** 1412 * Build assertions to ensure no project files are inside `$_old_files` in the build directory. 1413 * 1414 * @ticket 36083 1415 */ 1416 grunt.registerTask( 'verify:old-files', function() { 1417 const file = `${ BUILD_DIR }wp-admin/includes/update-core.php`; 1418 1419 assert( 1420 fs.existsSync( file ), 1421 'The build/wp-admin/includes/update-core.php file does not exist.' 1422 ); 1423 1424 const contents = fs.readFileSync( file, { 1425 encoding: 'utf8', 1426 } ); 1427 1428 assert( 1429 contents.length > 0, 1430 'The build/wp-admin/includes/update-core.php file must not be empty.' 1431 ); 1432 1433 const match = contents.match( /\$_old_files = array\(([^\)]+)\);/ ); 1434 1435 assert( 1436 match.length > 0, 1437 'The build/wp-admin/includes/update-core.php file does not include an `$_old_files` array.' 1438 ); 1439 1440 const files = match[1].split( '\n\t' ).filter( function( file ) { 1441 // Filter out empty lines 1442 if ( '' === file ) { 1443 return false; 1444 } 1445 1446 // Filter out commented out lines 1447 if ( 0 === file.indexOf( '/' ) ) { 1448 return false; 1449 } 1450 1451 return true; 1452 } ).map( function( file ) { 1453 // Strip leading and trailing single quotes and commas 1454 return file.replace( /^\'|\',$/g, '' ); 1455 } ); 1456 1457 files.forEach(function( file ){ 1458 const search = `${ BUILD_DIR }${ file }`; 1459 assert( 1460 false === fs.existsSync( search ), 1461 `${ search } should not be present in the $_old_files array.` 1462 ); 1463 }); 1464 } ); 1465 1466 /** 1467 * Build assertions for the lack of source maps in JavaScript files. 1468 * 1469 * @ticket 24994 1470 * @ticket 46218 1471 */ 1472 grunt.registerTask( 'verify:source-maps', function() { 1473 const path = `${ BUILD_DIR }**/*.js`; 1474 const files = glob.sync( path ); 1475 1476 assert( 1477 files.length > 0, 1478 'No JavaScript files found in the build directory.' 1479 ); 1480 1481 files.forEach( function( file ) { 1482 const contents = fs.readFileSync( file, { 1483 encoding: 'utf8', 1484 } ); 1485 // `data:` URLs are allowed: 1486 const match = contents.match( /sourceMappingURL=((?!data:).)/ ); 1487 1488 assert( 1489 match === null, 1490 `The ${ file } file must not contain a sourceMappingURL.` 1491 ); 1492 } ); 1493 } ); 1494 1365 1495 grunt.registerTask( 'build', function() { 1366 1496 if ( grunt.option( 'dev' ) ) { … … 1376 1506 'includes:emoji', 1377 1507 'includes:embed', 1508 'verify:build' 1378 1509 ] ); 1379 1510 } -
branches/5.2/package-lock.json
r50191 r50606 74 74 }, 75 75 "@sideway/address": { 76 "version": "4.1. 0",77 "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1. 0.tgz",78 "integrity": "sha512- wAH/JYRXeIFQRsxerIuLjgUu2Xszam+O5xKeatJ4oudShOOirfmsQ1D6LL54XOU2tizpCYku+s1wmU0SYdpoSA==",76 "version": "4.1.1", 77 "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.1.tgz", 78 "integrity": "sha512-+I5aaQr3m0OAmMr7RQ3fR9zx55sejEYR2BFJaxL+zT3VM2611X0SHvPWIbAUBZVTn/YzYKbV8gJ2oT/QELknfQ==", 79 79 "dev": true, 80 80 "requires": { … … 2907 2907 }, 2908 2908 "check-node-version": { 2909 "version": "4. 0.3",2910 "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-4. 0.3.tgz",2911 "integrity": "sha512- kbnOaF7SE1uasWx3hqxzsU2yz7I+rkxSMuTW0eKoF39eUtSR/a0F4Sm35LwJNx4itOIARf9eLhWHOOh7rlZ5/g==",2909 "version": "4.1.0", 2910 "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-4.1.0.tgz", 2911 "integrity": "sha512-TSXGsyfW5/xY2QseuJn8/hleO2AU7HxVCdkc900jp1vcfzF840GkjvRT7CHl8sRtWn23n3X3k0cwH9RXeRwhfw==", 2912 2912 "dev": true, 2913 2913 "requires": { … … 3163 3163 }, 3164 3164 "clean-css": { 3165 "version": " 4.2.1",3166 "resolved": "https://registry.npmjs.org/clean-css/-/clean-css- 4.2.1.tgz",3167 "integrity": "sha512- 4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g==",3165 "version": "5.1.2", 3166 "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.1.2.tgz", 3167 "integrity": "sha512-QcaGg9OuMo+0Ds933yLOY+gHPWbxhxqF0HDexmToPf8pczvmvZGYzd+QqWp9/mkucAOKViI+dSFOqoZIvXbeBw==", 3168 3168 "dev": true, 3169 3169 "requires": { … … 6143 6143 }, 6144 6144 "grunt-contrib-cssmin": { 6145 "version": " 3.0.0",6146 "resolved": "https://registry.npmjs.org/grunt-contrib-cssmin/-/grunt-contrib-cssmin- 3.0.0.tgz",6147 "integrity": "sha512- eXpooYmVGKMs/xV7DzTLgJFPVOfMuawPD3x0JwhlH0mumq2NtH3xsxaHxp1Y3NKxp0j0tRhFS6kSBRsz6TuTGg==",6148 "dev": true, 6149 "requires": { 6150 "chalk": "^ 2.4.1",6151 "clean-css": " ~4.2.1",6152 "maxmin": "^ 2.1.0"6145 "version": "4.0.0", 6146 "resolved": "https://registry.npmjs.org/grunt-contrib-cssmin/-/grunt-contrib-cssmin-4.0.0.tgz", 6147 "integrity": "sha512-jXU+Zlk8Q8XztOGNGpjYlD/BDQ0n95IHKrQKtFR7Gd8hZrzgqiG1Ra7cGYc8h2DD9vkSFGNlweb9Q00rBxOK2w==", 6148 "dev": true, 6149 "requires": { 6150 "chalk": "^4.1.0", 6151 "clean-css": "^5.0.1", 6152 "maxmin": "^3.0.0" 6153 6153 }, 6154 6154 "dependencies": { 6155 6155 "ansi-styles": { 6156 "version": " 3.2.1",6157 "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles- 3.2.1.tgz",6158 "integrity": "sha512- VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",6159 "dev": true, 6160 "requires": { 6161 "color-convert": "^ 1.9.0"6156 "version": "4.3.0", 6157 "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 6158 "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 6159 "dev": true, 6160 "requires": { 6161 "color-convert": "^2.0.1" 6162 6162 } 6163 6163 }, 6164 6164 "chalk": { 6165 "version": "2.4.1", 6166 "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", 6167 "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", 6168 "dev": true, 6169 "requires": { 6170 "ansi-styles": "^3.2.1", 6171 "escape-string-regexp": "^1.0.5", 6172 "supports-color": "^5.3.0" 6165 "version": "4.1.0", 6166 "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", 6167 "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", 6168 "dev": true, 6169 "requires": { 6170 "ansi-styles": "^4.1.0", 6171 "supports-color": "^7.1.0" 6172 } 6173 }, 6174 "color-convert": { 6175 "version": "2.0.1", 6176 "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 6177 "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 6178 "dev": true, 6179 "requires": { 6180 "color-name": "~1.1.4" 6181 } 6182 }, 6183 "color-name": { 6184 "version": "1.1.4", 6185 "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 6186 "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 6187 "dev": true 6188 }, 6189 "figures": { 6190 "version": "3.2.0", 6191 "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", 6192 "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", 6193 "dev": true, 6194 "requires": { 6195 "escape-string-regexp": "^1.0.5" 6196 } 6197 }, 6198 "gzip-size": { 6199 "version": "5.1.1", 6200 "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-5.1.1.tgz", 6201 "integrity": "sha512-FNHi6mmoHvs1mxZAds4PpdCS6QG8B4C1krxJsMutgxl5t3+GlRTzzI3NEkifXx2pVsOvJdOGSmIgDhQ55FwdPA==", 6202 "dev": true, 6203 "requires": { 6204 "duplexer": "^0.1.1", 6205 "pify": "^4.0.1" 6206 } 6207 }, 6208 "has-flag": { 6209 "version": "4.0.0", 6210 "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 6211 "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 6212 "dev": true 6213 }, 6214 "maxmin": { 6215 "version": "3.0.0", 6216 "resolved": "https://registry.npmjs.org/maxmin/-/maxmin-3.0.0.tgz", 6217 "integrity": "sha512-wcahMInmGtg/7c6a75fr21Ch/Ks1Tb+Jtoan5Ft4bAI0ZvJqyOw8kkM7e7p8hDSzY805vmxwHT50KcjGwKyJ0g==", 6218 "dev": true, 6219 "requires": { 6220 "chalk": "^4.1.0", 6221 "figures": "^3.2.0", 6222 "gzip-size": "^5.1.1", 6223 "pretty-bytes": "^5.3.0" 6224 } 6225 }, 6226 "supports-color": { 6227 "version": "7.2.0", 6228 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 6229 "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 6230 "dev": true, 6231 "requires": { 6232 "has-flag": "^4.0.0" 6173 6233 } 6174 6234 } … … 7958 8018 }, 7959 8019 "joi": { 7960 "version": "17. 3.0",7961 "resolved": "https://registry.npmjs.org/joi/-/joi-17. 3.0.tgz",7962 "integrity": "sha512- Qh5gdU6niuYbUIUV5ejbsMiiFmBdw8Kcp8Buj2JntszCkCfxJ9Cz76OtHxOZMPXrt5810iDIXs+n1nNVoquHgg==",8020 "version": "17.4.0", 8021 "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.0.tgz", 8022 "integrity": "sha512-F4WiW2xaV6wc1jxete70Rw4V/VuMd6IN+a5ilZsxG4uYtUXWu2kq9W5P2dz30e7Gmw8RCbY/u/uk+dMPma9tAg==", 7963 8023 "dev": true, 7964 8024 "requires": { … … 11245 11305 "dev": true 11246 11306 }, 11307 "queue-microtask": { 11308 "version": "1.2.3", 11309 "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", 11310 "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", 11311 "dev": true 11312 }, 11247 11313 "randombytes": { 11248 11314 "version": "2.1.0", … … 12024 12090 }, 12025 12091 "run-parallel": { 12026 "version": "1.1.10", 12027 "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz", 12028 "integrity": "sha512-zb/1OuZ6flOlH6tQyMPUrE3x3Ulxjlo9WIVXR4yVYi4H9UXQaeIsPbLn2R3O3vQCnDKkAl2qHiuocKKX4Tz/Sw==", 12029 "dev": true 12092 "version": "1.2.0", 12093 "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", 12094 "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", 12095 "dev": true, 12096 "requires": { 12097 "queue-microtask": "^1.2.2" 12098 } 12030 12099 }, 12031 12100 "run-queue": { … … 12170 12239 }, 12171 12240 "sass": { 12172 "version": "1.32. 6",12173 "resolved": "https://registry.npmjs.org/sass/-/sass-1.32. 6.tgz",12174 "integrity": "sha512- 1bcDHDcSqeFtMr0JXI3xc/CXX6c4p0wHHivJdru8W7waM7a1WjKMm4m/Z5sY7CbVw4Whi2Chpcw6DFfSWwGLzQ==",12241 "version": "1.32.8", 12242 "resolved": "https://registry.npmjs.org/sass/-/sass-1.32.8.tgz", 12243 "integrity": "sha512-Sl6mIeGpzjIUZqvKnKETfMf0iDAswD9TNlv13A7aAF3XZlRPMq4VvJWBC2N2DXbp94MQVdNSFG6LfF/iOXrPHQ==", 12175 12244 "dev": true, 12176 12245 "requires": { … … 14136 14205 }, 14137 14206 "uglify-js": { 14138 "version": "3.1 2.6",14139 "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.1 2.6.tgz",14140 "integrity": "sha512- aqWHe3DfQmZUDGWBbabZ2eQnJlQd1fKlMUu7gV+MiTuDzdgDw31bI3wA2jLLsV/hNcDP26IfyEgSVoft5+0SVw==",14207 "version": "3.13.2", 14208 "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.2.tgz", 14209 "integrity": "sha512-SbMu4D2Vo95LMC/MetNaso1194M1htEA+JrqE9Hk+G2DhI+itfS9TRu9ZKeCahLDNa/J3n4MqUJ/fOHMzQpRWw==", 14141 14210 "dev": true 14142 14211 }, … … 14670 14739 }, 14671 14740 "wait-on": { 14672 "version": "5. 2.1",14673 "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-5. 2.1.tgz",14674 "integrity": "sha512- H2F986kNWMU9hKlI9l/ppO6tN8ZSJd35yBljMLa1/vjzWP++Qh6aXyt77/u7ySJFZQqBtQxnvm/xgG48AObXcw==",14741 "version": "5.3.0", 14742 "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-5.3.0.tgz", 14743 "integrity": "sha512-DwrHrnTK+/0QFaB9a8Ol5Lna3k7WvUR4jzSKmz0YaPBpuN2sACyiPVKVfj6ejnjcajAcvn3wlbTyMIn9AZouOg==", 14675 14744 "dev": true, 14676 14745 "requires": { 14677 14746 "axios": "^0.21.1", 14678 14747 "joi": "^17.3.0", 14679 "lodash": "^4.17.2 0",14748 "lodash": "^4.17.21", 14680 14749 "minimist": "^1.2.5", 14681 14750 "rxjs": "^6.6.3" … … 14683 14752 "dependencies": { 14684 14753 "lodash": { 14685 "version": "4.17.2 0",14686 "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.2 0.tgz",14687 "integrity": "sha512- PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==",14754 "version": "4.17.21", 14755 "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 14756 "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", 14688 14757 "dev": true 14689 14758 }, 14690 14759 "rxjs": { 14691 "version": "6.6. 3",14692 "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6. 3.tgz",14693 "integrity": "sha512- trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==",14760 "version": "6.6.6", 14761 "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.6.tgz", 14762 "integrity": "sha512-/oTwee4N4iWzAMAL9xdGKjkEHmIwupR3oXbQjCKywF1BeFohswF3vZdogbmEF6pZkOsXTzWkrZszrWpQTByYVg==", 14694 14763 "dev": true, 14695 14764 "requires": { -
branches/5.2/package.json
r50191 r50606 29 29 "@wordpress/library-export-default-webpack-plugin": "1.1.0", 30 30 "autoprefixer": "^9.8.6", 31 "check-node-version": "4. 0.3",31 "check-node-version": "4.1.0", 32 32 "copy-webpack-plugin": "^5.1.2", 33 33 "cssnano": "4.1.10", … … 39 39 "grunt-contrib-concat": "~1.0.0", 40 40 "grunt-contrib-copy": "~1.0.0", 41 "grunt-contrib-cssmin": "~ 3.0.0",41 "grunt-contrib-cssmin": "~4.0.0", 42 42 "grunt-contrib-imagemin": "~4.0.0", 43 43 "grunt-contrib-jshint": "3.0.0", … … 59 59 "jquery-migrate": "1.4.1", 60 60 "matchdep": "~2.0.0", 61 "sass": "^1.32. 6",61 "sass": "^1.32.8", 62 62 "source-map-loader": "^1.1.3", 63 "uglify-js": "^3.1 2.6",63 "uglify-js": "^3.13.2", 64 64 "uglifyjs-webpack-plugin": "2.2.0", 65 "wait-on": "^5. 2.1",65 "wait-on": "^5.3.0", 66 66 "webpack": "4.43.0", 67 67 "webpack-dev-server": "3.11.2", -
branches/5.2/tests/phpunit/includes/abstract-testcase.php
r50093 r50606 1232 1232 ); 1233 1233 } 1234 1235 /** 1236 * Touches the given file and its directory if it doesn't already exist. 1237 * 1238 * This can be used to ensure a file that is implictly relied on in a test exists 1239 * without it having to be built. 1240 * 1241 * @param string $file The file name. 1242 */ 1243 public static function touch( $file ) { 1244 if ( file_exists( $file ) ) { 1245 return; 1246 } 1247 1248 $dir = dirname( $file ); 1249 1250 if ( ! file_exists( $dir ) ) { 1251 mkdir( $dir, 0777, true ); 1252 } 1253 1254 touch( $file ); 1255 } 1234 1256 } -
branches/5.2/tests/phpunit/tests/admin/includesPlugin.php
r42343 r50606 5 5 */ 6 6 class Tests_Admin_includesPlugin extends WP_UnitTestCase { 7 public static function wpSetUpBeforeClass( $factory ) { 8 self::_back_up_mu_plugins(); 9 } 10 11 public static function wpTearDownAfterClass() { 12 self::_restore_mu_plugins(); 13 } 14 7 15 function test_get_plugin_data() { 8 16 $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' ); … … 111 119 'list_files_test_plugin/subdir/subfile.php', 112 120 ); 113 $this->assertEquals( $expected, $plugin_files );114 121 115 122 unlink( $sub_dir . '/subfile.php' ); … … 117 124 rmdir( $sub_dir ); 118 125 rmdir( $plugin_dir ); 126 127 $this->assertSame( $expected, $plugin_files ); 119 128 } 120 129 … … 123 132 */ 124 133 public function test_get_mu_plugins_when_mu_plugins_exists_but_is_empty() { 125 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 126 $exists = true; 127 $this->_back_up_mu_plugins(); 128 } else { 129 $exists = false; 130 mkdir( WPMU_PLUGIN_DIR ); 131 } 132 133 $this->assertEquals( array(), get_mu_plugins() ); 134 135 // Clean up. 136 if ( $exists ) { 137 $this->_restore_mu_plugins(); 138 } else { 139 rmdir( WPMU_PLUGIN_DIR ); 140 } 134 mkdir( WPMU_PLUGIN_DIR ); 135 136 $mu_plugins = get_mu_plugins(); 137 138 rmdir( WPMU_PLUGIN_DIR ); 139 140 $this->assertSame( array(), $mu_plugins ); 141 141 } 142 142 … … 145 145 */ 146 146 public function test_get_mu_plugins_when_mu_plugins_directory_does_not_exist() { 147 $exists = false; 148 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 149 $exists = true; 150 $this->_back_up_mu_plugins(); 151 rmdir( WPMU_PLUGIN_DIR ); 152 } 153 154 $this->assertEquals( array(), get_mu_plugins() ); 155 156 // Clean up. 157 if ( $exists ) { 158 mkdir( WPMU_PLUGIN_DIR ); 159 $this->_restore_mu_plugins(); 160 } 147 $this->assertFileNotExists( WPMU_PLUGIN_DIR ); 148 $this->assertSame( array(), get_mu_plugins() ); 161 149 } 162 150 … … 165 153 */ 166 154 public function test_get_mu_plugins_should_ignore_index_php_containing_silence_is_golden() { 167 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 168 $exists = true; 169 $this->_back_up_mu_plugins(); 170 } else { 171 $exists = false; 172 mkdir( WPMU_PLUGIN_DIR ); 173 } 155 mkdir( WPMU_PLUGIN_DIR ); 174 156 175 157 $this->_create_plugin( '<?php\n//Silence is golden.', 'index.php', WPMU_PLUGIN_DIR ); 176 $this->assertEquals( array(), get_mu_plugins() ); 158 159 $mu_plugins = get_mu_plugins(); 160 161 unlink( WPMU_PLUGIN_DIR . '/index.php' ); 162 rmdir( WPMU_PLUGIN_DIR ); 163 164 $this->assertSame( array(), $mu_plugins ); 165 } 166 167 /** 168 * @covers ::get_mu_plugins 169 */ 170 public function test_get_mu_plugins_should_not_ignore_index_php_containing_something_other_than_silence_is_golden() { 171 mkdir( WPMU_PLUGIN_DIR ); 172 173 $this->_create_plugin( '<?php\n//Silence is not golden.', 'index.php', WPMU_PLUGIN_DIR ); 174 $found = get_mu_plugins(); 177 175 178 176 // Clean up. 179 177 unlink( WPMU_PLUGIN_DIR . '/index.php' ); 180 if ( $exists ) { 181 $this->_restore_mu_plugins(); 182 } else { 183 rmdir( WPMU_PLUGIN_DIR ); 184 } 178 rmdir( WPMU_PLUGIN_DIR ); 179 180 $this->assertSame( array( 'index.php' ), array_keys( $found ) ); 185 181 } 186 182 … … 188 184 * @covers ::get_mu_plugins 189 185 */ 190 public function test_get_mu_plugins_should_not_ignore_index_php_containing_something_other_than_silence_is_golden() {191 if ( is_dir( WPMU_PLUGIN_DIR ) ) {192 $exists = true;193 $this->_back_up_mu_plugins();194 } else {195 $exists = false;196 mkdir( WPMU_PLUGIN_DIR );197 }198 199 $this->_create_plugin( '<?php\n//Silence is not golden.', 'index.php', WPMU_PLUGIN_DIR );200 $found = get_mu_plugins();201 $this->assertEquals( array( 'index.php' ), array_keys( $found ) );202 203 // Clean up.204 unlink( WPMU_PLUGIN_DIR . '/index.php' );205 if ( $exists ) {206 $this->_restore_mu_plugins();207 } else {208 rmdir( WPMU_PLUGIN_DIR );209 }210 }211 212 /**213 * @covers ::get_mu_plugins214 */215 186 public function test_get_mu_plugins_should_ignore_files_without_php_extensions() { 216 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 217 $exists = true; 218 $this->_back_up_mu_plugins(); 219 } else { 220 $exists = false; 221 mkdir( WPMU_PLUGIN_DIR ); 222 } 187 mkdir( WPMU_PLUGIN_DIR ); 223 188 224 189 $this->_create_plugin( '<?php\n//Test', 'foo.php', WPMU_PLUGIN_DIR ); 225 190 $this->_create_plugin( '<?php\n//Test 2', 'bar.txt', WPMU_PLUGIN_DIR ); 226 191 $found = get_mu_plugins(); 227 $this->assertEquals( array( 'foo.php' ), array_keys( $found ) );228 192 229 193 // Clean up. 230 194 unlink( WPMU_PLUGIN_DIR . '/foo.php' ); 231 195 unlink( WPMU_PLUGIN_DIR . '/bar.txt' ); 232 if ( $exists ) { 233 $this->_restore_mu_plugins(); 234 } else { 235 rmdir( WPMU_PLUGIN_DIR ); 236 } 196 197 $this->assertSame( array( 'foo.php' ), array_keys( $found ) ); 237 198 } 238 199 … … 393 354 394 355 /** 395 * Move existing mu-plugins to wp-content/mu-plugin /backup.356 * Move existing mu-plugins to wp-content/mu-plugin-backup. 396 357 * 397 358 * @since 4.2.0 … … 399 360 * @access private 400 361 */ 401 private function _back_up_mu_plugins() {362 private static function _back_up_mu_plugins() { 402 363 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 403 364 $mu_bu_dir = WP_CONTENT_DIR . '/mu-plugin-backup'; 404 if ( ! is_dir( $mu_bu_dir ) ) { 405 mkdir( $mu_bu_dir ); 406 } 407 408 $files_to_move = array(); 409 if ( $mu_plugins = opendir( WPMU_PLUGIN_DIR ) ) { 410 while ( false !== $plugin = readdir( $mu_plugins ) ) { 411 if ( 0 !== strpos( $plugin, '.' ) ) { 412 $files_to_move[] = $plugin; 413 } 414 } 415 } 416 417 @closedir( $mu_plugins ); 418 419 foreach ( $files_to_move as $file_to_move ) { 420 $f = rename( WPMU_PLUGIN_DIR . '/' . $file_to_move, $mu_bu_dir . '/' . $file_to_move ); 421 } 365 rename( WPMU_PLUGIN_DIR, $mu_bu_dir ); 422 366 } 423 367 } … … 430 374 * @access private 431 375 */ 432 private function _restore_mu_plugins() { 433 $mu_bu_dir = WP_CONTENT_DIR . '/mu-plugin-backup'; 434 $files_to_move = array(); 435 if ( is_dir( $mu_bu_dir ) && $mu_plugins = opendir( $mu_bu_dir ) ) { 436 while ( false !== $plugin = readdir( $mu_plugins ) ) { 437 if ( 0 !== strpos( $plugin, '.' ) ) { 438 $files_to_move[] = $plugin; 439 } 440 } 441 } 442 443 @closedir( $mu_plugins ); 444 445 foreach ( $files_to_move as $file_to_move ) { 446 rename( $mu_bu_dir . '/' . $file_to_move, WPMU_PLUGIN_DIR . '/' . $file_to_move ); 376 private static function _restore_mu_plugins() { 377 $mu_bu_dir = WP_CONTENT_DIR . '/mu-plugin-backup'; 378 379 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 380 rmdir( WPMU_PLUGIN_DIR ); 447 381 } 448 382 449 383 if ( is_dir( $mu_bu_dir ) ) { 450 r mdir( $mu_bu_dir);384 rename( $mu_bu_dir, WPMU_PLUGIN_DIR ); 451 385 } 452 386 } -
branches/5.2/tests/phpunit/tests/dependencies/jquery.php
r44740 r50606 29 29 $this->assertEquals( $jquery_scripts[ $dep ], $o->src ); 30 30 } 31 }32 33 function test_presence_of_jquery_no_conflict() {34 $contents = trim( file_get_contents( ABSPATH . WPINC . '/js/jquery/jquery.js' ) );35 $noconflict = 'jQuery.noConflict();';36 $end = substr( $contents, - strlen( $noconflict ) );37 $this->assertEquals( $noconflict, $end );38 31 } 39 32 -
branches/5.2/tests/phpunit/tests/dependencies/scripts.php
r45989 r50606 1342 1342 ); 1343 1343 } 1344 1345 function test_no_source_mapping() {1346 $all_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( dirname( ABSPATH ) . '/build/' ) );1347 $js_files = new RegexIterator( $all_files, '/\.js$/' );1348 foreach ( $js_files as $js_file ) {1349 $contents = trim( file_get_contents( $js_file ) );1350 1351 // We allow data: URLs.1352 $found = preg_match( '/sourceMappingURL=((?!data:).)/', $contents );1353 $this->assertSame( $found, 0, "sourceMappingURL found in $js_file" );1354 }1355 }1356 1344 } -
branches/5.2/tests/phpunit/tests/formatting/Emoji.php
r45134 r50606 14 14 */ 15 15 public function test_unfiltered_emoji_cdns() { 16 // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present: 17 self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' ); 16 18 $output = get_echo( '_print_emoji_detection_script' ); 17 19 … … 32 34 add_filter( 'emoji_svg_url', array( $this, '_filtered_emoji_svn_cdn' ) ); 33 35 36 // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present: 37 self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' ); 34 38 $output = get_echo( '_print_emoji_detection_script' ); 35 39 … … 53 57 add_filter( 'emoji_url', array( $this, '_filtered_emoji_png_cdn' ) ); 54 58 59 // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present: 60 self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' ); 55 61 $output = get_echo( '_print_emoji_detection_script' ); 56 62 -
branches/5.2/tests/phpunit/tests/oembed/controller.php
r44155 r50606 35 35 ) 36 36 ); 37 38 // `get_post_embed_html()` assumes `wp-includes/js/wp-embed.js` is present: 39 self::touch( ABSPATH . WPINC . '/js/wp-embed.js' ); 37 40 } 38 41 -
branches/5.2/tests/phpunit/tests/oembed/getResponseData.php
r43571 r50606 5 5 */ 6 6 class Tests_oEmbed_Response_Data extends WP_UnitTestCase { 7 public function setUp() { 8 parent::setUp(); 9 10 // `get_post_embed_html()` assumes `wp-includes/js/wp-embed.js` is present: 11 self::touch( ABSPATH . WPINC . '/js/wp-embed.js' ); 12 } 13 7 14 function test_get_oembed_response_data_non_existent_post() { 8 15 $this->assertFalse( get_oembed_response_data( 0, 100 ) ); -
branches/5.2/tests/phpunit/tests/oembed/template.php
r43571 r50606 23 23 24 24 $this->assertQueryTrue( 'is_single', 'is_singular', 'is_embed' ); 25 26 // `print_embed_scripts()` assumes `wp-includes/js/wp-embed-template.js` is present: 27 self::touch( ABSPATH . WPINC . '/js/wp-embed-template.js' ); 25 28 26 29 ob_start(); … … 291 294 292 295 /** 296 * Confirms that no ampersands exist in src/wp-includes/js/wp-embed.js. 297 * 298 * See also the `verify:wp-embed` Grunt task for verifying the built file. 299 * 293 300 * @ticket 34698 294 301 */ … … 296 303 $this->assertNotContains( '&', file_get_contents( ABSPATH . WPINC . '/js/wp-embed.js' ) ); 297 304 } 298 299 /**300 * @ticket 34698301 *302 * @depends test_js_no_ampersands303 *304 * The previous test confirms that no ampersands exist in src/wp-includes/js/wp-embed.js.305 * However, we must also confirm that UglifyJS does not add ampersands during its306 * optimizations (which we tweak to avoid, but indirectly -- understandably, there's307 * no "don't add ampersands to my JavaScript file" option).308 *309 * So this test checks for ampersands in build/wp-includes/js/wp-embed.min.js.310 * In many cases, this file will not exist; in those cases, we simply skip the test.311 *312 * So when would it be run? We have Travis CI run `grunt test` which then runs, in order,313 * `qunit:compiled` (which runs the build) and then `phpunit`. Thus, this test will at least be314 * run during continuous integration.315 *316 * However, we need to verify that `qunit:compiled` runs before `phpunit`. So this test also317 * does a cheap check for a registered Grunt task called `test` that contains both318 * `qunit:compiled` and `phpunit`, in that order.319 *320 * One final failsafe: The Gruntfile.js assertion takes place before checking for the existence321 * of wp-embed.min.js. If the Grunt tasks are significantly refactored later, it could indicate322 * that wp-embed.min.js doesn't exist anymore. We wouldn't want the test to silently become one323 * that is always skipped, and thus useless.324 */325 function test_js_no_ampersands_in_compiled() {326 $gruntfile = file_get_contents( dirname( ABSPATH ) . '/Gruntfile.js' );327 328 // Confirm this file *should* exist, otherwise this test will always be skipped.329 $test = '/grunt.registerTask\(\s*\'test\',.*\'qunit:compiled\'.*\'phpunit\'/';330 $this->assertTrue( (bool) preg_match( $test, $gruntfile ) );331 332 $file = dirname( ABSPATH ) . '/build/' . WPINC . '/js/wp-embed.min.js';333 if ( ! file_exists( $file ) ) {334 return;335 }336 $this->assertNotContains( '&', file_get_contents( $file ) );337 }338 339 305 } -
branches/5.2/tests/phpunit/tests/oembed/wpOembed.php
r42343 r50606 19 19 20 20 $this->pre_oembed_result_filtered = false; 21 22 // `get_post_embed_html()` assumes `wp-includes/js/wp-embed.js` is present: 23 self::touch( ABSPATH . WPINC . '/js/wp-embed.js' ); 21 24 } 22 25 -
branches/5.2/tests/phpunit/tests/shortcode.php
r44569 r50606 746 746 function test_php_and_js_shortcode_attribute_regexes_match() { 747 747 748 $file = file_get_contents( ABSPATH . WPINC . '/js/shortcode.js' );748 $file = file_get_contents( ABSPATH . 'js/_enqueues/wp/shortcode.js' ); 749 749 $matched = preg_match( '|\s+pattern = (\/.+\/)g;|', $file, $matches ); 750 750 $php = get_shortcode_atts_regex(); -
branches/5.2/wp-tests-config-sample.php
r44512 r50606 2 2 3 3 /* Path to the WordPress codebase you'd like to test. Add a forward slash in the end. */ 4 if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS ) { 5 define( 'ABSPATH', dirname( __FILE__ ) . '/build/' ); 6 } else { 7 define( 'ABSPATH', dirname( __FILE__ ) . '/src/' ); 8 } 4 define( 'ABSPATH', dirname( __FILE__ ) . '/src/' ); 9 5 10 6 /*
Note: See TracChangeset
for help on using the changeset viewer.