Commit Graph

100 Commits

Author SHA1 Message Date
Jonathan Desrosiers
c812f63015 Build/Test Tools: Allow the desired version of PHPUnit to be passed to the local Docker environment.
This reintroduces [49358] with a modification to the `.travis.yml` file to avoid an issue with `dotenv-expand` being unable to expand variables into `process.env` only on Travis.

The `LOCAL_PHPUNIT` environment variabl allows the desired version of PHPUnit to be specified when running the PHP tests within the local Docker environment.

Because support for newer versions of PHPUnit is not backported, some versions of PHP need the ability to run multiple versions of PHPUnit for different branches. This adds the flexibility needed to use the Docker environment within those older branches to run the PHP tests.

Props johnbillion, SergeyBiryukov.
See #50042.

git-svn-id: https://develop.svn.wordpress.org/trunk@49362 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-28 23:15:07 +00:00
Jonathan Desrosiers
0d313839e6 Build/Test Tools: Ensure arguments are passed correctly for test:php-composer commands.
Follow-up to [49099].

Props swissspidy.
See #51456.

git-svn-id: https://develop.svn.wordpress.org/trunk@49100 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-07 13:19:33 +00:00
Jonathan Desrosiers
683ecf8c6a Build/Test Tools: Add NPM script for using the Composer installed version of PHPUnit.
The `test:php` NPM script runs the PHP test suite using the system installed version of PHPUnit. In some cases, the version of PHPUnit installed through Composer may be preferred.

Currently, this is true when running the test suite using PHP 8. In order to add support for PHP 8 while maintaining compatibility for PHP 5.6.20, PHPUnit 7.x must be used. But, some modifications are required to be compatible with PHP 8 (see [49037], [48957]).

This change introduces the `test:php-composer` NPM script, which will run the test suite using the composer installed version.

Props desrosj, SergeyBiryukov.
Fixes #51456.

git-svn-id: https://develop.svn.wordpress.org/trunk@49099 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-07 13:08:20 +00:00
Sergey Biryukov
19513ff6a0 Build/Test Tools: Remove PHP 8 from allowed failures.
With all known unit test issues now addressed, WordPress 5.6 aims to support PHP 8 as much as possible.

See #50913, #50902.

git-svn-id: https://develop.svn.wordpress.org/trunk@49077 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 16:03:03 +00:00
Sergey Biryukov
8ae4a7614c Build/Test Tools: Comment out the xdebug group test run for PHP 8 for now.
Xdebug supports PHP 8 only from version 3.0, which is not released yet.

Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again.

Follow-up to [48957], [49037].

See #50913, #50902.

git-svn-id: https://develop.svn.wordpress.org/trunk@49074 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-30 13:12:03 +00:00
Sergey Biryukov
185ad1e116 Build/Test Tools: Use trunk revision 2387243 of the WordPress Importer plugin.
This revision includes a change to only call `libxml_disable_entity_loader()` in PHP < 8, in order for unit tests in the `import` group to pass on PHP 8.

This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading is disabled by default, so this function is no longer needed to protect against XXE attacks.

Follow-up to [46542], [48789].

Props jrf.
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49039 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-23 18:37:09 +00:00
Sergey Biryukov
92bf360a03 Build/Test Tools: Allow unit tests to run on PHP 8 in full.
PHP 8 introduces a new control structure called `match`, which makes `match` a reserved keyword in PHP 8.

One of the PHPUnit dependencies declares a class named `Match`, which triggered a fatal error before PHPUnit could even start.

To be able to use PHPUnit 7.x on PHP 8 and run the tests, core needs a new version of that dependency, which is now installed using Composer.

This is the simplest way to get things working again and start addressing the individual test failures.

Additionally, various test runs on PHP 8 on Travis are now performed individually instead of being chained, so that failures outside of WP scope don't block further execution.

Props jrf, jorbin, pento.
See #50902.

git-svn-id: https://develop.svn.wordpress.org/trunk@48957 602fd350-edb4-49c9-b593-d223f7449a82
2020-09-07 19:21:26 +00:00
Sergey Biryukov
d8c91ce45f Tests: Download Chromium for e2e and JS tests only.
This reduces the chance of random failures due to network timeouts and avoids the overhead of unnecessarily downloading ~120 MB for PHP tests.

Follow-up to [47449], [47459], [47867], [48177].

Fixes #50649.

