Commit Graph

33058 Commits

Author SHA1 Message Date
Andrew Ozz
d7b34a5287 Build/Test Tools, Formatting group:
- Add and update @covers tags.
- Add and improve docs and inline comments.

Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53562


git-svn-id: http://core.svn.wordpress.org/trunk@53151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 20:29:09 +00:00
Andrew Ozz
c5a5234941 Build/Test Tools: Add missing @covers tags for the AJAX test group.
Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.
Built from https://develop.svn.wordpress.org/trunk@53561


git-svn-id: http://core.svn.wordpress.org/trunk@53150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 19:47:10 +00:00
John Blackbourn
5dd1936fdb Themes: Add actions to template loading to assist with collecting debug info.
This introduces the following new actions which wrap the process of loading a template file:

* `wp_before_load_template`
* `wp_after_load_template`

Props rmccue, tabrisrp, peterwilsoncc

Fixes #54541

Built from https://develop.svn.wordpress.org/trunk@53560


git-svn-id: http://core.svn.wordpress.org/trunk@53149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 18:59:09 +00:00
Aaron Jorbin
a457e3498e Editor: Universalize functions for checking block editor status.
`use_block_editor_for_post_type` and `use_block_editor_for_post` can be very useful in more contexts than wp-admin, especially when a site is in transition. For example, you may want to do things on init that are different.

