This modifies the PHPUnit workflow to add MySQL version 8.0 to the strategy matrix. It also adds an additional strategy matrix to expand testing to include several supported MariaDB versions.
To prevent repeating code, the business logic of the PHPUnit testing has been moved to a new, callable workflow.
Because callable workflows target a specific branch, branches created in the future will continue to benefit from improvements made to the workflow in `trunk` without requiring backports. If a breaking change is required, older branches will need to be updated to target the commit SHA representing the final commit of the previous state.
Props johnbillion, pento, boonebgorges, netweb, nacin, desrosj.
Fixes#30462.
git-svn-id: https://develop.svn.wordpress.org/trunk@56439 602fd350-edb4-49c9-b593-d223f7449a82
As part of a previous change to add support for post type templates, the `$wp_query->get_queried_object_id()` method ended up being called twice, in both the `is_singular()` and `is_page()` conditional branches.
The `get_post()` function call was also unnecessary, as `$wp_query->get_queried_object()` is already called in the `is_singular()` branch above, which includes the `is_page()` branch too.
This commit removes the redundant calls. The first `$wp_query->get_queried_object_id()` call is removed as well, since the post ID is already available via `$wp_query->get_queried_object()`.
Follow-up to [10485], [10877], [12877], [13032], [21597], [38951].
Props mattkeys, spacedmonkey, oglekler.
Fixes#43661.
git-svn-id: https://develop.svn.wordpress.org/trunk@56424 602fd350-edb4-49c9-b593-d223f7449a82
Fixes the error handling for when `WP_Classic_To_Block_Menu_Converter::convert()` returns an instance of `WP_Error`. `WP_Navigation_Fallback::create_classic_menu_fallback()` now checks for `is_wp_error()` and if `true`, returns the error. And the `@return` type is updated to `string|WP_Error`.
Also includes a fix in the return type in `WP_Classic_To_Block_Menu_Converter::convert()` to return an empty string instead of an array instead, i.e. when bailing out for no menu items returned by `wp_get_nav_menu_items()`. The return type is clearly documented as a `string`.
Follow-up to [56052].
Props dlh, get_dave, antonvlasenko, hellofromTonya.
Fixes#58823.
git-svn-id: https://develop.svn.wordpress.org/trunk@56422 602fd350-edb4-49c9-b593-d223f7449a82
[https://github.com/sebastianbergmann/phpunit/blob/9.6/ChangeLog-9.6.md#961---2023-02-03 PHPUnit 9.6.1] deprecated the `assertObjectHasAttribute()` and `assertObjectNotHasAttribute()` methods, leading to deprecation notices in a number of tests.
[https://github.com/sebastianbergmann/phpunit/blob/10.1.3/ChangeLog-10.1.md#1010---2023-04-14 PHPUnit 10.1.0] brought the methods back by popular request, though renamed as `assertObjectHasProperty()` and `assertObjectNotHasProperty()`, to prevent confusion with PHP 8.0 attributes.
This meant that users which cannot (yet) upgrade to PHPUnit 10.1+ would always have deprecation notices for these methods without recourse. So, after much discussion, the new methods have been backported to [https://github.com/sebastianbergmann/phpunit/blob/9.6/ChangeLog-9.6.md#9611---2023-08-19 PHPUnit 9.6.11], leaving just the 10.0.x series with a deprecation notice and no recourse.
What does this mean for WordPress?
WordPress uses the [https://github.com/Yoast/PHPUnit-Polyfills PHPUnit Polyfills] to be able to write tests for the most recent versions of PHPUnit, with the Polyfills taking care of polyfilling any new PHPUnit methods on older PHPUnit versions.
* The PHPUnit Polyfills 1.x series supports PHPUnit 4.x to 9.x.
* The PHPUnit Polyfills 2.x series supports PHPUnit 5.x to 10.x.
WordPress currently runs against PHPUnit 6.x to 9.x with PHPUnit Polyfills 1.x, while the new methods were previously only included in PHPUnit Polyfills 2.0.0+, as they were introduced in PHPUnit 10.x.
Since the `assertObjectHasProperty()` and `assertObjectNotHasProperty()` methods have been backported to PHPUnit 9.x, the PHPUnit Polyfills will now include these methods in the 1.x series as well.
By upgrading to the latest [https://github.com/Yoast/PHPUnit-Polyfills/releases/tag/1.1.0 PHPUnit Polyfills 1.1.0] release, we can get rid of the deprecation notices related to the use of the `assertObjectHasAttribute()` and `assertObjectNotHasAttribute()` methods.
This could have implications for plugins or themes running integration tests with WordPress if they have set their PHPUnit Polyfills dependency to a fixed version or have a too strict version constraint (limiting the PHPUnit Polyfills to the 1.0.x series). The solution for those plugins or themes is to update their version constraints for the PHPUnit Polyfills to allow for the 1.1.x series.
Follow-up to [51559], [51598].
Props jrf, ayeshrajans.
Fixes#59150.
git-svn-id: https://develop.svn.wordpress.org/trunk@56421 602fd350-edb4-49c9-b593-d223f7449a82
Includes fixes for footnotes and editor styles related crashes, as well as a cut and paste-related crash.
Props ramonopoly.
See #59151.
git-svn-id: https://develop.svn.wordpress.org/trunk@56419 602fd350-edb4-49c9-b593-d223f7449a82
Fixes updating WordPress from 5.7 and earlier versions. When doing the update this file runs first in the old version where the polifills may not be available.
Porps: frankit.
Fixes: #59145.
git-svn-id: https://develop.svn.wordpress.org/trunk@56417 602fd350-edb4-49c9-b593-d223f7449a82
Adds a new public function, `wp_get_theme_data_custom_templates` that returns the `customTemplates` defined by the active theme from `theme.json`. It also substitutes the usage of private APIs by this new
API.
Props johnbillion, audrasjb.
Fixes#59137
git-svn-id: https://develop.svn.wordpress.org/trunk@56413 602fd350-edb4-49c9-b593-d223f7449a82
This resolves a few WPCS warnings:
{{{
Variable "$sX" is not in valid snake_case format, try "$s_x"
Variable "$sY" is not in valid snake_case format, try "$s_y"
}}}
The `$sX` and `$sY` variables are renamed to `$original_width` and `$original_height`, respectively.
Additionally, the `$fwidth` and `$fheight` variables are renamed to `$full_width` and `$full_height`, for clarity.
Follow-up to [11965], [22094], [56400].
See #58831.
git-svn-id: https://develop.svn.wordpress.org/trunk@56411 602fd350-edb4-49c9-b593-d223f7449a82
Fix `additional_classes` argument passed as a string instead of an array. Follow up to [56409].
Props joedolson.
See #57791.
git-svn-id: https://develop.svn.wordpress.org/trunk@56410 602fd350-edb4-49c9-b593-d223f7449a82
Use `wp_get_admin_notice` and `wp_admin_notice` to handle multisite settings notices.
Props costdev.
See #57791.
git-svn-id: https://develop.svn.wordpress.org/trunk@56409 602fd350-edb4-49c9-b593-d223f7449a82
Add functions `wp_get_admin_notice()` and `wp_admin_notice()` to create and output admin notices & tests for usage. New functions accept a message and array of optional arguments. This commit does not implement the functions. Include new filters: `wp_admin_notice_args`, `wp_admin_notice_markup` and action: `wp_admin_notice`.
Props joedolson, costdev, sakibmd, dasnitesh780, sabernhardt.
Fixes#57791.
git-svn-id: https://develop.svn.wordpress.org/trunk@56408 602fd350-edb4-49c9-b593-d223f7449a82
This reverts [56404], [56405], [56406].
More testing is needed to ensure multiple messages are not sent unintentionally.
Unprops desrosj.
See #58867.
git-svn-id: https://develop.svn.wordpress.org/trunk@56407 602fd350-edb4-49c9-b593-d223f7449a82
This adds `startup_failure` to the list of conclusions that the Slack workflow looks for when determining whether to send a failure notice.
See #58867.
git-svn-id: https://develop.svn.wordpress.org/trunk@56406 602fd350-edb4-49c9-b593-d223f7449a82
[53947] introduced a callable workflow that allowed a workflow run to be retried automatic. By default all workflows are retried once.
Since a run is not considered “failed” until after the automatic retry, the first Slack message is unnecessary and can cause a lot of noise when there are network hiccups.
This alters the logic to skip a failure notice in Slack until the second failure.
See #58867.
git-svn-id: https://develop.svn.wordpress.org/trunk@56404 602fd350-edb4-49c9-b593-d223f7449a82
Because `slack-notifications` job requires all preceding jobs in each workflow to complete, there’s no need to include the same jobs in the `needs` configuration for the `failed-workflow` one.
See #58867.
git-svn-id: https://develop.svn.wordpress.org/trunk@56402 602fd350-edb4-49c9-b593-d223f7449a82
If the available disk space exceeds the `PHP_INT_MAX` value, i.e. a 32-bit PHP version is in use with more than 2 GB free, the type casting to `(int)` could cause an overflow, and the Site Health test would then erroneously report that there is not enough free space.
This commit removes the unnecessary type casting and uses the result from `disk_free_space()` directly.
Includes optimizing the logic to skip further checks if the available disk space could not be determined.
Follow-up to [55720].
Props mathsgrinds, Presskopp, rajinsharwar, SergeyBiryukov.
Fixes#59116.
git-svn-id: https://develop.svn.wordpress.org/trunk@56401 602fd350-edb4-49c9-b593-d223f7449a82
Three new metrics are being collected and reported as part of this change:
- Time To First Byte (TTFB) - the time between the request for a resource and when the first byte of a response begins to arrive
- Largest Contentful Paint (LCP) — the render time of the largest image or text block visible within the viewport
- The difference between the two (LCP minus TTFB)
Props joemcgill, flixos90, oandregal, mukesh27, youknowriad, swissspidy.
Fixes#58360.
git-svn-id: https://develop.svn.wordpress.org/trunk@56399 602fd350-edb4-49c9-b593-d223f7449a82
This updates two fragments for sending a `304 Not Modified` header to better align with each other by using consistent variable names and formatting.
Follow-up to [1036], [1037], [1043], [2534], [2584], [2627], [12603], [12936], [56362].
See #58831.
git-svn-id: https://develop.svn.wordpress.org/trunk@56395 602fd350-edb4-49c9-b593-d223f7449a82
Includes minor code layout fixes for better readability.
Follow-up to [3634], [4189].
Props aristath, poena, afercia, SergeyBiryukov.
See #58831.
git-svn-id: https://develop.svn.wordpress.org/trunk@56394 602fd350-edb4-49c9-b593-d223f7449a82
Prior to this change, all block files were excluded from coding standards checks, but there's no reason these files shouldn't adhere to core's coding standards.
Props lopo, Rahe, adamsilverstein
Fixes#50010
git-svn-id: https://develop.svn.wordpress.org/trunk@56392 602fd350-edb4-49c9-b593-d223f7449a82
This updates the following dependencies to their latest versions:
- `chalk`
- `cssnano`
- `dotenv`
- `grunt-contrib-cssmin`
- `grunt-contrib-qunit`
- `grunt-webpack`
- `jest-image-snapshot`
- `postcss`
- `sass`
- `sinon`
- `webpack`
Additionally, `npm audit fix` has been run to automatically fix as many issues as possible.
See #58863.
git-svn-id: https://develop.svn.wordpress.org/trunk@56390 602fd350-edb4-49c9-b593-d223f7449a82
This updates the `whatwg-fetch` library from version `3.6.2` to `3.6.17`, the latest current version.
This library is included and registered within WordPress as the `wp-polyfill-fetch` script and is no longer used by WordPress itself.
Props rajinsharwar, hareesh-pillai.
Fixes#59066.
git-svn-id: https://develop.svn.wordpress.org/trunk@56389 602fd350-edb4-49c9-b593-d223f7449a82
The original filter location is `wp_maybe_add_fetchpriority_high_attr()` in `wp-includes/media.php`.
This commit updates the instance in `wp_get_loading_optimization_attributes()` to point to the correct file.
Follow-up to [56037], [56143], [56347].
Props tmatsuur, rajinsharwar, khokansardar.
Fixes#59067.
git-svn-id: https://develop.svn.wordpress.org/trunk@56386 602fd350-edb4-49c9-b593-d223f7449a82
Adds a new public function, `wp_get_theme_data_template_parts` that returns the `templateParts` defined by the active theme from `theme.json`. It also substitutes the usage of private APIs by this new API.
Props felixarntz.
Fixes#59003
git-svn-id: https://develop.svn.wordpress.org/trunk@56385 602fd350-edb4-49c9-b593-d223f7449a82