git-svn-id: https://develop.svn.wordpress.org/trunk@48458 602fd350-edb4-49c9-b593-d223f7449a82
2020-07-13 15:18:49 +00:00
Ella van Durpe
24465974cd Editor: update JavaScript packages
Also update default block categories

Props youknowriad, gziolo, aduth.
Fixes #50420, #50278.



git-svn-id: https://develop.svn.wordpress.org/trunk@48177 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-26 13:31:11 +00:00
Jonathan Desrosiers
69c92a64aa Coding Standards: Remove the PHP Compatibility scanning job from the allowed_failures list.
All pre-existing compatibility warnings and errors as flagged by the PHPCompatibilityWP ruleset have been addressed.

Fixes #49922.

git-svn-id: https://develop.svn.wordpress.org/trunk@48046 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-15 15:02:32 +00:00
Jonathan Desrosiers
bfcd6e0750 Build/Test Tools: Revert [47901].
This is not matching branches as desired.

Unrops desrosj, jorbin, ocean90, TimothyBlynJacobs.
Fixes #50307.

git-svn-id: https://develop.svn.wordpress.org/trunk@47905 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-03 21:12:01 +00:00
Jonathan Desrosiers
2da8918f1a Build/Test Tools: Disable Travis CI build Slack notifications for non-official branches.
When branches are unintentionally pushed to the GitHub `wordpress-develop` mirror by committers, a build is triggered in Travis and the result is reported in Slack if the criteria defined is met.

Though this is not the desired workflow (any modifications made to the mirror are erased when the repository is synced from SVN), this can cause a lot of noise if several pushes are made and raise false alarms.

This change limits builds only to the `master` branch, and branches meeting the `X.X` pattern to match each branched version.

Props desrosj, jorbin, ocean90, TimothyBlynJacobs.
Fixes #50307.

git-svn-id: https://develop.svn.wordpress.org/trunk@47901 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-03 17:01:14 +00:00
Dominik Schilling
44d25453b6 Build/Test Tools: Improve Travis config to pass config validation.
* Add missing `os` and `dist` with the current default values.
* Replace the alias `matrix` with `jobs`.
* Remove unsupported `on_start` for `notifications.slack`.

Fixes #50296.

git-svn-id: https://develop.svn.wordpress.org/trunk@47877 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 16:37:03 +00:00
Jake Spurlock
5c184116bf Build/Test Tools: Bump devDependencies for WordPress 5.5
There are several other changes that need to be made for the security audit, this is just the first pass.

Fixes #49768.
Props SergeyBiryukov, whyisjake.


git-svn-id: https://develop.svn.wordpress.org/trunk@47867 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-30 04:54:28 +00:00
John Blackbourn
09e61958b3 Build/Test Tools: Remove unnecessary formatting before linting on Travis CI.
Fixes #49722

git-svn-id: https://develop.svn.wordpress.org/trunk@47741 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-02 17:44:11 +00:00
Mike Schroder
3df79c3380 Tests: Pass API key to distributed test reporter.
Pass environment variable for test reporter API key to
`docker-compose` so that it can authenticate and submit results
to the hosting distributed tests.

Props SergeyBiryukov, mikeschroder.
Fixes #49846.

git-svn-id: https://develop.svn.wordpress.org/trunk@47556 602fd350-edb4-49c9-b593-d223f7449a82
2020-04-09 06:06:02 +00:00
Sergey Biryukov
0bed3c251a Tests: Use PUPPETEER_SKIP_CHROMIUM_DOWNLOAD environment variable instead of config setting.
This is more consistent with the similar approach in Gutenberg Travis setup.

Follow-up to [47449].

See #49621.

git-svn-id: https://develop.svn.wordpress.org/trunk@47459 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-16 12:23:01 +00:00
Sergey Biryukov
a44943546c Tests: Download Chromium for e2e tests only.
This reduces the chance of random failures due to network timeouts and avoids the overhead of unnecessarily downloading ~120 MB for PHP or JS tests.

Fixes #49621.

git-svn-id: https://develop.svn.wordpress.org/trunk@47449 602fd350-edb4-49c9-b593-d223f7449a82
2020-03-11 02:01:20 +00:00
Jake Spurlock
cf014839a5 Build/Test Tools: Don't hardcode the directory name of the repo
When Travis builds the directory, it was looking for a hardcoded `wordpress-develop` directory. If the repo is sitting in another directory, the memcache install will fail. This allows a dynamic path for the directory.