Neither function depends on other functions that are available only in wp-admin (other than use_block_editor_for_post() relying on use_block_editor_for_post_type() and an admin-referrer check that's historically gated by a query variable and now also gated by is_admin), therefore  moving them to wp-includes seems both feasible and beneficial

Props ethitter, jorbin.
Fixes #51819.


Built from https://develop.svn.wordpress.org/trunk@53559


git-svn-id: http://core.svn.wordpress.org/trunk@53148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 18:48:13 +00:00
Sergey Biryukov
fe941574c3 Code Modernization: Remove dynamic properties in Tests_Media.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test class contains a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but never ''changed'' by the tests.

In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.

Notes:
* As the `$img_html` property, which was previously being set, is not actually used in any of the tests, that property has not been converted to a constant.
* The values which were previously being set using a heredoc, now use a nowdoc (supported since PHP 5.3), as they don't contain any interpolation.
* The use of constant scalar expressions (`IMG_URL`) and constant arrays (`IMG_META`) in class constants is supported since PHP 5.6.

Follow-up to [711/tests], [1260/tests], [34855], [41724], [53557].

Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53558


git-svn-id: http://core.svn.wordpress.org/trunk@53147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 15:03:15 +00:00
Sergey Biryukov
86865fcbdd Code Modernization: Remove dynamic properties in Tests_*_Slashes.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In this particular case, the test classes contain a `set_up()` method that sets a group of properties, which are ''used'' by the tests, but the values of these properties are never ''changed'' by the tests.

In other words, setting these properties in the `set_up()` is an unnecessary overhead and the properties should be changed to class constants.

Follow-up to [1041/tests], [1071/tests].

Props jrf.
See #56033.
Built from https://develop.svn.wordpress.org/trunk@53557


git-svn-id: http://core.svn.wordpress.org/trunk@53146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 14:26:13 +00:00
Sergey Biryukov
fb93f0ecc1 Tests: Improve the test for sticky posts not being moved to the front in sitemaps.
* Give the test method a most descriptive name.
* Use a single assertion for the URL list instead of a `foreach` loop to provide more context in case of failure.
* Add a failure message to each assertion, as there are multiple assertions used in the test.

Follow-up to [53548].

See #55633.
Built from https://develop.svn.wordpress.org/trunk@53556


git-svn-id: http://core.svn.wordpress.org/trunk@53145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 16:52:11 +00:00
Sergey Biryukov
5d2e8afebd Code Modernization: Use the integer portion of an item position in add_submenu_page().
This fixes an `Implicit conversion from float to int loses precision` PHP 8.1 deprecation notice when adding a new admin menu item with a `float` value passed as the `$position` parameter.

This change is covered by existing unit tests and addresses 8 errors when running the test suite on PHP 8.1.

References:
* [https://php.watch/versions/8.1/deprecate-implicit-conversion-incompatible-float-string PHP 8.1: Implicit incompatible float to int conversion is deprecated]
* [https://wiki.php.net/rfc/implicit-float-int-deprecate PHP RFC: Deprecate implicit non-integer-compatible float to int conversions]

Follow-up to [52569], [53104].

Props jrf.
See #55656, #54798.
Built from https://develop.svn.wordpress.org/trunk@53555


git-svn-id: http://core.svn.wordpress.org/trunk@53144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 14:55:11 +00:00
desrosj
9e3dc52d45 Build/Test Tools: Return an error when uploading a test coverage report fails.
`true` is now passed to the `fail_ci_if_error` input when the `codecov/codecov-action` action is used.

When uploading a code coverage report is unsuccessful, the action will now fail and return an error. This will help avoid situations like #56022 where the report was suddenly failing to upload even though the workflow itself appeared to be successful.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53554


git-svn-id: http://core.svn.wordpress.org/trunk@53143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 00:20:11 +00:00
desrosj
5aae4a4c10 Build/Test Tools: Allow changes to the code coverage workflow to run on pull request.
This adds the `pull_request` event to the Code Coverage Report workflow, allowing changes to be verified in a pull request before being committed.

The `branches` and `paths` filters are used to limit when the workflow runs to pull requests with:

- A base branch of `trunk`.
- Changing specific files that can potentially affect the way a coverage report is generated.

Reports generated on `pull_request` events are for testing purposes only and are not submitted to Codecov.

The `docker-compose.yml` file has also been added to the `paths` filter for both `push` and `pull_request` events. Changes to this file could potentially affect the environment used to generate the report (such as the ones in [53552]).

Props afragen, johnbillion, desrosj.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53553


git-svn-id: http://core.svn.wordpress.org/trunk@53142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-22 00:01:13 +00:00
desrosj
df27445253 Build/Test Tools: Configure Xdebug modes in the local Docker environment.
One change in the update from Xdebug version 2.x to 3.x was a shift from enabling features to switching into modes.

When the version of Xdebug installed in the PHP 7.4 Docker container was updated from 2.x to 3.x, the code coverage reporting workflow stopped generating reports due to a lack of available coverage drivers.

This change adds the `XDEBUG_MODE` environment variable to the local Docker environment configuration to allow the active modes to be changed. This environment variable takes precedence over the `xdebug.mode` setting, but will not change the value of the `xdebug.mode` setting.

The `LOCAL_PHP_XDEBUG_MODE` environment variable has been added to the `.env` file and can be used to change the modes enabled in the Docker container. The code coverage reporting workflow uses this variable to enable the `coverage` mode, which is required for generating a test coverage report.

By default, `debug` and `debug modes are active, which enables the more commonly used features of Xdebug: development helpers and step debugging.

Props afragen, johnbillion, desrosj.
Fixes #56022.
Built from https://develop.svn.wordpress.org/trunk@53552


git-svn-id: http://core.svn.wordpress.org/trunk@53141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 23:47:13 +00:00
audrasjb
29cfbec0ba Docs: Add missing @since mention in get_posts_query_args().
Follow-up to [53548].
See #55633.

Built from https://develop.svn.wordpress.org/trunk@53551


git-svn-id: http://core.svn.wordpress.org/trunk@53140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:48:12 +00:00
audrasjb
d3cf4fb243 Docs: Use third-person singular verbs for function descriptions in Tests_Sitemaps_wpSitemapsPosts, as per docblock standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53550


git-svn-id: http://core.svn.wordpress.org/trunk@53139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:45:09 +00:00
spacedmonkey
ac6ce3e026 Posts, Post Types: Add caching to _find_post_by_old_slug and _find_post_by_old_date functions.
Cache result of database queries in `_find_post_by_old_slug` and `_find_post_by_old_date` functions. This means that repeated requests to a url where the page is not found, will result in hitting a cache for sites running persistent object caching. 

Props Spacedmonkey, dd32, mukesh27, pbearne, flixos90.
Fixes #36723.
Built from https://develop.svn.wordpress.org/trunk@53549


git-svn-id: http://core.svn.wordpress.org/trunk@53138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:34:13 +00:00
audrasjb
ea5c6469c9 Sitemaps: Remove duplicate sticky Posts from Sitemap Post Query.
This changeset sets the `ignore_sticky_posts` parameter to `true` in the default arguments passed to `wp_sitemaps_posts_query_args`.

Props RavanH, pbiron, swissspidy, audrasjb, SergeyBiryukov.
Fixes #55633.

Built from https://develop.svn.wordpress.org/trunk@53548


git-svn-id: http://core.svn.wordpress.org/trunk@53137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 13:18:10 +00:00
Sergey Biryukov
b8290da037 Docs: Improve documentation for WP_Image_Editor::save() and related functions.
Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$filesize` value being included in the returned array.

This affects:
 * `wp_generate_attachment_metadata()`
 * `wp_get_attachment_metadata()`
 * `WP_Image_Editor::save()`
 * `WP_Image_Editor_GD::save()` and `::_save()`
 * `WP_Image_Editor_Imagick::save()` and `::_save()`

Follow-up to [22094], [22619], [52837], [53546].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53547


git-svn-id: http://core.svn.wordpress.org/trunk@53136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:18:17 +00:00
Sergey Biryukov
b352d32d8a Docs: Correct the return type for wp_save_image_file().
Since WordPress 3.5, `wp_save_image_file()` uses `WP_Image_Editor` classes under the hood to save the images.

While the `save()` method in those instances returns `array|WP_Error` and is documented as such, the return type of the `wp_save_image_file()` function was still left as `bool`.

A better solution would be to adjust the function to return the documented boolean type. However, doing that after 20+ major WP releases would be a backward compatibility break, so the documentation is now updated instead.

Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$image` parameter expecting a `WP_Image_Editor` instance.
* Adding a `@since` note for the `$filesize` value being included in the returned array.

Follow-up to [22094], [22619], [52837].

Props jrf, SergeyBiryukov.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53546


git-svn-id: http://core.svn.wordpress.org/trunk@53135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:16:17 +00:00
Sergey Biryukov
f8e00d59ae Tests: Move assertQueryTrue() closer to the other custom assertions in WP_UnitTestCase_Base.
Follow-up to [109/tests], [26005].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53545


git-svn-id: http://core.svn.wordpress.org/trunk@53134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 11:14:22 +00:00
spacedmonkey
65b78390ee REST API: Move all links to prepare_links method in theme REST API controller.
Move logic to generate link to global styles to the `prepare_links` method in theme REST API controller. This way all logic to generate links is within the `prepare_links` method, bringing this controller inline with other REST API controllers.

Props SergeyBiryukov, Spacedmonkey.
Fixes #56018.
Built from https://develop.svn.wordpress.org/trunk@53544


git-svn-id: http://core.svn.wordpress.org/trunk@53133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-21 10:48:21 +00:00
John Blackbourn
721877d3d2 I18N: Correct and improve inline docs and tests for functionality related to nooped plurals.
See #55646, #55652

Built from https://develop.svn.wordpress.org/trunk@53543


git-svn-id: http://core.svn.wordpress.org/trunk@53132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 22:57:16 +00:00
Sergey Biryukov
a07f85a464 Docs: Use third-person singular verbs for function descriptions in Tests_Image_Functions, per the documentation standards.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@53542


git-svn-id: http://core.svn.wordpress.org/trunk@53131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 22:26:16 +00:00
Sergey Biryukov
db04949ca0 Tests: Further improve Tests_Image_Functions::test_wp_crop_image*() tests.
Includes:
* Making the test method names more specific.
* Converting one-off helper methods to static closures.
* Adding a failure message to each assertion when multiple assertions are used in the test.

Follow-up to [1126/tests], [1201/tests], [53292], [53495], [53522], [53538].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53541


git-svn-id: http://core.svn.wordpress.org/trunk@53130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 22:06:18 +00:00
audrasjb
78bc43e7f8 Embeds: Remove Meetup as an oEmbed source since the related endpoint has been deprecated.
This changeset removes Meetup as an oEmbed source, since Meetup.com have deprecated their oEmbed endpoint. The block has already been removed from the editor, see GB#35085.

Props peterwilsoncc, audrasjb, swissspidy.
Fixes #55997.

Built from https://develop.svn.wordpress.org/trunk@53540


git-svn-id: http://core.svn.wordpress.org/trunk@53129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 21:48:15 +00:00
audrasjb
fa3ed002e1 Docs: Use third-person singular verbs for function descriptions in the Feed API, as per docblock standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53539


git-svn-id: http://core.svn.wordpress.org/trunk@53128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 21:46:16 +00:00
Sergey Biryukov
30836ec0bd Tests: Improve Tests_Image_Functions::test_wp_crop_image*() tests.
Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.

Follow-up to [1126/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531], [53537].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53538


git-svn-id: http://core.svn.wordpress.org/trunk@53127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 21:37:15 +00:00
Sergey Biryukov
26561d6b94 Tests: Refactor Tests_Image_Functions::test_load_directory() to split the tests and use a data provider.
This one test was testing three different situations. When one assertion fails, the rest of the test would not be executed, so this leads to hiding one error behind another.

Splitting the test into three distinct test methods still allows for testing each situation, but tests each one in isolation and won't hide errors.

The third part of the test, dealing with image editor engine classes, will also now use a data provider.

Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.
* Reusing an existing data provider with the available image editor engine classes.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53537


git-svn-id: http://core.svn.wordpress.org/trunk@53126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 19:36:20 +00:00
Sergey Biryukov
306f53a798 Tests: Always include the error message in assertNotWPError() and assertNotIXRError().
Previously, in case of failure, `WP_UnitTestCase_Base::assertNotWPError()` displayed the actual error message from the passed `WP_Error` object, but only if the `$message` parameter was empty.

This made the assertion less helpful, as the actual error message was lost in case there was a non-empty `$message` parameter passed to the method, as per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#using-assertions Writing PHP Tests] guidelines:
> All PHPUnit assertions, as well as all WordPress custom assertions, allow for a `$message` parameter to be passed. This message will be displayed when the assertion fails and can help immensely when debugging a test. This parameter should always be used if more than one assertion is used in a test method.

This commit ensures that the actual error message is always displayed, in addition to the passed `$message` parameter.

The same applies to `WP_UnitTestCase_Base::assertNotIXRError()`.

Follow-up to [34638], [40417].

Props jrf, SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53536


git-svn-id: http://core.svn.wordpress.org/trunk@53125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 17:29:17 +00:00
Sergey Biryukov
75f689766f External Libraries: Upgrade PHPMailer to version 6.6.3.
This is a maintenance release with minor CS improvements.

Release notes:
https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.3

For a full list of changes in this update, see the PHPMailer GitHub:
https://github.com/PHPMailer/PHPMailer/compare/v6.6.2...v6.6.3

Follow-up to [50628], [50799], [51169], [51634], [51635], [52252], [52749], [52811], [53500].

Props jrf, Synchro.
Fixes #56016.
Built from https://develop.svn.wordpress.org/trunk@53535


git-svn-id: http://core.svn.wordpress.org/trunk@53124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 15:04:11 +00:00
desrosj
cb93e6ba63 Build/Test Tools: Adjust Slack notifications logic to account for expected non push events.
This adjusts the logic used to determine the outcome of the previous workflow run of the current one to account for `schedule` and `workflow_dispatch` events.

In the current state, only workflows triggered by `push` events are examined. This is causing failures when trying to post Slack notifications for the Test Coverage workflow, and inconsistent results for `workflow_dispatch` events when testing older branches on a schedule.

Follow up to [53466] and [53468].
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53534


git-svn-id: http://core.svn.wordpress.org/trunk@53123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 15:00:15 +00:00
Sergey Biryukov
5b4e5235ed Tests: Use consistent punctuation in failure messages in Tests_Image_Functions.
Follow-up to [53523], [53524], [53525], [53526], [53529], [53530], [53531].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53533


git-svn-id: http://core.svn.wordpress.org/trunk@53122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-20 12:50:14 +00:00
Sergey Biryukov
162bffa8b5 Tests: Consistently check that an image was loaded in image saving tests.
Don't unnecessarily load the image twice in `test_inferred_mime_types_when_saving_an_image()`.

Follow-up to [1061/tests], [1151/tests], [1157/tests], [29834].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53532


git-svn-id: http://core.svn.wordpress.org/trunk@53121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 17:28:11 +00:00
Sergey Biryukov
5f344cee00 Tests: Refactor Tests_Image_Functions::test_inferred_mime_types() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Adding a skip annotation for unsupported mime types.
* Making the test method name more specific.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53531


git-svn-id: http://core.svn.wordpress.org/trunk@53120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 17:12:07 +00:00
Sergey Biryukov
13b24017be Tests: Refactor Tests_Image_Functions::test_mime_overrides_filename() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Making the test method name more specific.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53530


git-svn-id: http://core.svn.wordpress.org/trunk@53119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 16:53:08 +00:00
Sergey Biryukov
de017e6a7e Tests: Refactor Tests_Image_Functions::test_wp_save_image_file() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.
* Adding a skip annotation for unsupported mime types.
* Adding a failure message to each assertion.

Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53529


git-svn-id: http://core.svn.wordpress.org/trunk@53118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 16:41:12 +00:00
Sergey Biryukov
3abb5d4a83 Tests: Reorder is_gd_image() test methods for consistency.
This moves the test for valid types first, to match `file_is_valid_image()` and `file_is_displayable_image()` tests.

Follow-up to [48798], [53527].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53528


git-svn-id: http://core.svn.wordpress.org/trunk@53117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 16:05:09 +00:00
Sergey Biryukov
b01fc042dc Tests: Rename some test methods in Tests_Image_Functions for consistency.
This matches the names of the functions being tested:
* `file_is_valid_image()`
* `file_is_displayable_image()`

Follow-up to [184/tests], [53523], [53524], [53525], [53526].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53527


git-svn-id: http://core.svn.wordpress.org/trunk@53116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:45:13 +00:00
Sergey Biryukov
d53738ce7c Tests: Refactor Tests_Image_Functions::test_is_displayable_image_negative() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.

Follow-up to [184/tests], [53495], [53497], [53521], [53523], [53524], [53525].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53526


git-svn-id: http://core.svn.wordpress.org/trunk@53115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:36:11 +00:00
Sergey Biryukov
40abfe84c7 Tests: Refactor Tests_Image_Functions::test_is_displayable_image_positive() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.

Follow-up to [184/tests], [42780], [53495], [53497], [53521], [53523], [53524].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53525


git-svn-id: http://core.svn.wordpress.org/trunk@53114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:30:08 +00:00
Sergey Biryukov
3d4dce5320 Tests: Refactor Tests_Image_Functions::test_is_image_negative() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Adding a `@covers` annotation.

Follow-up to [184/tests], [53495], [53497], [53521], [53523].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53524


git-svn-id: http://core.svn.wordpress.org/trunk@53113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:21:08 +00:00
Sergey Biryukov
35bb74740a Tests: Refactor Tests_Image_Functions::test_is_image_positive() to use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.

The actual cases being tested, or the test itself have not been changed.

Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.

Follow-up to [184/tests], [42780], [53495], [53497], [53521].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53523


git-svn-id: http://core.svn.wordpress.org/trunk@53112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 15:15:08 +00:00
Sergey Biryukov
3183f77ce7 Tests: Move the filter_image_editor_output_format() helper method next to the test it's used in.
Follow-up to [53292], [53495].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53522


git-svn-id: http://core.svn.wordpress.org/trunk@53111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-19 12:49:12 +00:00
Sergey Biryukov
6e12ff3b89 Tests: Add a helper method for for creating named data providers in WP_UnitTestCase_Base.
This introduces a new test helper function which allows for turning a single-level array containing text strings into a data provider with named data sets, where the value of the data set will also be used as the name of the data set.

The function contains safeguards to ensure that it is only used with data compatible with this principle and will throw generic PHP exceptions when the data is incompatible. These type of exceptions will be displayed before the tests even start running and will stop the test run when they occur.

While generally speaking, all test cases ''should'' extend the base `WP_UnitTestCase_Base` class, this is still made a `public static` method to allow for a test, which by exception directly extends the PHPUnit base `TestCase` or the `PHPUnit_Adapter_TestCase`, to also be able to use this method.

Typical usage of this method:
{{{
public function data_provider_for_test_name() {
	$array = array(
		'value1',
		'value2',
	);

	return $this->text_array_to_dataprovider( $array );
}
}}}
The returned result will look like:
{{{
array(
	'value1' => array( 'value1' ),
	'value2' => array( 'value2' ),
)
}}}

Props jrf, hellofromTonya, adamsilverstein.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53521


git-svn-id: http://core.svn.wordpress.org/trunk@53110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-18 21:30:13 +00:00
Sergey Biryukov
481da1b9f4 Docs: Consistently declare the $wp_query global in link template functions.
This ensures that the global is explicitly declared and documented in:
* `get_next_posts_link()`
* `get_posts_nav_link()`
* `get_the_posts_navigation()`
* `get_the_posts_pagination()`
* `get_next_comments_link()`

Follow-up to [30065].

Props mt8.biz, sabernhardt.
Fixes #43164.
Built from https://develop.svn.wordpress.org/trunk@53520


git-svn-id: http://core.svn.wordpress.org/trunk@53109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-18 15:38:15 +00:00
Sergey Biryukov
c70a5c547f Coding Standards: Fix WPCS issue in [53518].
This fixes an "Concat operator must be surrounded by a single space" error.

See #54233.
Built from https://develop.svn.wordpress.org/trunk@53519


git-svn-id: http://core.svn.wordpress.org/trunk@53108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-17 11:33:08 +00:00
Sergey Biryukov
a0215f6e9d General: Use WPINC as a shorter reference to wp-includes in some files.
This brings more consistency with similar `require_once` statements and `_deprecated_file()` calls in other files.

Follow-up to [601], [628], [36693], [44359], [45663], [45678], [52026], 

Props malthert.
See #54233.
Built from https://develop.svn.wordpress.org/trunk@53518


git-svn-id: http://core.svn.wordpress.org/trunk@53107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-17 11:20:13 +00:00
audrasjb
4947604b66 Twenty Twenty-One: Ensure custom text color is reflected in the Editor for Quote block.
This changes removes an hardcoded CSS color value for the Quote block in Twenty Twenty-One's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.

Props jyolsna, evildon, kajalgohel, audrasjb.
Fixes #55989.

Built from https://develop.svn.wordpress.org/trunk@53517


git-svn-id: http://core.svn.wordpress.org/trunk@53106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:43:09 +00:00
audrasjb
bac638e610 Docs: Use third-person singular verbs for function descriptions in the Taxonomy Administration API.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53516


git-svn-id: http://core.svn.wordpress.org/trunk@53105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:39:08 +00:00
audrasjb
cfd6d327ad Twenty Nineteen: Ensure custom text color is reflected in the Editor for Quote block.
This changes removes an hardcoded CSS color value for the Quote block in Twenty Nineteen's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.

Props nithi22, evildon, SergeyBiryukov, audrasjb.
Fixes #55992.

Built from https://develop.svn.wordpress.org/trunk@53515


git-svn-id: http://core.svn.wordpress.org/trunk@53104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:17:08 +00:00
audrasjb
8ea403e9bb Docs: Use third-person singular verbs for function descriptions in the WP_Screen API.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53514


git-svn-id: http://core.svn.wordpress.org/trunk@53103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 23:10:10 +00:00
Sergey Biryukov
2a1e9e1dd8 Docs: Add @since notes for html5 theme feature changes in add_theme_support():
* As of WordPress 3.6.1, the `html5` feature requires an array of types to be passed. Defaults to `comment-list`, `comment-form`, `search-form` for backward compatibility.
* As of WordPress 6.0, the previously added `_doing_it_wrong()` notice is actually displayed as expected.

Follow-up to [25193], [25235], [25785], [49344], [49354], [52828].

Props bobbingwide.
See #51657, #55646.
Built from https://develop.svn.wordpress.org/trunk@53513


git-svn-id: http://core.svn.wordpress.org/trunk@53102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-16 15:21:15 +00:00
spacedmonkey
e5e61f3095 Tests: Re-enable failing REST API test for update_post_parent_caches().
Ensure that that attachment objects are not primed in cache so that test passes when object caching is enabled. 

Follow-up to [53506].

Props SergeyBiryukov.
See #55593.
Built from https://develop.svn.wordpress.org/trunk@53512


git-svn-id: http://core.svn.wordpress.org/trunk@53101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 19:34:12 +00:00
Sergey Biryukov
cbca7c4fb9 Tests: Temporarily disable the failing REST API test for update_post_parent_caches().
This needs more investigation to address the test failure with persistent object cache.

Follow-up to [53506].

Props hellofromTonya.
See #55593.
Built from https://develop.svn.wordpress.org/trunk@53511


git-svn-id: http://core.svn.wordpress.org/trunk@53100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 15:39:08 +00:00
Sergey Biryukov
0c2ced37c3 Tests: Use assertSameSets() in some newly introduced tests.
This ensures that not only the array values being compared are equal, but also that their type is the same.

Going forward, stricter type checking by using `assertSameSets()` or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.

Follow-up to [48939], [51137], [51943], [53499], [53504], [53506], [53509].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53510


git-svn-id: http://core.svn.wordpress.org/trunk@53099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 14:44:11 +00:00
Sergey Biryukov
43f0f88b15 Tests: Some improvements for REST API cache priming tests:
* Give the test methods more specific names and move them closer together.
* Correct the `@covers` tags.

Follow-up to [53499], [53504], [53506], [53507], [53508].

See #55593, #55652.
Built from https://develop.svn.wordpress.org/trunk@53509


git-svn-id: http://core.svn.wordpress.org/trunk@53098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 14:09:08 +00:00
Sergey Biryukov
a42b89fc71 REST API: Some documentation and test improvements for update_menu_item_cache():
* Make the function description more specific, for consistency with other similar functions.
* Add a `@since` note for the `$update_menu_item_cache` parameter of `WP_Query::parse_query()`.
* Add missing `@covers` tags for the unit tests.

Follow-up to [53504].

See #55620.
Built from https://develop.svn.wordpress.org/trunk@53508


git-svn-id: http://core.svn.wordpress.org/trunk@53097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 13:37:10 +00:00
Sergey Biryukov
84a8194200 REST API: Some documentation and test improvements for update_post_parent_caches():
* Make the function description more specific, for consistency with `update_post_author_caches()`.
* Add missing `@covers` tags for the unit test.

Follow-up to [53506].

See #55593.
Built from https://develop.svn.wordpress.org/trunk@53507


git-svn-id: http://core.svn.wordpress.org/trunk@53096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 13:19:10 +00:00
spacedmonkey
2c8a6170af REST API: Prime caches for post parents in post REST API controller.
Prime caches for all post parents in the post REST API controller using the `_prime_post_caches` function. Post parent objects are required as part of the `check_read_permission` method’s permission check in post REST API controller. 

Props spacedmonkey, furi3r, peterwilsoncc, mitogh, madpixels. 
Fixes #55593.
Built from https://develop.svn.wordpress.org/trunk@53506


git-svn-id: http://core.svn.wordpress.org/trunk@53095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 10:43:10 +00:00
Sergey Biryukov
ab5cc35046 Database: Don't translate the "WordPress database error" message in the error log.
When using multilingual websites, this string could end up with multiple different translations in the error log, making it less actionable.

Unlike errors displayed to the user, a general consensus for software is that errors in logs should always be in English. Since MySQL errors are also returned in English, this brings more consistency to the logs.

Follow-up to [6391], [8168], [19760].

Props malthert.
Fixes #53125.
Built from https://develop.svn.wordpress.org/trunk@53505


git-svn-id: http://core.svn.wordpress.org/trunk@53094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 10:36:09 +00:00
spacedmonkey
991acc48d4 REST API: Prime caches for linked objects in menu item REST API controller.
Add a new parameter to `WP_Query` called `update_menu_item_cache` that when set to true, primes the caches for linked terms and posts for menu item post objects. This change moves logic 
found in `wp_get_nav_menu_items` into a new function called `update_menu_item_cache`.  Update the menu item REST API controller, to pass the `update_menu_item_cache` parameter to the 
arguments used for the  `WP_Query` run to get menu items. 

Props furi3r,  TimothyBlynJacobs, spacedmonkey, peterwilsoncc, mitogh.
Fixes #55620.

 --This line, and those below, will be ignored--

M    src/wp-includes/class-wp-query.php
M    src/wp-includes/nav-menu.php
M    src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
M    tests/phpunit/tests/post/nav-menu.php

Built from https://develop.svn.wordpress.org/trunk@53504


git-svn-id: http://core.svn.wordpress.org/trunk@53093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-15 10:20:13 +00:00
Sergey Biryukov
73a2d87eae Docs: Add a comment for stripping the leading AND from SQL clauses in some query classes.
Follow-up to [30084], [34529], [34542], [36598], [37477], [37572], [43010].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53503


git-svn-id: http://core.svn.wordpress.org/trunk@53092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 16:17:08 +00:00
Sergey Biryukov
cacf46f12b Docs: Add a missing word in pre_months_dropdown_query filter description.
Follow-up to [50163].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53502


git-svn-id: http://core.svn.wordpress.org/trunk@53091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 15:07:10 +00:00
Sergey Biryukov
3f74637dfe I18N: Use a translatable string for displaying a user's first name and last name.
That allows locales to switch the order of the first name and last name, should they prefer to do so.

The string was previously used in `wp_insert_user()` and is now reused in other places for consistency:

* `WP_MS_Users_List_Table::column_name()`​
* `WP_Users_List_Table::column_name()​`
* `wp_list_authors()`
* `wp_list_users()`

Note: This also removes the `wp_list_author_full_name` filter, introduced for the same purpose in `wp_list_authors()`, as redundant for now.

Follow-up to [53486].

See #17025.
Built from https://develop.svn.wordpress.org/trunk@53501


git-svn-id: http://core.svn.wordpress.org/trunk@53090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 14:43:12 +00:00
desrosj
cc05e7b608 External Libraries: Upgrade PHPMailer to version 6.6.2.
Release notes: https://github.com/PHPMailer/PHPMailer/releases/tag/v6.6.2.

For a full list of changes in this update, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v6.6.0...v6.6.2.

Props ayeshrajans, jrf.
Fixes #55976.
Built from https://develop.svn.wordpress.org/trunk@53500


git-svn-id: http://core.svn.wordpress.org/trunk@53089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 14:38:10 +00:00
spacedmonkey
77f62c11db REST API: Prime caches for featured images in post controller.
Ensure that featured image caches are primed for post collections in the post REST API controller, by calling the `update_post_thumbnail_cache` function. 

Props Spacedmonkey, TimothyBlynJacobs, mitogh.
Fixes #55592. 


Built from https://develop.svn.wordpress.org/trunk@53499


git-svn-id: http://core.svn.wordpress.org/trunk@53088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 13:10:10 +00:00
spacedmonkey
7df9ba26b2 REST API: Avoid duplicated query in post collections.
Avoid duplicated query when retrieving empty posts collections by adding a check if the page is more than 1. 

Props furi3r, gdetassigny, TimothyBlynJacobs, spacedmonkey. 
Fixes #55677.


Built from https://develop.svn.wordpress.org/trunk@53498


git-svn-id: http://core.svn.wordpress.org/trunk@53087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 12:42:10 +00:00
Sergey Biryukov
c7ab92451a Tests: Remove redundant skip call in Tests_Image_Functions::get_image_editor_engine_classes().
The test bootstrap requires GD to be available, so this test skip condition will never be matched.

Also, test skipping from within a helper method, which may be used in a data provider, can lead to test runtime errors.

Follow-up to [49009], [49014], [49535], [49571], [51415].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53497


git-svn-id: http://core.svn.wordpress.org/trunk@53086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 11:46:09 +00:00
spacedmonkey
47a8b2f5de Taxonomy: Fix caching issues in WP_Term_Query class.
Introduced [52836] when passing `child_of` or `pad_counts` parameters to `get_terms` or `WP_Term_Query` class, the array of terms received by the query, was not correctly cached. This 
change simplifies the logic in `WP_Term_Query` and ensures terms are correctly cached. This change also, improves performance, by only caching an array of term ids where possible.  

Props denishua, spacedmonkey, oztaser, peterwilsoncc, SergeyBiryukov, georgestephanis, jnz31, knutsp, mukesh27, costdev.
Fixes #55837.


Built from https://develop.svn.wordpress.org/trunk@53496


git-svn-id: http://core.svn.wordpress.org/trunk@53085 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-14 11:43:13 +00:00
Sergey Biryukov
e3e0bb1183 Tests: Move helper functions in Tests_Image_Functions to more appropriate places.
* Move a non-test specific helper function used by multiple tests up to the top of the class to make it more easily discoverable.
* Move a test-specific helper function used by only one test to be directly below the test using the helper function and make the link with the test explicit by adding a `@see` tag.

Follow-up to [1201/tests], [51415].

Props jrf.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53495


git-svn-id: http://core.svn.wordpress.org/trunk@53084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 16:44:10 +00:00
Sergey Biryukov
30a9e469b8 Tests: Rename classes in phpunit/tests/option/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651], [51860], [52264], [52265], [53489].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53494


git-svn-id: http://core.svn.wordpress.org/trunk@53083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 15:26:10 +00:00
Sergey Biryukov
ca2e67d1b0 Tests: Add a unit test for PHP 8.1 deprecation notice in wp_user_settings().
This ensures that PHP 8.1 "passing null to non-nullable" deprecation notice is not thrown for the `$domain` parameter of `setcookie()` calls in the function.

Follow-up to [53490].

See #54914.
Built from https://develop.svn.wordpress.org/trunk@53493


git-svn-id: http://core.svn.wordpress.org/trunk@53082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 15:22:10 +00:00
Sergey Biryukov
e3e07d2751 Tests: Use more consistent wording when referring to PHP deprecation notices.
Follow-up to [51619], [51695].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53492


git-svn-id: http://core.svn.wordpress.org/trunk@53081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-13 14:53:11 +00:00
Sergey Biryukov
c12b446f41 Tests: Use a consistent URL in HTTP response cookie tests.
Follow-up to [34369], [35734], [38164].

See #51568.
Built from https://develop.svn.wordpress.org/trunk@53491


git-svn-id: http://core.svn.wordpress.org/trunk@53080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-12 15:18:10 +00:00
Sergey Biryukov
6151fddb6c Code Modernization: Pass correct default value to setcookie() in wp_user_settings().
The `wp_user_settings()` function calls the PHP native `setcookie()` function, the fifth parameter of which is the ''optional'' `$domain` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.

In this case, this function call yielded a `setcookie(): Passing null to parameter #5 ($domain) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without a backward compatibility break.

References:
* [https://www.php.net/manual/en/function.setcookie.php PHP Manual: setcookie()]
* [https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg PHP RFC: Deprecate passing null to non-nullable arguments of internal functions]

Follow-up to [29478].

Props ocean90, shenyanzhi, meysamnorouzi, jrf.
Fixes #54914.
Built from https://develop.svn.wordpress.org/trunk@53490


git-svn-id: http://core.svn.wordpress.org/trunk@53079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-12 11:11:11 +00:00
Sergey Biryukov
97eff9b7b2 Tests: Rename classes in phpunit/tests/user/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492], [51493], [51623], [51639], [51646], [51650], [51651], [51860], [52264], [52265].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53489


git-svn-id: http://core.svn.wordpress.org/trunk@53078 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-11 15:50:08 +00:00
Sergey Biryukov
df324b9ff6 Tests: Re-initialize WP_Rewrite before running wp_list_authors() tests.
This ensures that the expected results use the default permalink structure, not affected by other tests.

Follow-up to [27550], [27684], [53487].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53488


git-svn-id: http://core.svn.wordpress.org/trunk@53077 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-11 15:36:13 +00:00
Sergey Biryukov
193a959806 Tests: Rename the test file and class for wp_list_authors() tests.
This matches the name of the function being tested.

Follow-up to [27550].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53487


git-svn-id: http://core.svn.wordpress.org/trunk@53076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-11 13:43:13 +00:00
audrasjb
df0d910007 Query: Add a hook to filter author full name from wp_list_authors().
This changeset introduces the `wp_list_author_full_name` hook to allows developers to filter author full name, which by default is a combinaison of the author first and last name, separated by a space.

Props kevinB, wonderboymusic, DrewAPicture, nacin, Mte90, jorbin, afercia, rafiahmedd.
Fixes #17025.

Built from https://develop.svn.wordpress.org/trunk@53486


git-svn-id: http://core.svn.wordpress.org/trunk@53075 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 18:23:18 +00:00
spacedmonkey
c8f31dc0c0 REST API: Improve post cache priming in WP_REST_Post_Search_Handler class.
In the `WP_REST_Post_Search_Handler` class, ensure that post, post meta and term caches are correctly primed when performing a search.

Props furi3r, spacedmonkey, TimothyBlynJacobs, audrasjb, peterwilsoncc. 
Fixes #55674.


Built from https://develop.svn.wordpress.org/trunk@53485


git-svn-id: http://core.svn.wordpress.org/trunk@53074 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 15:47:08 +00:00
Sergey Biryukov
a29c6663fd Docs: Use typed array notation in some post function DocBlocks:
* `wp_queue_posts_for_term_meta_lazyload()`
* `_prime_post_caches()`

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53484


git-svn-id: http://core.svn.wordpress.org/trunk@53073 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 15:22:11 +00:00
Sergey Biryukov
9e01bd8adc Query: Some documentation and test improvements for update_post_author_caches():
* Make the descriptions for `update_post_author_caches()` and `update_post_caches()` more specific.
* Move the unit test into its own file, for consistency with `update_post_cache()` tests. This also allows for using shared fixtures in case more tests are added in the future.

Follow-up to [53482].

See #55716.
Built from https://develop.svn.wordpress.org/trunk@53483


git-svn-id: http://core.svn.wordpress.org/trunk@53072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 15:17:10 +00:00
spacedmonkey
2237f67458 Prime users cache in WP_Query and post REST API controller.
For a call to `WP_Query` or a post REST API request that contains posts from multiple authors, call the `cache_users` function, to ensure that all user data for post authors is primed in 
a single database query. This results in far fewer database queries on multiple author sites. 

Props spacedmonkey, timothyblynjacobs, peterwilsoncc.
Fixes #55716.

Built from https://develop.svn.wordpress.org/trunk@53482


git-svn-id: http://core.svn.wordpress.org/trunk@53071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 13:39:11 +00:00
Sergey Biryukov
558cd4c353 Media: Some documentation and test improvements for wp_img_tag_add_decoding_attr():
* Add a `@since` note for the `decoding` attribute in `wp_get_attachment_image()`.
* Adjust `wp_img_tag_add_decoding_attr()` DocBlocks per the documentation standards.
* Wrap some long `sprintf()` calls in unit tests for better readability. In at least one case, `the_content` was unnecessarily passed to `sprintf()` as an extra (unused) parameter.

Follow-up to [53480].

See #53232.
Built from https://develop.svn.wordpress.org/trunk@53481


git-svn-id: http://core.svn.wordpress.org/trunk@53070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-09 16:21:14 +00:00
Peter Wilson
b8e44627c8 Media: Add decoding="async" to image attributes.
Dynamically add `decoding="async"` to image tags on the front end of a site to instruct browsers to download them in parallel.

Modifies `wp_get_attachment_image()`, `get_avatar()` to include the attribute by default. Modifies `wp_filter_content_tags()` to add the attribute during the front-end render of the site.

Introduces `wp_img_tag_add_decoding_attr()` to take an image tag and modify it to include the attribute. Introduces the filter `wp_img_tag_add_decoding_attr` used to define the default value for the attribute.

Props adamsilverstein, ayeshrajans, costdev, flixos90, hellofromtonya, isaumya, michaelbourne, mihai2u, mitogh, sergiomdgomes, spacedmonkey, westonruter, peterwilsoncc.
Fixes #53232.

Built from https://develop.svn.wordpress.org/trunk@53480


git-svn-id: http://core.svn.wordpress.org/trunk@53069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-09 05:31:12 +00:00
Sergey Biryukov
cf5df71b88 Tests: Correct an assertion in wp_rand() tests.
The function returns non-negative integers, which includes zero.

Follow-up to [53473], [53477].

See #55194.
Built from https://develop.svn.wordpress.org/trunk@53479


git-svn-id: http://core.svn.wordpress.org/trunk@53068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-08 13:19:14 +00:00
Sergey Biryukov
4b286c4f77 Tests: Move the tests for individual pluggable functions into their own directory.
This aims to make the tests more discoverable and easier to expand.

Follow-up to [50790], [53473], [53477].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53478


git-svn-id: http://core.svn.wordpress.org/trunk@53067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 14:45:12 +00:00
Sergey Biryukov
e380ff685d Tests: Use more descriptive names for wp_rand() test methods.
This aims to clarify the intention of the tests.

Follow-up to [53473].

Props mlajo, costdev, acoulombe, azouamauriac, swissspidy, tobifjellner, peterwilsoncc, audrasjb, marekdedic, SergeyBiryukov.
See #55194.
Built from https://develop.svn.wordpress.org/trunk@53477


git-svn-id: http://core.svn.wordpress.org/trunk@53066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 12:03:12 +00:00
audrasjb
7821fe08db Text Changes: Improve consistency of admin error notices in wp-admin/options.php.
This changeset replaces <strong>Error</strong>: with <strong>Error:</strong>, for better consistency.

Follow-up to [53458].

Fixes #50785.

Built from https://develop.svn.wordpress.org/trunk@53476


git-svn-id: http://core.svn.wordpress.org/trunk@53065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 05:30:13 +00:00
audrasjb
2029a33158 Twenty-Twenty: Fix a width/alignement issue on "Wide Line" Separator style variation.
This change fixes an alignement issue on the "Wide Line" Separator style variation on front-end, especially when used inside a column block. It changes the block `width` value from `120rem` to `100%` to avoid container overflowing.

Props kjellr, matthiaspabst, sabernhardt, audrasjb.
Fixes #53643.

Built from https://develop.svn.wordpress.org/trunk@53475


git-svn-id: http://core.svn.wordpress.org/trunk@53064 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 05:23:09 +00:00
audrasjb
20c003e842 Docs: Use third-person singular verbs for function descriptions in the Core Translation API.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53474


git-svn-id: http://core.svn.wordpress.org/trunk@53063 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-07 05:18:13 +00:00
audrasjb
56d7437f59 General: Ensure wp_rand() returns 0 when $min and $max values are equal to 0.
This changeset ensures `wp_rand()` returns zero instead of a random number when both `$min` and `$max` values are equal to zero.

Fixes #55194.

Built from https://develop.svn.wordpress.org/trunk@53473


git-svn-id: http://core.svn.wordpress.org/trunk@53062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 22:50:10 +00:00
audrasjb
0ab9c4ee4b Docs: Various fixes in wp-includes/pluggable.php docblocks, as per documentation standards.
See #55646.

Built from https://develop.svn.wordpress.org/trunk@53472


git-svn-id: http://core.svn.wordpress.org/trunk@53061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 22:35:10 +00:00
audrasjb
312f7d4b76 Twenty-Twenty: Fix paragraph block alignment issues when used on a RTL website.
Twenty Twenty's `style.css` file has `/*rtl:ignore*/` for the `.has-text-align-left` class, but that was previously missing from the `.has-text-align-right` class. As a result, the theme overrides block library styles on the front-end (and not in the editor). This changeset adds the missing declaration.

Props amirkamizi, mayankmajeji, ianbelanger, sabernhardt, hasanuzzamanshamim.
Fixes #49447.

Built from https://develop.svn.wordpress.org/trunk@53471


git-svn-id: http://core.svn.wordpress.org/trunk@53060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 21:42:13 +00:00
audrasjb
5d96ddab10 Twenty-Twenty: Improve Quote block style consistency between front and back-end.
This changeset updates the `font-style` value of the Quote block in the block editor to ensure styles are consistent between the editor and the front-end.

Props kajalgohel, iamjaydip, audrasjb, whaze, mukesh27.
Fixes #55931.


Built from https://develop.svn.wordpress.org/trunk@53470


git-svn-id: http://core.svn.wordpress.org/trunk@53059 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 13:31:15 +00:00
Sergey Biryukov
a29a0e05d1 Docs: Correct method reference format in some DocBlocks.
This ensures that the methods are recognized by the WordPress Code Reference parser.

Follow-up to [7994], [25567], [27156], [28887], [49672], [52226].

Props dd32, audrasjb.
Fixes #55928.
Built from https://develop.svn.wordpress.org/trunk@53469


git-svn-id: http://core.svn.wordpress.org/trunk@53058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 10:51:12 +00:00
desrosj
1ce3b1ae3b Build/Test Tools: Correctly confirm the previous workflow run was triggered by a push event.
This fixes the code added in [53466] to look at the correct workflow object when determining the outcome of the previous workflow run.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53468


git-svn-id: http://core.svn.wordpress.org/trunk@53057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-05 19:45:15 +00:00
Sergey Biryukov
6c79e4b29b Tests: Update the URL to the documentation on GitHub Actions environment variables.
Follow-up to [49264].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53467


git-svn-id: http://core.svn.wordpress.org/trunk@53056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-05 14:06:11 +00:00
desrosj
6a7de2d74a Build/Test Tools: Prevent inaccurate “fixed” notifications in Slack.
When searching for previous workflow runs by branch, GitHub currently includes matches within forks.

If a contributor opens a pull request from their fork with a `head_ref` matching a Core branch that triggers a workflow on `push` event, the outcomes of the workflows associated with that pull request are currently used to determine if the previous workflow run had failed.

The result is a false “fixed” notifications when a commit immediately follows a failed workflow run from the pull request.

This adds a check to skip any workflow runs not triggered by a `push` event to prevent these inaccurate notifications.

Props SergeyBiryukov.
See #55652.
Built from https://develop.svn.wordpress.org/trunk@53466


git-svn-id: http://core.svn.wordpress.org/trunk@53055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-05 09:31:13 +00:00
Sergey Biryukov
5a2b984cc0 Tests: Don't overwrite image metadata in a wp_calculate_image_srcset() test for zero width.
This was unnecessarily replacing the original image metadata with a scaled version, leading to a few leftover images with the `-scaled` suffix in the `wp-content/uploads` directory.

Follow-up to [35412].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53465


git-svn-id: http://core.svn.wordpress.org/trunk@53054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-04 18:05:08 +00:00
Sergey Biryukov
61b7a2a3e2 Tests: Consistently pass the $force_delete parameter to wp_delete_attachment().
Convert some `wp_delete_post()` calls to `wp_delete_attachment()` to avoid an extra function call.

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53464


git-svn-id: http://core.svn.wordpress.org/trunk@53053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-04 13:41:08 +00:00
Sergey Biryukov
854a06a4ad Tests: Clean up test images before performing assertions in image resize tests.
This makes sure there are no leftover images in case of a test failure.

Follow-up to [161/tests], [1255/tests].

See #55652.
Built from https://develop.svn.wordpress.org/trunk@53463


git-svn-id: http://core.svn.wordpress.org/trunk@53052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-04 12:57:10 +00:00