Fixes #48444.
Props pento, whyisjake.


git-svn-id: https://develop.svn.wordpress.org/trunk@46605 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-28 04:15:37 +00:00
Sergey Biryukov
7fdb0e7541 Build/Test Tools: Move PHP 7.4 to the top of the list for consistency.
See #48232.

git-svn-id: https://develop.svn.wordpress.org/trunk@46552 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-15 18:51:42 +00:00
Aaron Jorbin
8a8d016ddb Build/Test: Remove PHP 7.4 from allowed failures
PHP7.4 is supported in WordPress 5.3. 🐘 🎉

Fixes: #48232.



git-svn-id: https://develop.svn.wordpress.org/trunk@46547 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-15 16:36:42 +00:00
Aaron Jorbin
b4d349963f Build/Test tools use Trunk revision 2170172 of importer
Update Travis configuration to temporarily use trunk for the importer in order for PHP 7.4 tests to pass. When the new version is released, this will be updated to point to that tag.

See: #48231



git-svn-id: https://develop.svn.wordpress.org/trunk@46542 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-15 14:40:31 +00:00
Gary Pendergast
da43c14a5d Build Tools: Pass the current uid/gid to Docker containers.
This prepares for an upcoming change to the Docker images, which improves file permission handling.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@46320 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-26 04:57:38 +00:00
Jonathan Desrosiers
336960897d Build/Test Tools: Introduce automated PHP compatibility checking.
This change introduces a new Composer script, `compat` that will scan the codebase for (detectable) potential PHP compatibility issues using the `PHP_CodeSniffer` and a custom ruleset based off of the `PHPCompayibilityWP` ruleset (`phpcompat.xml.dist`).

The command will be run as a separate job within each Travis build. While many compatibility issues and false positives have already been corrected in this commit and other Trac tickets, there are still some remaining. For that reason, the job is allowed to fail while the remainder of the potential compatibility issues are investigated and addressed. After those are resolved, the job should be set as required to pass to help prevent new compatibility issues from being introduced.

Props desrosj, jrf, all PHPCompatibilityWP and PHPCompatibility contributors.
Fixes #46152.

git-svn-id: https://develop.svn.wordpress.org/trunk@46290 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-25 13:46:55 +00:00
Aaron Jorbin
4a0f1f2a5a Build/Test Tools: add php info to travis output
Fixes #48041.


git-svn-id: https://develop.svn.wordpress.org/trunk@46114 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-14 19:27:46 +00:00
Gary Pendergast
4e0499e5bf Tests: Add an xdebug group for tests that require xdebug.
These tests are now also run as their own part of the Travis build, to ensure performance of other tests isn't affected by the presence of xdebug.

Fixes #40532.



git-svn-id: https://develop.svn.wordpress.org/trunk@45827 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-19 02:17:50 +00:00
Gary Pendergast
da411cd17a Build Tools: Run composer commands in a Docker container on Travis.
This tidies up the `.travis.yml` file a little more.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45799 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-14 23:11:39 +00:00
Gary Pendergast
13d356691b Build Tools: Miscellaneous local-env improvements.
- Move the functionality for controlling `local-env` out of `package.json`, into JS scripts.
- Merge the `docker-compose` config files, and move it to the root directory. This allows `docker-compose.override.yml` to work for local overrides.
- Fix nginx redirecting to port 80 under some circumstances.
- `npm run env:install` now creates `wp-tests.config.php` for you.
- Cleaned up a bunch of cruft in `.travis.yml`.

See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45783 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-12 08:28:33 +00:00
Gary Pendergast
4271f1aeca Build Tools: Switch all Travis PHPUnit jobs over to Docker-based PHP.
Additionally, there are a handful of related minor changes in this commit:
- `.travis.yml` has been tidied up a little.
- [45745] was incorrectly marking Travis jobs as passed when some PHPUnit runs failed.
- Add the `LOCAL_PHP_MEMCACHED` environment variable, for enabling Memcached.
- Add the `env:pull` NPM script, for refreshing Docker images.

See #47767.


git-svn-id: https://develop.svn.wordpress.org/trunk@45762 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-07 11:54:22 +00:00
Gary Pendergast
82d7870fe4 Build Tools: Add a WordPress Development Environment.
This commit adds the first iteration of a Docker-based config for setting up a local WordPress development environment.

Props pento, noisysocks, mcsf, pbearne, isabel_brison.
See #47767.



git-svn-id: https://develop.svn.wordpress.org/trunk@45745 602fd350-edb4-49c9-b593-d223f7449a82
2019-08-05 07:09:14 +00:00
Gary Pendergast
c6c78490e2 Coding Standards: Fix the remaining issues in /tests.
All PHP files in `/tests` now conform to the PHP coding standards, or have exceptions appropriately marked.

Travis now also runs `phpcs` on the `/tests` directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉

See #47632.



git-svn-id: https://develop.svn.wordpress.org/trunk@45607 602fd350-edb4-49c9-b593-d223f7449a82
2019-07-08 00:55:20 +00:00
Riad Benguella
42a8715471 Build/Test Tools: Add the e2e tests setup.
- Adds a local environment based on docker
 - Adds the e2e tests setup
 - Adds a "Hello World" e2e test to serve as a template

Props gziolo, herregroen, mcsf.
Fixes #45165.


git-svn-id: https://develop.svn.wordpress.org/trunk@45570 602fd350-edb4-49c9-b593-d223f7449a82
2019-06-27 11:26:58 +00:00
John Blackbourn
814aa7149f Build/Test Tools: Remove the dependency on a globally installed Grunt.
The existing `"grunt": "grunt"` script in `package.json` allows for the use of `npm run grunt ...` which uses the local `grunt` binary in the project's `node_modules`.

Fixes #47380


git-svn-id: https://develop.svn.wordpress.org/trunk@45445 602fd350-edb4-49c9-b593-d223f7449a82
2019-05-26 19:34:24 +00:00
Aaron Jorbin
a66e27efc4 PHP: Finish updating PHP Minimum version
Previous [44982] and [44950].

This bumps the minimum version down slightly based on some research into the usage of php 5.6. This also brings the recommended version in line with https://wordpress.org/about/requirements/ . 

The travis matrix is also being reduced in order to speed up builds. This is a hard break. PHP 5.2 - 5.5 we are never ever, ever, getting back together. You go talk to your friends, talk to my friends, talk to me, But we are never ever, ever, ever getting back together.

Props DD32, afergen for research.
Fixes #46594.



git-svn-id: https://develop.svn.wordpress.org/trunk@45058 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-28 21:11:29 +00:00
Sergey Biryukov
716fa97607 Build/Test Tools: Enable persistent object cache on a PHP 7.3 build instead of PHP 5.6.
Props netweb, johnbillion.
Fixes #46633.

git-svn-id: https://develop.svn.wordpress.org/trunk@45027 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-27 03:05:56 +00:00
John Blackbourn
a1cd087b6e Build/Test tools: Reinstate fast finishing on Travis CI.
This allows for speedier feedback for breaking changes and ongoing failures.

See #46634


git-svn-id: https://develop.svn.wordpress.org/trunk@45004 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-25 16:07:01 +00:00
John Blackbourn
cf6026d64d Build/Test tools: Switch npm dependency caching strategy on Travis CI.
This switches to caching npm's local cache instead of `node_modules` in order to prevent issues caused by modules compiled using a different version of node.

See #46632


git-svn-id: https://develop.svn.wordpress.org/trunk@44993 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-25 00:51:12 +00:00
Aaron Jorbin
67b8f04db4 PHP: End official support for PHP5.2 -> 5.5
For the time being, we are ok with failures rather than not running the tests at all on these old versions. We will make decisions on fixes on a case by case basis.

Props chanthaboune.
See: https://make.wordpress.org/core/2018/12/08/updating-the-minimum-php-version/



git-svn-id: https://develop.svn.wordpress.org/trunk@44950 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-20 22:03:07 +00:00
Aaron Jorbin
8b9f7b4d6b Build: Add PHP 7.4 to the Travis build.
Travis have switched the nightly PHP version to PHP 8.0. The 7.4snapshot version is PHP 7.4.

We don't support 7.4 yet, so it's in allowed failures.

Fixes #46235.


git-svn-id: https://develop.svn.wordpress.org/trunk@44803 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-06 21:01:53 +00:00
Sergey Biryukov
001c6498e8 Build/Test Tools: Add support for PHPUnit 7.x.
* Create an abstract `WP_UnitTestCase_Base` class to share between PHPUnit 7.x and older versions.
* Add a speed-trap loader to determine which `SpeedTrapListener` class needs to be loaded for the current PHPUnit version.
* Remove unnecessary `PHPUnit\Util\Test` and `PHPUnit_Util_Getopt` inheritances.
* Update Travis CI config to use PHPUnit 7.x for PHP 7.1, 7.2, and nightly PHP versions.

Props jipmoors, netweb, desrosj, ayeshrajans, soulseekah, SergeyBiryukov.
See #43218.

git-svn-id: https://develop.svn.wordpress.org/trunk@44701 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-28 14:10:24 +00:00
Jeremy Felt
33a1131b17 Build Tools: Switch to Node 10.13.0.
Now that Node 10 is the LTS branch, with 10.13.0 as the first LTS release, let's use that for building WordPress.

Merges [43853] from the 5.0 branch to trunk.

Props pento.
See #45241.


git-svn-id: https://develop.svn.wordpress.org/trunk@44219 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-16 01:42:24 +00:00
Jonathan Desrosiers
2e78177467 Nav Menus: Fix a PHP 7.3 error when switching themes.
When switching themes, `wp_map_nav_menu_locations()` is used to ensure nav menus are placed in the relevant menu location. Occasionally, menus are registered to locations with numeric slugs, rather than strings. `wp_map_nav_menu_locations()` assumed it would be the latter, and ran `stripos()` on those numeric slugs. This behavior is deprecated in PHP 7.3.

As this is the last PHP 7.3 error in unit tests, this commit also removes PHP 7.3 from Travis' `allowed_failures` list.

Props pento, desrosj, jorbin.

Merges [43899] to trunk.

See #45018.

git-svn-id: https://develop.svn.wordpress.org/trunk@44167 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-14 05:15:54 +00:00
jorbin
b4d7e7a878 Build/Test Tools: Use 7.3 for PHP 7.3
Travis now supports PHP7.3 without workarounds, so let's remove the workarounds.

Merges [43726] to trunk.

See #44771.


git-svn-id: https://develop.svn.wordpress.org/trunk@43975 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-11 04:20:02 +00:00
Aaron Jorbin
a6adbc226f Build/Test Tools: Add PHP7.3 RC1 to the build matrix
Currently, we need to do some extra steps to run 7.3, but this will help us with testing compatibility.

See: https://github.com/travis-ci/travis-ci/issues/9717

See #44771.


git-svn-id: https://develop.svn.wordpress.org/trunk@43673 602fd350-edb4-49c9-b593-d223f7449a82
2018-10-04 02:04:53 +00:00
John Blackbourn
629c76c31b Build/Test Tools: Implement the automatic retry functionality that Travis CI provides.
This functionality will cause the command to be retried up to three times in case of a non-zero return value. Implementing it on commands that perform network requests means that intermittent network failures are less likely to cause a build to fail, as they'll be retried up to three times.

See #44858


git-svn-id: https://develop.svn.wordpress.org/trunk@43645 602fd350-edb4-49c9-b593-d223f7449a82
2018-09-15 09:21:55 +00:00
Gary Pendergast
a75d153eee Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-17 01:50:26 +00:00
Aaron Jorbin
16f9dea4ab BUILD/TEST TOOLS: Report Travis test results to make/hosting PHPUnit test results
Send the core test results to make/hosting in order to improve the alerting.  See: https://github.com/WordPress/phpunit-test-reporter/issues/45

Fixes #43099
Props danielbachhuber



git-svn-id: https://develop.svn.wordpress.org/trunk@42492 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-16 20:28:42 +00:00
Dion Hulse
b938517860 Build: Bump the version of node used on Travis to match WordPress.org.
Props netweb, dd32.
See #35105


git-svn-id: https://develop.svn.wordpress.org/trunk@42464 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-16 06:35:22 +00:00
John Blackbourn
11a2e57ae8 Build/Test tools: Remove PHP 7.2 from the allowed failures list on Travis CI.
Fixes #40109


git-svn-id: https://develop.svn.wordpress.org/trunk@41748 602fd350-edb4-49c9-b593-d223f7449a82
2017-10-04 19:53:07 +00:00
John Blackbourn
a6f8f9668b Build/Test tools: Use the latest in the 4.x and 6.x branches of PHPUnit when running tests on Travis.
Props netweb, ayeshrajans

Fixes #41472


git-svn-id: https://develop.svn.wordpress.org/trunk@41294 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-22 16:08:33 +00:00